import {
  __commonJS,
  __esm,
  __export,
  __toCommonJS,
  __toESM
} from "./chunk-QRPWKJ4C.js";

// node-modules-polyfills:util
function dew$k() {
  if (_dewExec$k) return exports$k;
  _dewExec$k = true;
  exports$k = function hasSymbols() {
    if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
      return false;
    }
    if (typeof Symbol.iterator === "symbol") {
      return true;
    }
    var obj = {};
    var sym = Symbol("test");
    var symObj = Object(sym);
    if (typeof sym === "string") {
      return false;
    }
    if (Object.prototype.toString.call(sym) !== "[object Symbol]") {
      return false;
    }
    if (Object.prototype.toString.call(symObj) !== "[object Symbol]") {
      return false;
    }
    var symVal = 42;
    obj[sym] = symVal;
    for (sym in obj) {
      return false;
    }
    if (typeof Object.keys === "function" && Object.keys(obj).length !== 0) {
      return false;
    }
    if (typeof Object.getOwnPropertyNames === "function" && Object.getOwnPropertyNames(obj).length !== 0) {
      return false;
    }
    var syms = Object.getOwnPropertySymbols(obj);
    if (syms.length !== 1 || syms[0] !== sym) {
      return false;
    }
    if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) {
      return false;
    }
    if (typeof Object.getOwnPropertyDescriptor === "function") {
      var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
      if (descriptor.value !== symVal || descriptor.enumerable !== true) {
        return false;
      }
    }
    return true;
  };
  return exports$k;
}
function dew$j() {
  if (_dewExec$j) return exports$j;
  _dewExec$j = true;
  exports$j = Error;
  return exports$j;
}
function dew$i() {
  if (_dewExec$i) return exports$i;
  _dewExec$i = true;
  exports$i = EvalError;
  return exports$i;
}
function dew$h() {
  if (_dewExec$h) return exports$h;
  _dewExec$h = true;
  exports$h = RangeError;
  return exports$h;
}
function dew$g() {
  if (_dewExec$g) return exports$g;
  _dewExec$g = true;
  exports$g = ReferenceError;
  return exports$g;
}
function dew$f() {
  if (_dewExec$f) return exports$f;
  _dewExec$f = true;
  exports$f = SyntaxError;
  return exports$f;
}
function dew$e() {
  if (_dewExec$e) return exports$e;
  _dewExec$e = true;
  exports$e = TypeError;
  return exports$e;
}
function dew$d() {
  if (_dewExec$d) return exports$d;
  _dewExec$d = true;
  exports$d = URIError;
  return exports$d;
}
function dew$c() {
  if (_dewExec$c) return exports$c;
  _dewExec$c = true;
  var origSymbol = typeof Symbol !== "undefined" && Symbol;
  var hasSymbolSham = dew$k();
  exports$c = function hasNativeSymbols() {
    if (typeof origSymbol !== "function") {
      return false;
    }
    if (typeof Symbol !== "function") {
      return false;
    }
    if (typeof origSymbol("foo") !== "symbol") {
      return false;
    }
    if (typeof Symbol("bar") !== "symbol") {
      return false;
    }
    return hasSymbolSham();
  };
  return exports$c;
}
function dew$b() {
  if (_dewExec$b) return exports$b;
  _dewExec$b = true;
  var test = {
    __proto__: null,
    foo: {}
  };
  var $Object = Object;
  exports$b = function hasProto() {
    return {
      __proto__: test
    }.foo === test.foo && !(test instanceof $Object);
  };
  return exports$b;
}
function dew$a() {
  if (_dewExec$a) return exports$a;
  _dewExec$a = true;
  var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
  var toStr = Object.prototype.toString;
  var max = Math.max;
  var funcType = "[object Function]";
  var concatty = function concatty2(a, b) {
    var arr = [];
    for (var i = 0; i < a.length; i += 1) {
      arr[i] = a[i];
    }
    for (var j = 0; j < b.length; j += 1) {
      arr[j + a.length] = b[j];
    }
    return arr;
  };
  var slicy = function slicy2(arrLike, offset) {
    var arr = [];
    for (var i = offset, j = 0; i < arrLike.length; i += 1, j += 1) {
      arr[j] = arrLike[i];
    }
    return arr;
  };
  var joiny = function(arr, joiner) {
    var str = "";
    for (var i = 0; i < arr.length; i += 1) {
      str += arr[i];
      if (i + 1 < arr.length) {
        str += joiner;
      }
    }
    return str;
  };
  exports$a = function bind(that) {
    var target = this;
    if (typeof target !== "function" || toStr.apply(target) !== funcType) {
      throw new TypeError(ERROR_MESSAGE + target);
    }
    var args = slicy(arguments, 1);
    var bound;
    var binder = function() {
      if (this instanceof bound) {
        var result = target.apply(this, concatty(args, arguments));
        if (Object(result) === result) {
          return result;
        }
        return this;
      }
      return target.apply(that, concatty(args, arguments));
    };
    var boundLength = max(0, target.length - args.length);
    var boundArgs = [];
    for (var i = 0; i < boundLength; i++) {
      boundArgs[i] = "$" + i;
    }
    bound = Function("binder", "return function (" + joiny(boundArgs, ",") + "){ return binder.apply(this,arguments); }")(binder);
    if (target.prototype) {
      var Empty = function Empty2() {
      };
      Empty.prototype = target.prototype;
      bound.prototype = new Empty();
      Empty.prototype = null;
    }
    return bound;
  };
  return exports$a;
}
function dew$9() {
  if (_dewExec$9) return exports$9;
  _dewExec$9 = true;
  var implementation = dew$a();
  exports$9 = Function.prototype.bind || implementation;
  return exports$9;
}
function dew$8() {
  if (_dewExec$8) return exports$8;
  _dewExec$8 = true;
  var call = Function.prototype.call;
  var $hasOwn = Object.prototype.hasOwnProperty;
  var bind = dew$9();
  exports$8 = bind.call(call, $hasOwn);
  return exports$8;
}
function dew$7() {
  if (_dewExec$7) return exports$7;
  _dewExec$7 = true;
  var undefined$1;
  var $Error = dew$j();
  var $EvalError = dew$i();
  var $RangeError = dew$h();
  var $ReferenceError = dew$g();
  var $SyntaxError = dew$f();
  var $TypeError = dew$e();
  var $URIError = dew$d();
  var $Function = Function;
  var getEvalledConstructor = function(expressionSyntax) {
    try {
      return $Function('"use strict"; return (' + expressionSyntax + ").constructor;")();
    } catch (e) {
    }
  };
  var $gOPD = Object.getOwnPropertyDescriptor;
  if ($gOPD) {
    try {
      $gOPD({}, "");
    } catch (e) {
      $gOPD = null;
    }
  }
  var throwTypeError = function() {
    throw new $TypeError();
  };
  var ThrowTypeError = $gOPD ? (function() {
    try {
      arguments.callee;
      return throwTypeError;
    } catch (calleeThrows) {
      try {
        return $gOPD(arguments, "callee").get;
      } catch (gOPDthrows) {
        return throwTypeError;
      }
    }
  })() : throwTypeError;
  var hasSymbols = dew$c()();
  var hasProto = dew$b()();
  var getProto = Object.getPrototypeOf || (hasProto ? function(x) {
    return x.__proto__;
  } : null);
  var needsEval = {};
  var TypedArray = typeof Uint8Array === "undefined" || !getProto ? undefined$1 : getProto(Uint8Array);
  var INTRINSICS = {
    __proto__: null,
    "%AggregateError%": typeof AggregateError === "undefined" ? undefined$1 : AggregateError,
    "%Array%": Array,
    "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$1 : ArrayBuffer,
    "%ArrayIteratorPrototype%": hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined$1,
    "%AsyncFromSyncIteratorPrototype%": undefined$1,
    "%AsyncFunction%": needsEval,
    "%AsyncGenerator%": needsEval,
    "%AsyncGeneratorFunction%": needsEval,
    "%AsyncIteratorPrototype%": needsEval,
    "%Atomics%": typeof Atomics === "undefined" ? undefined$1 : Atomics,
    "%BigInt%": typeof BigInt === "undefined" ? undefined$1 : BigInt,
    "%BigInt64Array%": typeof BigInt64Array === "undefined" ? undefined$1 : BigInt64Array,
    "%BigUint64Array%": typeof BigUint64Array === "undefined" ? undefined$1 : BigUint64Array,
    "%Boolean%": Boolean,
    "%DataView%": typeof DataView === "undefined" ? undefined$1 : DataView,
    "%Date%": Date,
    "%decodeURI%": decodeURI,
    "%decodeURIComponent%": decodeURIComponent,
    "%encodeURI%": encodeURI,
    "%encodeURIComponent%": encodeURIComponent,
    "%Error%": $Error,
    "%eval%": eval,
    // eslint-disable-line no-eval
    "%EvalError%": $EvalError,
    "%Float32Array%": typeof Float32Array === "undefined" ? undefined$1 : Float32Array,
    "%Float64Array%": typeof Float64Array === "undefined" ? undefined$1 : Float64Array,
    "%FinalizationRegistry%": typeof FinalizationRegistry === "undefined" ? undefined$1 : FinalizationRegistry,
    "%Function%": $Function,
    "%GeneratorFunction%": needsEval,
    "%Int8Array%": typeof Int8Array === "undefined" ? undefined$1 : Int8Array,
    "%Int16Array%": typeof Int16Array === "undefined" ? undefined$1 : Int16Array,
    "%Int32Array%": typeof Int32Array === "undefined" ? undefined$1 : Int32Array,
    "%isFinite%": isFinite,
    "%isNaN%": isNaN,
    "%IteratorPrototype%": hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
    "%JSON%": typeof JSON === "object" ? JSON : undefined$1,
    "%Map%": typeof Map === "undefined" ? undefined$1 : Map,
    "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols || !getProto ? undefined$1 : getProto((/* @__PURE__ */ new Map())[Symbol.iterator]()),
    "%Math%": Math,
    "%Number%": Number,
    "%Object%": Object,
    "%parseFloat%": parseFloat,
    "%parseInt%": parseInt,
    "%Promise%": typeof Promise === "undefined" ? undefined$1 : Promise,
    "%Proxy%": typeof Proxy === "undefined" ? undefined$1 : Proxy,
    "%RangeError%": $RangeError,
    "%ReferenceError%": $ReferenceError,
    "%Reflect%": typeof Reflect === "undefined" ? undefined$1 : Reflect,
    "%RegExp%": RegExp,
    "%Set%": typeof Set === "undefined" ? undefined$1 : Set,
    "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols || !getProto ? undefined$1 : getProto((/* @__PURE__ */ new Set())[Symbol.iterator]()),
    "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined$1 : SharedArrayBuffer,
    "%String%": String,
    "%StringIteratorPrototype%": hasSymbols && getProto ? getProto(""[Symbol.iterator]()) : undefined$1,
    "%Symbol%": hasSymbols ? Symbol : undefined$1,
    "%SyntaxError%": $SyntaxError,
    "%ThrowTypeError%": ThrowTypeError,
    "%TypedArray%": TypedArray,
    "%TypeError%": $TypeError,
    "%Uint8Array%": typeof Uint8Array === "undefined" ? undefined$1 : Uint8Array,
    "%Uint8ClampedArray%": typeof Uint8ClampedArray === "undefined" ? undefined$1 : Uint8ClampedArray,
    "%Uint16Array%": typeof Uint16Array === "undefined" ? undefined$1 : Uint16Array,
    "%Uint32Array%": typeof Uint32Array === "undefined" ? undefined$1 : Uint32Array,
    "%URIError%": $URIError,
    "%WeakMap%": typeof WeakMap === "undefined" ? undefined$1 : WeakMap,
    "%WeakRef%": typeof WeakRef === "undefined" ? undefined$1 : WeakRef,
    "%WeakSet%": typeof WeakSet === "undefined" ? undefined$1 : WeakSet
  };
  if (getProto) {
    try {
      null.error;
    } catch (e) {
      var errorProto = getProto(getProto(e));
      INTRINSICS["%Error.prototype%"] = errorProto;
    }
  }
  var doEval = function doEval2(name) {
    var value;
    if (name === "%AsyncFunction%") {
      value = getEvalledConstructor("async function () {}");
    } else if (name === "%GeneratorFunction%") {
      value = getEvalledConstructor("function* () {}");
    } else if (name === "%AsyncGeneratorFunction%") {
      value = getEvalledConstructor("async function* () {}");
    } else if (name === "%AsyncGenerator%") {
      var fn = doEval2("%AsyncGeneratorFunction%");
      if (fn) {
        value = fn.prototype;
      }
    } else if (name === "%AsyncIteratorPrototype%") {
      var gen = doEval2("%AsyncGenerator%");
      if (gen && getProto) {
        value = getProto(gen.prototype);
      }
    }
    INTRINSICS[name] = value;
    return value;
  };
  var LEGACY_ALIASES = {
    __proto__: null,
    "%ArrayBufferPrototype%": ["ArrayBuffer", "prototype"],
    "%ArrayPrototype%": ["Array", "prototype"],
    "%ArrayProto_entries%": ["Array", "prototype", "entries"],
    "%ArrayProto_forEach%": ["Array", "prototype", "forEach"],
    "%ArrayProto_keys%": ["Array", "prototype", "keys"],
    "%ArrayProto_values%": ["Array", "prototype", "values"],
    "%AsyncFunctionPrototype%": ["AsyncFunction", "prototype"],
    "%AsyncGenerator%": ["AsyncGeneratorFunction", "prototype"],
    "%AsyncGeneratorPrototype%": ["AsyncGeneratorFunction", "prototype", "prototype"],
    "%BooleanPrototype%": ["Boolean", "prototype"],
    "%DataViewPrototype%": ["DataView", "prototype"],
    "%DatePrototype%": ["Date", "prototype"],
    "%ErrorPrototype%": ["Error", "prototype"],
    "%EvalErrorPrototype%": ["EvalError", "prototype"],
    "%Float32ArrayPrototype%": ["Float32Array", "prototype"],
    "%Float64ArrayPrototype%": ["Float64Array", "prototype"],
    "%FunctionPrototype%": ["Function", "prototype"],
    "%Generator%": ["GeneratorFunction", "prototype"],
    "%GeneratorPrototype%": ["GeneratorFunction", "prototype", "prototype"],
    "%Int8ArrayPrototype%": ["Int8Array", "prototype"],
    "%Int16ArrayPrototype%": ["Int16Array", "prototype"],
    "%Int32ArrayPrototype%": ["Int32Array", "prototype"],
    "%JSONParse%": ["JSON", "parse"],
    "%JSONStringify%": ["JSON", "stringify"],
    "%MapPrototype%": ["Map", "prototype"],
    "%NumberPrototype%": ["Number", "prototype"],
    "%ObjectPrototype%": ["Object", "prototype"],
    "%ObjProto_toString%": ["Object", "prototype", "toString"],
    "%ObjProto_valueOf%": ["Object", "prototype", "valueOf"],
    "%PromisePrototype%": ["Promise", "prototype"],
    "%PromiseProto_then%": ["Promise", "prototype", "then"],
    "%Promise_all%": ["Promise", "all"],
    "%Promise_reject%": ["Promise", "reject"],
    "%Promise_resolve%": ["Promise", "resolve"],
    "%RangeErrorPrototype%": ["RangeError", "prototype"],
    "%ReferenceErrorPrototype%": ["ReferenceError", "prototype"],
    "%RegExpPrototype%": ["RegExp", "prototype"],
    "%SetPrototype%": ["Set", "prototype"],
    "%SharedArrayBufferPrototype%": ["SharedArrayBuffer", "prototype"],
    "%StringPrototype%": ["String", "prototype"],
    "%SymbolPrototype%": ["Symbol", "prototype"],
    "%SyntaxErrorPrototype%": ["SyntaxError", "prototype"],
    "%TypedArrayPrototype%": ["TypedArray", "prototype"],
    "%TypeErrorPrototype%": ["TypeError", "prototype"],
    "%Uint8ArrayPrototype%": ["Uint8Array", "prototype"],
    "%Uint8ClampedArrayPrototype%": ["Uint8ClampedArray", "prototype"],
    "%Uint16ArrayPrototype%": ["Uint16Array", "prototype"],
    "%Uint32ArrayPrototype%": ["Uint32Array", "prototype"],
    "%URIErrorPrototype%": ["URIError", "prototype"],
    "%WeakMapPrototype%": ["WeakMap", "prototype"],
    "%WeakSetPrototype%": ["WeakSet", "prototype"]
  };
  var bind = dew$9();
  var hasOwn = dew$8();
  var $concat = bind.call(Function.call, Array.prototype.concat);
  var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
  var $replace = bind.call(Function.call, String.prototype.replace);
  var $strSlice = bind.call(Function.call, String.prototype.slice);
  var $exec = bind.call(Function.call, RegExp.prototype.exec);
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
  var reEscapeChar = /\\(\\)?/g;
  var stringToPath = function stringToPath2(string2) {
    var first = $strSlice(string2, 0, 1);
    var last = $strSlice(string2, -1);
    if (first === "%" && last !== "%") {
      throw new $SyntaxError("invalid intrinsic syntax, expected closing `%`");
    } else if (last === "%" && first !== "%") {
      throw new $SyntaxError("invalid intrinsic syntax, expected opening `%`");
    }
    var result = [];
    $replace(string2, rePropName, function(match, number, quote, subString) {
      result[result.length] = quote ? $replace(subString, reEscapeChar, "$1") : number || match;
    });
    return result;
  };
  var getBaseIntrinsic = function getBaseIntrinsic2(name, allowMissing) {
    var intrinsicName = name;
    var alias;
    if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
      alias = LEGACY_ALIASES[intrinsicName];
      intrinsicName = "%" + alias[0] + "%";
    }
    if (hasOwn(INTRINSICS, intrinsicName)) {
      var value = INTRINSICS[intrinsicName];
      if (value === needsEval) {
        value = doEval(intrinsicName);
      }
      if (typeof value === "undefined" && !allowMissing) {
        throw new $TypeError("intrinsic " + name + " exists, but is not available. Please file an issue!");
      }
      return {
        alias,
        name: intrinsicName,
        value
      };
    }
    throw new $SyntaxError("intrinsic " + name + " does not exist!");
  };
  exports$7 = function GetIntrinsic(name, allowMissing) {
    if (typeof name !== "string" || name.length === 0) {
      throw new $TypeError("intrinsic name must be a non-empty string");
    }
    if (arguments.length > 1 && typeof allowMissing !== "boolean") {
      throw new $TypeError('"allowMissing" argument must be a boolean');
    }
    if ($exec(/^%?[^%]*%?$/, name) === null) {
      throw new $SyntaxError("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
    }
    var parts = stringToPath(name);
    var intrinsicBaseName = parts.length > 0 ? parts[0] : "";
    var intrinsic = getBaseIntrinsic("%" + intrinsicBaseName + "%", allowMissing);
    var intrinsicRealName = intrinsic.name;
    var value = intrinsic.value;
    var skipFurtherCaching = false;
    var alias = intrinsic.alias;
    if (alias) {
      intrinsicBaseName = alias[0];
      $spliceApply(parts, $concat([0, 1], alias));
    }
    for (var i = 1, isOwn = true; i < parts.length; i += 1) {
      var part = parts[i];
      var first = $strSlice(part, 0, 1);
      var last = $strSlice(part, -1);
      if ((first === '"' || first === "'" || first === "`" || last === '"' || last === "'" || last === "`") && first !== last) {
        throw new $SyntaxError("property names with quotes must have matching quotes");
      }
      if (part === "constructor" || !isOwn) {
        skipFurtherCaching = true;
      }
      intrinsicBaseName += "." + part;
      intrinsicRealName = "%" + intrinsicBaseName + "%";
      if (hasOwn(INTRINSICS, intrinsicRealName)) {
        value = INTRINSICS[intrinsicRealName];
      } else if (value != null) {
        if (!(part in value)) {
          if (!allowMissing) {
            throw new $TypeError("base intrinsic for " + name + " exists, but the property is not available.");
          }
          return void undefined$1;
        }
        if ($gOPD && i + 1 >= parts.length) {
          var desc = $gOPD(value, part);
          isOwn = !!desc;
          if (isOwn && "get" in desc && !("originalValue" in desc.get)) {
            value = desc.get;
          } else {
            value = value[part];
          }
        } else {
          isOwn = hasOwn(value, part);
          value = value[part];
        }
        if (isOwn && !skipFurtherCaching) {
          INTRINSICS[intrinsicRealName] = value;
        }
      }
    }
    return value;
  };
  return exports$7;
}
function dew$6() {
  if (_dewExec$6) return exports$6;
  _dewExec$6 = true;
  var GetIntrinsic = dew$7();
  var $defineProperty = GetIntrinsic("%Object.defineProperty%", true) || false;
  if ($defineProperty) {
    try {
      $defineProperty({}, "a", {
        value: 1
      });
    } catch (e) {
      $defineProperty = false;
    }
  }
  exports$6 = $defineProperty;
  return exports$6;
}
function dew$5() {
  if (_dewExec$5) return exports$5;
  _dewExec$5 = true;
  var GetIntrinsic = dew$7();
  var $gOPD = GetIntrinsic("%Object.getOwnPropertyDescriptor%", true);
  if ($gOPD) {
    try {
      $gOPD([], "length");
    } catch (e) {
      $gOPD = null;
    }
  }
  exports$5 = $gOPD;
  return exports$5;
}
function dew$4() {
  if (_dewExec$4) return exports$4;
  _dewExec$4 = true;
  var $defineProperty = dew$6();
  var $SyntaxError = dew$f();
  var $TypeError = dew$e();
  var gopd = dew$5();
  exports$4 = function defineDataProperty(obj, property, value) {
    if (!obj || typeof obj !== "object" && typeof obj !== "function") {
      throw new $TypeError("`obj` must be an object or a function`");
    }
    if (typeof property !== "string" && typeof property !== "symbol") {
      throw new $TypeError("`property` must be a string or a symbol`");
    }
    if (arguments.length > 3 && typeof arguments[3] !== "boolean" && arguments[3] !== null) {
      throw new $TypeError("`nonEnumerable`, if provided, must be a boolean or null");
    }
    if (arguments.length > 4 && typeof arguments[4] !== "boolean" && arguments[4] !== null) {
      throw new $TypeError("`nonWritable`, if provided, must be a boolean or null");
    }
    if (arguments.length > 5 && typeof arguments[5] !== "boolean" && arguments[5] !== null) {
      throw new $TypeError("`nonConfigurable`, if provided, must be a boolean or null");
    }
    if (arguments.length > 6 && typeof arguments[6] !== "boolean") {
      throw new $TypeError("`loose`, if provided, must be a boolean");
    }
    var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
    var nonWritable = arguments.length > 4 ? arguments[4] : null;
    var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
    var loose = arguments.length > 6 ? arguments[6] : false;
    var desc = !!gopd && gopd(obj, property);
    if ($defineProperty) {
      $defineProperty(obj, property, {
        configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
        enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
        value,
        writable: nonWritable === null && desc ? desc.writable : !nonWritable
      });
    } else if (loose || !nonEnumerable && !nonWritable && !nonConfigurable) {
      obj[property] = value;
    } else {
      throw new $SyntaxError("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
    }
  };
  return exports$4;
}
function dew$3() {
  if (_dewExec$3) return exports$3;
  _dewExec$3 = true;
  var $defineProperty = dew$6();
  var hasPropertyDescriptors = function hasPropertyDescriptors2() {
    return !!$defineProperty;
  };
  hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
    if (!$defineProperty) {
      return null;
    }
    try {
      return $defineProperty([], "length", {
        value: 1
      }).length !== 1;
    } catch (e) {
      return true;
    }
  };
  exports$3 = hasPropertyDescriptors;
  return exports$3;
}
function dew$2() {
  if (_dewExec$2) return exports$2;
  _dewExec$2 = true;
  var GetIntrinsic = dew$7();
  var define = dew$4();
  var hasDescriptors = dew$3()();
  var gOPD = dew$5();
  var $TypeError = dew$e();
  var $floor = GetIntrinsic("%Math.floor%");
  exports$2 = function setFunctionLength(fn, length) {
    if (typeof fn !== "function") {
      throw new $TypeError("`fn` is not a function");
    }
    if (typeof length !== "number" || length < 0 || length > 4294967295 || $floor(length) !== length) {
      throw new $TypeError("`length` must be a positive 32-bit integer");
    }
    var loose = arguments.length > 2 && !!arguments[2];
    var functionLengthIsConfigurable = true;
    var functionLengthIsWritable = true;
    if ("length" in fn && gOPD) {
      var desc = gOPD(fn, "length");
      if (desc && !desc.configurable) {
        functionLengthIsConfigurable = false;
      }
      if (desc && !desc.writable) {
        functionLengthIsWritable = false;
      }
    }
    if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
      if (hasDescriptors) {
        define(
          /** @type {Parameters<define>[0]} */
          fn,
          "length",
          length,
          true,
          true
        );
      } else {
        define(
          /** @type {Parameters<define>[0]} */
          fn,
          "length",
          length
        );
      }
    }
    return fn;
  };
  return exports$2;
}
function dew$1() {
  if (_dewExec$1) return exports$1;
  _dewExec$1 = true;
  var bind = dew$9();
  var GetIntrinsic = dew$7();
  var setFunctionLength = dew$2();
  var $TypeError = dew$e();
  var $apply = GetIntrinsic("%Function.prototype.apply%");
  var $call = GetIntrinsic("%Function.prototype.call%");
  var $reflectApply = GetIntrinsic("%Reflect.apply%", true) || bind.call($call, $apply);
  var $defineProperty = dew$6();
  var $max = GetIntrinsic("%Math.max%");
  exports$1 = function callBind(originalFunction) {
    if (typeof originalFunction !== "function") {
      throw new $TypeError("a function is required");
    }
    var func = $reflectApply(bind, $call, arguments);
    return setFunctionLength(func, 1 + $max(0, originalFunction.length - (arguments.length - 1)), true);
  };
  var applyBind = function applyBind2() {
    return $reflectApply(bind, $apply, arguments);
  };
  if ($defineProperty) {
    $defineProperty(exports$1, "apply", {
      value: applyBind
    });
  } else {
    exports$1.apply = applyBind;
  }
  return exports$1;
}
function dew() {
  if (_dewExec) return exports;
  _dewExec = true;
  var GetIntrinsic = dew$7();
  var callBind = dew$1();
  var $indexOf = callBind(GetIntrinsic("String.prototype.indexOf"));
  exports = function callBoundIntrinsic(name, allowMissing) {
    var intrinsic = GetIntrinsic(name, !!allowMissing);
    if (typeof intrinsic === "function" && $indexOf(name, ".prototype.") > -1) {
      return callBind(intrinsic);
    }
    return intrinsic;
  };
  return exports;
}
function dew2() {
  if (_dewExec2) return exports2;
  _dewExec2 = true;
  if (typeof Object.create === "function") {
    exports2 = function inherits2(ctor, superCtor) {
      if (superCtor) {
        ctor.super_ = superCtor;
        ctor.prototype = Object.create(superCtor.prototype, {
          constructor: {
            value: ctor,
            enumerable: false,
            writable: true,
            configurable: true
          }
        });
      }
    };
  } else {
    exports2 = function inherits2(ctor, superCtor) {
      if (superCtor) {
        ctor.super_ = superCtor;
        var TempCtor = function() {
        };
        TempCtor.prototype = superCtor.prototype;
        ctor.prototype = new TempCtor();
        ctor.prototype.constructor = ctor;
      }
    };
  }
  return exports2;
}
function unimplemented(name) {
  throw new Error("Node.js process " + name + " is not supported by JSPM core outside of Node.js");
}
function cleanUpNextTick() {
  if (!draining || !currentQueue)
    return;
  draining = false;
  if (currentQueue.length) {
    queue = currentQueue.concat(queue);
  } else {
    queueIndex = -1;
  }
  if (queue.length)
    drainQueue();
}
function drainQueue() {
  if (draining)
    return;
  var timeout = setTimeout(cleanUpNextTick, 0);
  draining = true;
  var len = queue.length;
  while (len) {
    currentQueue = queue;
    queue = [];
    while (++queueIndex < len) {
      if (currentQueue)
        currentQueue[queueIndex].run();
    }
    queueIndex = -1;
    len = queue.length;
  }
  currentQueue = null;
  draining = false;
  clearTimeout(timeout);
}
function nextTick(fun) {
  var args = new Array(arguments.length - 1);
  if (arguments.length > 1) {
    for (var i = 1; i < arguments.length; i++)
      args[i - 1] = arguments[i];
  }
  queue.push(new Item(fun, args));
  if (queue.length === 1 && !draining)
    setTimeout(drainQueue, 0);
}
function Item(fun, array) {
  this.fun = fun;
  this.array = array;
}
function noop() {
}
function _linkedBinding(name) {
  unimplemented("_linkedBinding");
}
function dlopen(name) {
  unimplemented("dlopen");
}
function _getActiveRequests() {
  return [];
}
function _getActiveHandles() {
  return [];
}
function assert(condition, message) {
  if (!condition) throw new Error(message || "assertion error");
}
function hasUncaughtExceptionCaptureCallback() {
  return false;
}
function uptime() {
  return _performance.now() / 1e3;
}
function hrtime(previousTimestamp) {
  var baseNow = Math.floor((Date.now() - _performance.now()) * 1e-3);
  var clocktime = _performance.now() * 1e-3;
  var seconds = Math.floor(clocktime) + baseNow;
  var nanoseconds = Math.floor(clocktime % 1 * 1e9);
  if (previousTimestamp) {
    seconds = seconds - previousTimestamp[0];
    nanoseconds = nanoseconds - previousTimestamp[1];
    if (nanoseconds < 0) {
      seconds--;
      nanoseconds += nanoPerSec;
    }
  }
  return [seconds, nanoseconds];
}
function on() {
  return process2;
}
function listeners(name) {
  return [];
}
function dew$b2() {
  if (_dewExec$b2) return exports$c2;
  _dewExec$b2 = true;
  var hasSymbols = dew$k();
  exports$c2 = function hasToStringTagShams() {
    return hasSymbols() && !!Symbol.toStringTag;
  };
  return exports$c2;
}
function dew$a2() {
  if (_dewExec$a2) return exports$b2;
  _dewExec$a2 = true;
  var hasToStringTag = dew$b2()();
  var callBound = dew();
  var $toString = callBound("Object.prototype.toString");
  var isStandardArguments = function isArguments(value) {
    if (hasToStringTag && value && typeof value === "object" && Symbol.toStringTag in value) {
      return false;
    }
    return $toString(value) === "[object Arguments]";
  };
  var isLegacyArguments = function isArguments(value) {
    if (isStandardArguments(value)) {
      return true;
    }
    return value !== null && typeof value === "object" && typeof value.length === "number" && value.length >= 0 && $toString(value) !== "[object Array]" && $toString(value.callee) === "[object Function]";
  };
  var supportsStandardArguments = (function() {
    return isStandardArguments(arguments);
  })();
  isStandardArguments.isLegacyArguments = isLegacyArguments;
  exports$b2 = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
  return exports$b2;
}
function dew$92() {
  if (_dewExec$92) return exports$a2;
  _dewExec$92 = true;
  var toStr = Object.prototype.toString;
  var fnToStr = Function.prototype.toString;
  var isFnRegex = /^\s*(?:function)?\*/;
  var hasToStringTag = dew$b2()();
  var getProto = Object.getPrototypeOf;
  var getGeneratorFunc = function() {
    if (!hasToStringTag) {
      return false;
    }
    try {
      return Function("return function*() {}")();
    } catch (e) {
    }
  };
  var GeneratorFunction;
  exports$a2 = function isGeneratorFunction(fn) {
    if (typeof fn !== "function") {
      return false;
    }
    if (isFnRegex.test(fnToStr.call(fn))) {
      return true;
    }
    if (!hasToStringTag) {
      var str = toStr.call(fn);
      return str === "[object GeneratorFunction]";
    }
    if (!getProto) {
      return false;
    }
    if (typeof GeneratorFunction === "undefined") {
      var generatorFunc = getGeneratorFunc();
      GeneratorFunction = generatorFunc ? getProto(generatorFunc) : false;
    }
    return getProto(fn) === GeneratorFunction;
  };
  return exports$a2;
}
function dew$82() {
  if (_dewExec$82) return exports$92;
  _dewExec$82 = true;
  var fnToStr = Function.prototype.toString;
  var reflectApply = typeof Reflect === "object" && Reflect !== null && Reflect.apply;
  var badArrayLike;
  var isCallableMarker;
  if (typeof reflectApply === "function" && typeof Object.defineProperty === "function") {
    try {
      badArrayLike = Object.defineProperty({}, "length", {
        get: function() {
          throw isCallableMarker;
        }
      });
      isCallableMarker = {};
      reflectApply(function() {
        throw 42;
      }, null, badArrayLike);
    } catch (_) {
      if (_ !== isCallableMarker) {
        reflectApply = null;
      }
    }
  } else {
    reflectApply = null;
  }
  var constructorRegex = /^\s*class\b/;
  var isES6ClassFn = function isES6ClassFunction(value) {
    try {
      var fnStr = fnToStr.call(value);
      return constructorRegex.test(fnStr);
    } catch (e) {
      return false;
    }
  };
  var tryFunctionObject = function tryFunctionToStr(value) {
    try {
      if (isES6ClassFn(value)) {
        return false;
      }
      fnToStr.call(value);
      return true;
    } catch (e) {
      return false;
    }
  };
  var toStr = Object.prototype.toString;
  var objectClass = "[object Object]";
  var fnClass = "[object Function]";
  var genClass = "[object GeneratorFunction]";
  var ddaClass = "[object HTMLAllCollection]";
  var ddaClass2 = "[object HTML document.all class]";
  var ddaClass3 = "[object HTMLCollection]";
  var hasToStringTag = typeof Symbol === "function" && !!Symbol.toStringTag;
  var isIE68 = !(0 in [,]);
  var isDDA = function isDocumentDotAll() {
    return false;
  };
  if (typeof document === "object") {
    var all = document.all;
    if (toStr.call(all) === toStr.call(document.all)) {
      isDDA = function isDocumentDotAll(value) {
        if ((isIE68 || !value) && (typeof value === "undefined" || typeof value === "object")) {
          try {
            var str = toStr.call(value);
            return (str === ddaClass || str === ddaClass2 || str === ddaClass3 || str === objectClass) && value("") == null;
          } catch (e) {
          }
        }
        return false;
      };
    }
  }
  exports$92 = reflectApply ? function isCallable(value) {
    if (isDDA(value)) {
      return true;
    }
    if (!value) {
      return false;
    }
    if (typeof value !== "function" && typeof value !== "object") {
      return false;
    }
    try {
      reflectApply(value, null, badArrayLike);
    } catch (e) {
      if (e !== isCallableMarker) {
        return false;
      }
    }
    return !isES6ClassFn(value) && tryFunctionObject(value);
  } : function isCallable(value) {
    if (isDDA(value)) {
      return true;
    }
    if (!value) {
      return false;
    }
    if (typeof value !== "function" && typeof value !== "object") {
      return false;
    }
    if (hasToStringTag) {
      return tryFunctionObject(value);
    }
    if (isES6ClassFn(value)) {
      return false;
    }
    var strClass = toStr.call(value);
    if (strClass !== fnClass && strClass !== genClass && !/^\[object HTML/.test(strClass)) {
      return false;
    }
    return tryFunctionObject(value);
  };
  return exports$92;
}
function dew$72() {
  if (_dewExec$72) return exports$82;
  _dewExec$72 = true;
  var isCallable = dew$82();
  var toStr = Object.prototype.toString;
  var hasOwnProperty = Object.prototype.hasOwnProperty;
  var forEachArray = function forEachArray2(array, iterator, receiver) {
    for (var i = 0, len = array.length; i < len; i++) {
      if (hasOwnProperty.call(array, i)) {
        if (receiver == null) {
          iterator(array[i], i, array);
        } else {
          iterator.call(receiver, array[i], i, array);
        }
      }
    }
  };
  var forEachString = function forEachString2(string2, iterator, receiver) {
    for (var i = 0, len = string2.length; i < len; i++) {
      if (receiver == null) {
        iterator(string2.charAt(i), i, string2);
      } else {
        iterator.call(receiver, string2.charAt(i), i, string2);
      }
    }
  };
  var forEachObject = function forEachObject2(object, iterator, receiver) {
    for (var k in object) {
      if (hasOwnProperty.call(object, k)) {
        if (receiver == null) {
          iterator(object[k], k, object);
        } else {
          iterator.call(receiver, object[k], k, object);
        }
      }
    }
  };
  var forEach = function forEach2(list, iterator, thisArg) {
    if (!isCallable(iterator)) {
      throw new TypeError("iterator must be a function");
    }
    var receiver;
    if (arguments.length >= 3) {
      receiver = thisArg;
    }
    if (toStr.call(list) === "[object Array]") {
      forEachArray(list, iterator, receiver);
    } else if (typeof list === "string") {
      forEachString(list, iterator, receiver);
    } else {
      forEachObject(list, iterator, receiver);
    }
  };
  exports$82 = forEach;
  return exports$82;
}
function dew$62() {
  if (_dewExec$62) return exports$72;
  _dewExec$62 = true;
  exports$72 = ["Float32Array", "Float64Array", "Int8Array", "Int16Array", "Int32Array", "Uint8Array", "Uint8ClampedArray", "Uint16Array", "Uint32Array", "BigInt64Array", "BigUint64Array"];
  return exports$72;
}
function dew$52() {
  if (_dewExec$52) return exports$62;
  _dewExec$52 = true;
  var possibleNames = dew$62();
  var g = typeof globalThis === "undefined" ? _global$2 : globalThis;
  exports$62 = function availableTypedArrays() {
    var out = [];
    for (var i = 0; i < possibleNames.length; i++) {
      if (typeof g[possibleNames[i]] === "function") {
        out[out.length] = possibleNames[i];
      }
    }
    return out;
  };
  return exports$62;
}
function dew$42() {
  if (_dewExec$42) return exports$52;
  _dewExec$42 = true;
  var forEach = dew$72();
  var availableTypedArrays = dew$52();
  var callBind = dew$1();
  var callBound = dew();
  var gOPD = dew$5();
  var $toString = callBound("Object.prototype.toString");
  var hasToStringTag = dew$b2()();
  var g = typeof globalThis === "undefined" ? _global$1 : globalThis;
  var typedArrays = availableTypedArrays();
  var $slice = callBound("String.prototype.slice");
  var getPrototypeOf = Object.getPrototypeOf;
  var $indexOf = callBound("Array.prototype.indexOf", true) || function indexOf(array, value) {
    for (var i = 0; i < array.length; i += 1) {
      if (array[i] === value) {
        return i;
      }
    }
    return -1;
  };
  var cache = {
    __proto__: null
  };
  if (hasToStringTag && gOPD && getPrototypeOf) {
    forEach(typedArrays, function(typedArray) {
      var arr = new g[typedArray]();
      if (Symbol.toStringTag in arr) {
        var proto = getPrototypeOf(arr);
        var descriptor = gOPD(proto, Symbol.toStringTag);
        if (!descriptor) {
          var superProto = getPrototypeOf(proto);
          descriptor = gOPD(superProto, Symbol.toStringTag);
        }
        cache["$" + typedArray] = callBind(descriptor.get);
      }
    });
  } else {
    forEach(typedArrays, function(typedArray) {
      var arr = new g[typedArray]();
      var fn = arr.slice || arr.set;
      if (fn) {
        cache["$" + typedArray] = callBind(fn);
      }
    });
  }
  var tryTypedArrays = function tryAllTypedArrays(value) {
    var found = false;
    forEach(
      // eslint-disable-next-line no-extra-parens
      /** @type {Record<`\$${TypedArrayName}`, Getter>} */
      /** @type {any} */
      cache,
      /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
      function(getter, typedArray) {
        if (!found) {
          try {
            if ("$" + getter(value) === typedArray) {
              found = $slice(typedArray, 1);
            }
          } catch (e) {
          }
        }
      }
    );
    return found;
  };
  var trySlices = function tryAllSlices(value) {
    var found = false;
    forEach(
      // eslint-disable-next-line no-extra-parens
      /** @type {Record<`\$${TypedArrayName}`, Getter>} */
      /** @type {any} */
      cache,
      /** @type {(getter: typeof cache, name: `\$${import('.').TypedArrayName}`) => void} */
      function(getter, name) {
        if (!found) {
          try {
            getter(value);
            found = $slice(name, 1);
          } catch (e) {
          }
        }
      }
    );
    return found;
  };
  exports$52 = function whichTypedArray(value) {
    if (!value || typeof value !== "object") {
      return false;
    }
    if (!hasToStringTag) {
      var tag = $slice($toString(value), 8, -1);
      if ($indexOf(typedArrays, tag) > -1) {
        return tag;
      }
      if (tag !== "Object") {
        return false;
      }
      return trySlices(value);
    }
    if (!gOPD) {
      return null;
    }
    return tryTypedArrays(value);
  };
  return exports$52;
}
function dew$32() {
  if (_dewExec$32) return exports$42;
  _dewExec$32 = true;
  var whichTypedArray = dew$42();
  exports$42 = function isTypedArray(value) {
    return !!whichTypedArray(value);
  };
  return exports$42;
}
function dew$22() {
  if (_dewExec$22) return exports$32;
  _dewExec$22 = true;
  var isArgumentsObject = dew$a2();
  var isGeneratorFunction = dew$92();
  var whichTypedArray = dew$42();
  var isTypedArray = dew$32();
  function uncurryThis(f) {
    return f.call.bind(f);
  }
  var BigIntSupported = typeof BigInt !== "undefined";
  var SymbolSupported = typeof Symbol !== "undefined";
  var ObjectToString = uncurryThis(Object.prototype.toString);
  var numberValue = uncurryThis(Number.prototype.valueOf);
  var stringValue = uncurryThis(String.prototype.valueOf);
  var booleanValue = uncurryThis(Boolean.prototype.valueOf);
  if (BigIntSupported) {
    var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
  }
  if (SymbolSupported) {
    var symbolValue = uncurryThis(Symbol.prototype.valueOf);
  }
  function checkBoxedPrimitive(value, prototypeValueOf) {
    if (typeof value !== "object") {
      return false;
    }
    try {
      prototypeValueOf(value);
      return true;
    } catch (e) {
      return false;
    }
  }
  exports$32.isArgumentsObject = isArgumentsObject;
  exports$32.isGeneratorFunction = isGeneratorFunction;
  exports$32.isTypedArray = isTypedArray;
  function isPromise(input) {
    return typeof Promise !== "undefined" && input instanceof Promise || input !== null && typeof input === "object" && typeof input.then === "function" && typeof input.catch === "function";
  }
  exports$32.isPromise = isPromise;
  function isArrayBufferView(value) {
    if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
      return ArrayBuffer.isView(value);
    }
    return isTypedArray(value) || isDataView(value);
  }
  exports$32.isArrayBufferView = isArrayBufferView;
  function isUint8Array(value) {
    return whichTypedArray(value) === "Uint8Array";
  }
  exports$32.isUint8Array = isUint8Array;
  function isUint8ClampedArray(value) {
    return whichTypedArray(value) === "Uint8ClampedArray";
  }
  exports$32.isUint8ClampedArray = isUint8ClampedArray;
  function isUint16Array(value) {
    return whichTypedArray(value) === "Uint16Array";
  }
  exports$32.isUint16Array = isUint16Array;
  function isUint32Array(value) {
    return whichTypedArray(value) === "Uint32Array";
  }
  exports$32.isUint32Array = isUint32Array;
  function isInt8Array(value) {
    return whichTypedArray(value) === "Int8Array";
  }
  exports$32.isInt8Array = isInt8Array;
  function isInt16Array(value) {
    return whichTypedArray(value) === "Int16Array";
  }
  exports$32.isInt16Array = isInt16Array;
  function isInt32Array(value) {
    return whichTypedArray(value) === "Int32Array";
  }
  exports$32.isInt32Array = isInt32Array;
  function isFloat32Array(value) {
    return whichTypedArray(value) === "Float32Array";
  }
  exports$32.isFloat32Array = isFloat32Array;
  function isFloat64Array(value) {
    return whichTypedArray(value) === "Float64Array";
  }
  exports$32.isFloat64Array = isFloat64Array;
  function isBigInt64Array(value) {
    return whichTypedArray(value) === "BigInt64Array";
  }
  exports$32.isBigInt64Array = isBigInt64Array;
  function isBigUint64Array(value) {
    return whichTypedArray(value) === "BigUint64Array";
  }
  exports$32.isBigUint64Array = isBigUint64Array;
  function isMapToString(value) {
    return ObjectToString(value) === "[object Map]";
  }
  isMapToString.working = typeof Map !== "undefined" && isMapToString(/* @__PURE__ */ new Map());
  function isMap2(value) {
    if (typeof Map === "undefined") {
      return false;
    }
    return isMapToString.working ? isMapToString(value) : value instanceof Map;
  }
  exports$32.isMap = isMap2;
  function isSetToString(value) {
    return ObjectToString(value) === "[object Set]";
  }
  isSetToString.working = typeof Set !== "undefined" && isSetToString(/* @__PURE__ */ new Set());
  function isSet(value) {
    if (typeof Set === "undefined") {
      return false;
    }
    return isSetToString.working ? isSetToString(value) : value instanceof Set;
  }
  exports$32.isSet = isSet;
  function isWeakMapToString(value) {
    return ObjectToString(value) === "[object WeakMap]";
  }
  isWeakMapToString.working = typeof WeakMap !== "undefined" && isWeakMapToString(/* @__PURE__ */ new WeakMap());
  function isWeakMap(value) {
    if (typeof WeakMap === "undefined") {
      return false;
    }
    return isWeakMapToString.working ? isWeakMapToString(value) : value instanceof WeakMap;
  }
  exports$32.isWeakMap = isWeakMap;
  function isWeakSetToString(value) {
    return ObjectToString(value) === "[object WeakSet]";
  }
  isWeakSetToString.working = typeof WeakSet !== "undefined" && isWeakSetToString(/* @__PURE__ */ new WeakSet());
  function isWeakSet(value) {
    return isWeakSetToString(value);
  }
  exports$32.isWeakSet = isWeakSet;
  function isArrayBufferToString(value) {
    return ObjectToString(value) === "[object ArrayBuffer]";
  }
  isArrayBufferToString.working = typeof ArrayBuffer !== "undefined" && isArrayBufferToString(new ArrayBuffer());
  function isArrayBuffer(value) {
    if (typeof ArrayBuffer === "undefined") {
      return false;
    }
    return isArrayBufferToString.working ? isArrayBufferToString(value) : value instanceof ArrayBuffer;
  }
  exports$32.isArrayBuffer = isArrayBuffer;
  function isDataViewToString(value) {
    return ObjectToString(value) === "[object DataView]";
  }
  isDataViewToString.working = typeof ArrayBuffer !== "undefined" && typeof DataView !== "undefined" && isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1));
  function isDataView(value) {
    if (typeof DataView === "undefined") {
      return false;
    }
    return isDataViewToString.working ? isDataViewToString(value) : value instanceof DataView;
  }
  exports$32.isDataView = isDataView;
  var SharedArrayBufferCopy = typeof SharedArrayBuffer !== "undefined" ? SharedArrayBuffer : void 0;
  function isSharedArrayBufferToString(value) {
    return ObjectToString(value) === "[object SharedArrayBuffer]";
  }
  function isSharedArrayBuffer(value) {
    if (typeof SharedArrayBufferCopy === "undefined") {
      return false;
    }
    if (typeof isSharedArrayBufferToString.working === "undefined") {
      isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
    }
    return isSharedArrayBufferToString.working ? isSharedArrayBufferToString(value) : value instanceof SharedArrayBufferCopy;
  }
  exports$32.isSharedArrayBuffer = isSharedArrayBuffer;
  function isAsyncFunction(value) {
    return ObjectToString(value) === "[object AsyncFunction]";
  }
  exports$32.isAsyncFunction = isAsyncFunction;
  function isMapIterator(value) {
    return ObjectToString(value) === "[object Map Iterator]";
  }
  exports$32.isMapIterator = isMapIterator;
  function isSetIterator(value) {
    return ObjectToString(value) === "[object Set Iterator]";
  }
  exports$32.isSetIterator = isSetIterator;
  function isGeneratorObject(value) {
    return ObjectToString(value) === "[object Generator]";
  }
  exports$32.isGeneratorObject = isGeneratorObject;
  function isWebAssemblyCompiledModule(value) {
    return ObjectToString(value) === "[object WebAssembly.Module]";
  }
  exports$32.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
  function isNumberObject(value) {
    return checkBoxedPrimitive(value, numberValue);
  }
  exports$32.isNumberObject = isNumberObject;
  function isStringObject(value) {
    return checkBoxedPrimitive(value, stringValue);
  }
  exports$32.isStringObject = isStringObject;
  function isBooleanObject(value) {
    return checkBoxedPrimitive(value, booleanValue);
  }
  exports$32.isBooleanObject = isBooleanObject;
  function isBigIntObject(value) {
    return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
  }
  exports$32.isBigIntObject = isBigIntObject;
  function isSymbolObject(value) {
    return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
  }
  exports$32.isSymbolObject = isSymbolObject;
  function isBoxedPrimitive(value) {
    return isNumberObject(value) || isStringObject(value) || isBooleanObject(value) || isBigIntObject(value) || isSymbolObject(value);
  }
  exports$32.isBoxedPrimitive = isBoxedPrimitive;
  function isAnyArrayBuffer(value) {
    return typeof Uint8Array !== "undefined" && (isArrayBuffer(value) || isSharedArrayBuffer(value));
  }
  exports$32.isAnyArrayBuffer = isAnyArrayBuffer;
  ["isProxy", "isExternal", "isModuleNamespaceObject"].forEach(function(method) {
    Object.defineProperty(exports$32, method, {
      enumerable: false,
      value: function() {
        throw new Error(method + " is not supported in userland");
      }
    });
  });
  return exports$32;
}
function dew$12() {
  if (_dewExec$12) return exports$22;
  _dewExec$12 = true;
  exports$22 = function isBuffer2(arg) {
    return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function";
  };
  return exports$22;
}
function dew3() {
  if (_dewExec3) return exports$12;
  _dewExec3 = true;
  var process$1 = process2;
  var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) {
    var keys = Object.keys(obj);
    var descriptors = {};
    for (var i = 0; i < keys.length; i++) {
      descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
    }
    return descriptors;
  };
  var formatRegExp = /%[sdj%]/g;
  exports$12.format = function(f) {
    if (!isString2(f)) {
      var objects = [];
      for (var i = 0; i < arguments.length; i++) {
        objects.push(inspect2(arguments[i]));
      }
      return objects.join(" ");
    }
    var i = 1;
    var args = arguments;
    var len = args.length;
    var str = String(f).replace(formatRegExp, function(x2) {
      if (x2 === "%%") return "%";
      if (i >= len) return x2;
      switch (x2) {
        case "%s":
          return String(args[i++]);
        case "%d":
          return Number(args[i++]);
        case "%j":
          try {
            return JSON.stringify(args[i++]);
          } catch (_) {
            return "[Circular]";
          }
        default:
          return x2;
      }
    });
    for (var x = args[i]; i < len; x = args[++i]) {
      if (isNull2(x) || !isObject2(x)) {
        str += " " + x;
      } else {
        str += " " + inspect2(x);
      }
    }
    return str;
  };
  exports$12.deprecate = function(fn, msg) {
    if (typeof process$1 !== "undefined" && process$1.noDeprecation === true) {
      return fn;
    }
    if (typeof process$1 === "undefined") {
      return function() {
        return exports$12.deprecate(fn, msg).apply(this || _global, arguments);
      };
    }
    var warned = false;
    function deprecated() {
      if (!warned) {
        if (process$1.throwDeprecation) {
          throw new Error(msg);
        } else if (process$1.traceDeprecation) {
          console.trace(msg);
        } else {
          console.error(msg);
        }
        warned = true;
      }
      return fn.apply(this || _global, arguments);
    }
    return deprecated;
  };
  var debugs = {};
  var debugEnvRegex = /^$/;
  if (process$1.env.NODE_DEBUG) {
    var debugEnv = process$1.env.NODE_DEBUG;
    debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/\*/g, ".*").replace(/,/g, "$|^").toUpperCase();
    debugEnvRegex = new RegExp("^" + debugEnv + "$", "i");
  }
  exports$12.debuglog = function(set2) {
    set2 = set2.toUpperCase();
    if (!debugs[set2]) {
      if (debugEnvRegex.test(set2)) {
        var pid22 = process$1.pid;
        debugs[set2] = function() {
          var msg = exports$12.format.apply(exports$12, arguments);
          console.error("%s %d: %s", set2, pid22, msg);
        };
      } else {
        debugs[set2] = function() {
        };
      }
    }
    return debugs[set2];
  };
  function inspect2(obj, opts) {
    var ctx = {
      seen: [],
      stylize: stylizeNoColor
    };
    if (arguments.length >= 3) ctx.depth = arguments[2];
    if (arguments.length >= 4) ctx.colors = arguments[3];
    if (isBoolean2(opts)) {
      ctx.showHidden = opts;
    } else if (opts) {
      exports$12._extend(ctx, opts);
    }
    if (isUndefined2(ctx.showHidden)) ctx.showHidden = false;
    if (isUndefined2(ctx.depth)) ctx.depth = 2;
    if (isUndefined2(ctx.colors)) ctx.colors = false;
    if (isUndefined2(ctx.customInspect)) ctx.customInspect = true;
    if (ctx.colors) ctx.stylize = stylizeWithColor;
    return formatValue(ctx, obj, ctx.depth);
  }
  exports$12.inspect = inspect2;
  inspect2.colors = {
    "bold": [1, 22],
    "italic": [3, 23],
    "underline": [4, 24],
    "inverse": [7, 27],
    "white": [37, 39],
    "grey": [90, 39],
    "black": [30, 39],
    "blue": [34, 39],
    "cyan": [36, 39],
    "green": [32, 39],
    "magenta": [35, 39],
    "red": [31, 39],
    "yellow": [33, 39]
  };
  inspect2.styles = {
    "special": "cyan",
    "number": "yellow",
    "boolean": "yellow",
    "undefined": "grey",
    "null": "bold",
    "string": "green",
    "date": "magenta",
    // "name": intentionally not styling
    "regexp": "red"
  };
  function stylizeWithColor(str, styleType) {
    var style = inspect2.styles[styleType];
    if (style) {
      return "\x1B[" + inspect2.colors[style][0] + "m" + str + "\x1B[" + inspect2.colors[style][1] + "m";
    } else {
      return str;
    }
  }
  function stylizeNoColor(str, styleType) {
    return str;
  }
  function arrayToHash(array) {
    var hash = {};
    array.forEach(function(val, idx) {
      hash[val] = true;
    });
    return hash;
  }
  function formatValue(ctx, value, recurseTimes) {
    if (ctx.customInspect && value && isFunction2(value.inspect) && // Filter out the util module, it's inspect function is special
    value.inspect !== exports$12.inspect && // Also filter out any prototype objects using the circular check.
    !(value.constructor && value.constructor.prototype === value)) {
      var ret = value.inspect(recurseTimes, ctx);
      if (!isString2(ret)) {
        ret = formatValue(ctx, ret, recurseTimes);
      }
      return ret;
    }
    var primitive = formatPrimitive(ctx, value);
    if (primitive) {
      return primitive;
    }
    var keys = Object.keys(value);
    var visibleKeys = arrayToHash(keys);
    if (ctx.showHidden) {
      keys = Object.getOwnPropertyNames(value);
    }
    if (isError2(value) && (keys.indexOf("message") >= 0 || keys.indexOf("description") >= 0)) {
      return formatError(value);
    }
    if (keys.length === 0) {
      if (isFunction2(value)) {
        var name = value.name ? ": " + value.name : "";
        return ctx.stylize("[Function" + name + "]", "special");
      }
      if (isRegExp2(value)) {
        return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
      }
      if (isDate2(value)) {
        return ctx.stylize(Date.prototype.toString.call(value), "date");
      }
      if (isError2(value)) {
        return formatError(value);
      }
    }
    var base = "", array = false, braces = ["{", "}"];
    if (isArray2(value)) {
      array = true;
      braces = ["[", "]"];
    }
    if (isFunction2(value)) {
      var n = value.name ? ": " + value.name : "";
      base = " [Function" + n + "]";
    }
    if (isRegExp2(value)) {
      base = " " + RegExp.prototype.toString.call(value);
    }
    if (isDate2(value)) {
      base = " " + Date.prototype.toUTCString.call(value);
    }
    if (isError2(value)) {
      base = " " + formatError(value);
    }
    if (keys.length === 0 && (!array || value.length == 0)) {
      return braces[0] + base + braces[1];
    }
    if (recurseTimes < 0) {
      if (isRegExp2(value)) {
        return ctx.stylize(RegExp.prototype.toString.call(value), "regexp");
      } else {
        return ctx.stylize("[Object]", "special");
      }
    }
    ctx.seen.push(value);
    var output;
    if (array) {
      output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
    } else {
      output = keys.map(function(key) {
        return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
      });
    }
    ctx.seen.pop();
    return reduceToSingleString(output, base, braces);
  }
  function formatPrimitive(ctx, value) {
    if (isUndefined2(value)) return ctx.stylize("undefined", "undefined");
    if (isString2(value)) {
      var simple = "'" + JSON.stringify(value).replace(/^"|"$/g, "").replace(/'/g, "\\'").replace(/\\"/g, '"') + "'";
      return ctx.stylize(simple, "string");
    }
    if (isNumber2(value)) return ctx.stylize("" + value, "number");
    if (isBoolean2(value)) return ctx.stylize("" + value, "boolean");
    if (isNull2(value)) return ctx.stylize("null", "null");
  }
  function formatError(value) {
    return "[" + Error.prototype.toString.call(value) + "]";
  }
  function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
    var output = [];
    for (var i = 0, l = value.length; i < l; ++i) {
      if (hasOwnProperty(value, String(i))) {
        output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
      } else {
        output.push("");
      }
    }
    keys.forEach(function(key) {
      if (!key.match(/^\d+$/)) {
        output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
      }
    });
    return output;
  }
  function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
    var name, str, desc;
    desc = Object.getOwnPropertyDescriptor(value, key) || {
      value: value[key]
    };
    if (desc.get) {
      if (desc.set) {
        str = ctx.stylize("[Getter/Setter]", "special");
      } else {
        str = ctx.stylize("[Getter]", "special");
      }
    } else {
      if (desc.set) {
        str = ctx.stylize("[Setter]", "special");
      }
    }
    if (!hasOwnProperty(visibleKeys, key)) {
      name = "[" + key + "]";
    }
    if (!str) {
      if (ctx.seen.indexOf(desc.value) < 0) {
        if (isNull2(recurseTimes)) {
          str = formatValue(ctx, desc.value, null);
        } else {
          str = formatValue(ctx, desc.value, recurseTimes - 1);
        }
        if (str.indexOf("\n") > -1) {
          if (array) {
            str = str.split("\n").map(function(line) {
              return "  " + line;
            }).join("\n").slice(2);
          } else {
            str = "\n" + str.split("\n").map(function(line) {
              return "   " + line;
            }).join("\n");
          }
        }
      } else {
        str = ctx.stylize("[Circular]", "special");
      }
    }
    if (isUndefined2(name)) {
      if (array && key.match(/^\d+$/)) {
        return str;
      }
      name = JSON.stringify("" + key);
      if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
        name = name.slice(1, -1);
        name = ctx.stylize(name, "name");
      } else {
        name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
        name = ctx.stylize(name, "string");
      }
    }
    return name + ": " + str;
  }
  function reduceToSingleString(output, base, braces) {
    var length = output.reduce(function(prev, cur) {
      if (cur.indexOf("\n") >= 0) ;
      return prev + cur.replace(/\u001b\[\d\d?m/g, "").length + 1;
    }, 0);
    if (length > 60) {
      return braces[0] + (base === "" ? "" : base + "\n ") + " " + output.join(",\n  ") + " " + braces[1];
    }
    return braces[0] + base + " " + output.join(", ") + " " + braces[1];
  }
  exports$12.types = dew$22();
  function isArray2(ar) {
    return Array.isArray(ar);
  }
  exports$12.isArray = isArray2;
  function isBoolean2(arg) {
    return typeof arg === "boolean";
  }
  exports$12.isBoolean = isBoolean2;
  function isNull2(arg) {
    return arg === null;
  }
  exports$12.isNull = isNull2;
  function isNullOrUndefined2(arg) {
    return arg == null;
  }
  exports$12.isNullOrUndefined = isNullOrUndefined2;
  function isNumber2(arg) {
    return typeof arg === "number";
  }
  exports$12.isNumber = isNumber2;
  function isString2(arg) {
    return typeof arg === "string";
  }
  exports$12.isString = isString2;
  function isSymbol2(arg) {
    return typeof arg === "symbol";
  }
  exports$12.isSymbol = isSymbol2;
  function isUndefined2(arg) {
    return arg === void 0;
  }
  exports$12.isUndefined = isUndefined2;
  function isRegExp2(re) {
    return isObject2(re) && objectToString(re) === "[object RegExp]";
  }
  exports$12.isRegExp = isRegExp2;
  exports$12.types.isRegExp = isRegExp2;
  function isObject2(arg) {
    return typeof arg === "object" && arg !== null;
  }
  exports$12.isObject = isObject2;
  function isDate2(d) {
    return isObject2(d) && objectToString(d) === "[object Date]";
  }
  exports$12.isDate = isDate2;
  exports$12.types.isDate = isDate2;
  function isError2(e) {
    return isObject2(e) && (objectToString(e) === "[object Error]" || e instanceof Error);
  }
  exports$12.isError = isError2;
  exports$12.types.isNativeError = isError2;
  function isFunction2(arg) {
    return typeof arg === "function";
  }
  exports$12.isFunction = isFunction2;
  function isPrimitive2(arg) {
    return arg === null || typeof arg === "boolean" || typeof arg === "number" || typeof arg === "string" || typeof arg === "symbol" || // ES6 symbol
    typeof arg === "undefined";
  }
  exports$12.isPrimitive = isPrimitive2;
  exports$12.isBuffer = dew$12();
  function objectToString(o) {
    return Object.prototype.toString.call(o);
  }
  function pad(n) {
    return n < 10 ? "0" + n.toString(10) : n.toString(10);
  }
  var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  function timestamp2() {
    var d = /* @__PURE__ */ new Date();
    var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(":");
    return [d.getDate(), months[d.getMonth()], time].join(" ");
  }
  exports$12.log = function() {
    console.log("%s - %s", timestamp2(), exports$12.format.apply(exports$12, arguments));
  };
  exports$12.inherits = dew2();
  exports$12._extend = function(origin, add) {
    if (!add || !isObject2(add)) return origin;
    var keys = Object.keys(add);
    var i = keys.length;
    while (i--) {
      origin[keys[i]] = add[keys[i]];
    }
    return origin;
  };
  function hasOwnProperty(obj, prop) {
    return Object.prototype.hasOwnProperty.call(obj, prop);
  }
  var kCustomPromisifiedSymbol = typeof Symbol !== "undefined" ? Symbol("util.promisify.custom") : void 0;
  exports$12.promisify = function promisify2(original) {
    if (typeof original !== "function") throw new TypeError('The "original" argument must be of type Function');
    if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
      fn = original[kCustomPromisifiedSymbol];
      if (typeof fn !== "function") {
        throw new TypeError('The "util.promisify.custom" argument must be of type Function');
      }
      Object.defineProperty(fn, kCustomPromisifiedSymbol, {
        value: fn,
        enumerable: false,
        writable: false,
        configurable: true
      });
      return fn;
    }
    function fn() {
      var promiseResolve, promiseReject;
      var promise = new Promise(function(resolve2, reject) {
        promiseResolve = resolve2;
        promiseReject = reject;
      });
      var args = [];
      for (var i = 0; i < arguments.length; i++) {
        args.push(arguments[i]);
      }
      args.push(function(err, value) {
        if (err) {
          promiseReject(err);
        } else {
          promiseResolve(value);
        }
      });
      try {
        original.apply(this || _global, args);
      } catch (err) {
        promiseReject(err);
      }
      return promise;
    }
    Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
    if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
      value: fn,
      enumerable: false,
      writable: false,
      configurable: true
    });
    return Object.defineProperties(fn, getOwnPropertyDescriptors(original));
  };
  exports$12.promisify.custom = kCustomPromisifiedSymbol;
  function callbackifyOnRejected(reason, cb) {
    if (!reason) {
      var newReason = new Error("Promise was rejected with a falsy value");
      newReason.reason = reason;
      reason = newReason;
    }
    return cb(reason);
  }
  function callbackify2(original) {
    if (typeof original !== "function") {
      throw new TypeError('The "original" argument must be of type Function');
    }
    function callbackified() {
      var args = [];
      for (var i = 0; i < arguments.length; i++) {
        args.push(arguments[i]);
      }
      var maybeCb = args.pop();
      if (typeof maybeCb !== "function") {
        throw new TypeError("The last argument must be of type Function");
      }
      var self2 = this || _global;
      var cb = function() {
        return maybeCb.apply(self2, arguments);
      };
      original.apply(this || _global, args).then(function(ret) {
        process$1.nextTick(cb.bind(null, null, ret));
      }, function(rej) {
        process$1.nextTick(callbackifyOnRejected.bind(null, rej, cb));
      });
    }
    Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
    Object.defineProperties(callbackified, getOwnPropertyDescriptors(original));
    return callbackified;
  }
  exports$12.callbackify = callbackify2;
  return exports$12;
}
var exports$k, _dewExec$k, exports$j, _dewExec$j, exports$i, _dewExec$i, exports$h, _dewExec$h, exports$g, _dewExec$g, exports$f, _dewExec$f, exports$e, _dewExec$e, exports$d, _dewExec$d, exports$c, _dewExec$c, exports$b, _dewExec$b, exports$a, _dewExec$a, exports$9, _dewExec$9, exports$8, _dewExec$8, exports$7, _dewExec$7, exports$6, _dewExec$6, exports$5, _dewExec$5, exports$4, _dewExec$4, exports$3, _dewExec$3, exports$2, _dewExec$2, exports$1, _dewExec$1, exports, _dewExec, exports2, _dewExec2, queue, draining, currentQueue, queueIndex, title, arch, platform, env, argv, execArgv, version, versions, emitWarning, binding, umask, cwd, chdir, release, _rawDebug, moduleLoadList, domain, _exiting, config, reallyExit, _kill, cpuUsage, resourceUsage, memoryUsage, kill, exit, openStdin, allowedNodeEnvironmentFlags, features, _fatalExceptions, setUncaughtExceptionCaptureCallback, _tickCallback, _debugProcess, _debugEnd, _startProfilerIdleNotifier, _stopProfilerIdleNotifier, stdout, stderr, stdin, abort, pid, ppid, execPath, debugPort, argv0, _preload_modules, setSourceMapsEnabled, _performance, nowOffset, nanoPerSec, _maxListeners, _events, _eventsCount, addListener, once, off, removeListener, removeAllListeners, emit, prependListener, prependOnceListener, process2, exports$c2, _dewExec$b2, exports$b2, _dewExec$a2, exports$a2, _dewExec$92, exports$92, _dewExec$82, exports$82, _dewExec$72, exports$72, _dewExec$62, exports$62, _dewExec$52, _global$2, exports$52, _dewExec$42, _global$1, exports$42, _dewExec$32, exports$32, _dewExec$22, exports$22, _dewExec$12, exports$12, _dewExec3, _global, exports3, _extend, callbackify, debuglog, deprecate, format, inherits, inspect, isArray, isBoolean, isBuffer, isDate, isError, isFunction, isNull, isNullOrUndefined, isNumber, isObject, isPrimitive, isRegExp, isString, isSymbol, isUndefined, log, promisify, types, TextEncoder, TextDecoder;
var init_util = __esm({
  "node-modules-polyfills:util"() {
    exports$k = {};
    _dewExec$k = false;
    exports$j = {};
    _dewExec$j = false;
    exports$i = {};
    _dewExec$i = false;
    exports$h = {};
    _dewExec$h = false;
    exports$g = {};
    _dewExec$g = false;
    exports$f = {};
    _dewExec$f = false;
    exports$e = {};
    _dewExec$e = false;
    exports$d = {};
    _dewExec$d = false;
    exports$c = {};
    _dewExec$c = false;
    exports$b = {};
    _dewExec$b = false;
    exports$a = {};
    _dewExec$a = false;
    exports$9 = {};
    _dewExec$9 = false;
    exports$8 = {};
    _dewExec$8 = false;
    exports$7 = {};
    _dewExec$7 = false;
    exports$6 = {};
    _dewExec$6 = false;
    exports$5 = {};
    _dewExec$5 = false;
    exports$4 = {};
    _dewExec$4 = false;
    exports$3 = {};
    _dewExec$3 = false;
    exports$2 = {};
    _dewExec$2 = false;
    exports$1 = {};
    _dewExec$1 = false;
    exports = {};
    _dewExec = false;
    exports2 = {};
    _dewExec2 = false;
    queue = [];
    draining = false;
    queueIndex = -1;
    Item.prototype.run = function() {
      this.fun.apply(null, this.array);
    };
    title = "browser";
    arch = "x64";
    platform = "browser";
    env = {
      PATH: "/usr/bin",
      LANG: navigator.language + ".UTF-8",
      PWD: "/",
      HOME: "/home",
      TMP: "/tmp"
    };
    argv = ["/usr/bin/node"];
    execArgv = [];
    version = "v16.8.0";
    versions = {};
    emitWarning = function(message, type) {
      console.warn((type ? type + ": " : "") + message);
    };
    binding = function(name) {
      unimplemented("binding");
    };
    umask = function(mask) {
      return 0;
    };
    cwd = function() {
      return "/";
    };
    chdir = function(dir) {
    };
    release = {
      name: "node",
      sourceUrl: "",
      headersUrl: "",
      libUrl: ""
    };
    _rawDebug = noop;
    moduleLoadList = [];
    domain = {};
    _exiting = false;
    config = {};
    reallyExit = noop;
    _kill = noop;
    cpuUsage = function() {
      return {};
    };
    resourceUsage = cpuUsage;
    memoryUsage = cpuUsage;
    kill = noop;
    exit = noop;
    openStdin = noop;
    allowedNodeEnvironmentFlags = {};
    features = {
      inspector: false,
      debug: false,
      uv: false,
      ipv6: false,
      tls_alpn: false,
      tls_sni: false,
      tls_ocsp: false,
      tls: false,
      cached_builtins: true
    };
    _fatalExceptions = noop;
    setUncaughtExceptionCaptureCallback = noop;
    _tickCallback = noop;
    _debugProcess = noop;
    _debugEnd = noop;
    _startProfilerIdleNotifier = noop;
    _stopProfilerIdleNotifier = noop;
    stdout = void 0;
    stderr = void 0;
    stdin = void 0;
    abort = noop;
    pid = 2;
    ppid = 1;
    execPath = "/bin/usr/node";
    debugPort = 9229;
    argv0 = "node";
    _preload_modules = [];
    setSourceMapsEnabled = noop;
    _performance = {
      now: typeof performance !== "undefined" ? performance.now.bind(performance) : void 0,
      timing: typeof performance !== "undefined" ? performance.timing : void 0
    };
    if (_performance.now === void 0) {
      nowOffset = Date.now();
      if (_performance.timing && _performance.timing.navigationStart) {
        nowOffset = _performance.timing.navigationStart;
      }
      _performance.now = () => Date.now() - nowOffset;
    }
    nanoPerSec = 1e9;
    hrtime.bigint = function(time) {
      var diff = hrtime(time);
      if (typeof BigInt === "undefined") {
        return diff[0] * nanoPerSec + diff[1];
      }
      return BigInt(diff[0] * nanoPerSec) + BigInt(diff[1]);
    };
    _maxListeners = 10;
    _events = {};
    _eventsCount = 0;
    addListener = on;
    once = on;
    off = on;
    removeListener = on;
    removeAllListeners = on;
    emit = noop;
    prependListener = on;
    prependOnceListener = on;
    process2 = {
      version,
      versions,
      arch,
      platform,
      release,
      _rawDebug,
      moduleLoadList,
      binding,
      _linkedBinding,
      _events,
      _eventsCount,
      _maxListeners,
      on,
      addListener,
      once,
      off,
      removeListener,
      removeAllListeners,
      emit,
      prependListener,
      prependOnceListener,
      listeners,
      domain,
      _exiting,
      config,
      dlopen,
      uptime,
      _getActiveRequests,
      _getActiveHandles,
      reallyExit,
      _kill,
      cpuUsage,
      resourceUsage,
      memoryUsage,
      kill,
      exit,
      openStdin,
      allowedNodeEnvironmentFlags,
      assert,
      features,
      _fatalExceptions,
      setUncaughtExceptionCaptureCallback,
      hasUncaughtExceptionCaptureCallback,
      emitWarning,
      nextTick,
      _tickCallback,
      _debugProcess,
      _debugEnd,
      _startProfilerIdleNotifier,
      _stopProfilerIdleNotifier,
      stdout,
      stdin,
      stderr,
      abort,
      umask,
      chdir,
      cwd,
      env,
      title,
      argv,
      execArgv,
      pid,
      ppid,
      execPath,
      debugPort,
      hrtime,
      argv0,
      _preload_modules,
      setSourceMapsEnabled
    };
    exports$c2 = {};
    _dewExec$b2 = false;
    exports$b2 = {};
    _dewExec$a2 = false;
    exports$a2 = {};
    _dewExec$92 = false;
    exports$92 = {};
    _dewExec$82 = false;
    exports$82 = {};
    _dewExec$72 = false;
    exports$72 = {};
    _dewExec$62 = false;
    exports$62 = {};
    _dewExec$52 = false;
    _global$2 = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : globalThis;
    exports$52 = {};
    _dewExec$42 = false;
    _global$1 = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : globalThis;
    exports$42 = {};
    _dewExec$32 = false;
    exports$32 = {};
    _dewExec$22 = false;
    exports$22 = {};
    _dewExec$12 = false;
    exports$12 = {};
    _dewExec3 = false;
    _global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : globalThis;
    exports3 = dew3();
    exports3["format"];
    exports3["deprecate"];
    exports3["debuglog"];
    exports3["inspect"];
    exports3["types"];
    exports3["isArray"];
    exports3["isBoolean"];
    exports3["isNull"];
    exports3["isNullOrUndefined"];
    exports3["isNumber"];
    exports3["isString"];
    exports3["isSymbol"];
    exports3["isUndefined"];
    exports3["isRegExp"];
    exports3["isObject"];
    exports3["isDate"];
    exports3["isError"];
    exports3["isFunction"];
    exports3["isPrimitive"];
    exports3["isBuffer"];
    exports3["log"];
    exports3["inherits"];
    exports3["_extend"];
    exports3["promisify"];
    exports3["callbackify"];
    _extend = exports3._extend;
    callbackify = exports3.callbackify;
    debuglog = exports3.debuglog;
    deprecate = exports3.deprecate;
    format = exports3.format;
    inherits = exports3.inherits;
    inspect = exports3.inspect;
    isArray = exports3.isArray;
    isBoolean = exports3.isBoolean;
    isBuffer = exports3.isBuffer;
    isDate = exports3.isDate;
    isError = exports3.isError;
    isFunction = exports3.isFunction;
    isNull = exports3.isNull;
    isNullOrUndefined = exports3.isNullOrUndefined;
    isNumber = exports3.isNumber;
    isObject = exports3.isObject;
    isPrimitive = exports3.isPrimitive;
    isRegExp = exports3.isRegExp;
    isString = exports3.isString;
    isSymbol = exports3.isSymbol;
    isUndefined = exports3.isUndefined;
    log = exports3.log;
    promisify = exports3.promisify;
    types = exports3.types;
    TextEncoder = exports3.TextEncoder = globalThis.TextEncoder;
    TextDecoder = exports3.TextDecoder = globalThis.TextDecoder;
  }
});

// node-modules-polyfills-commonjs:util
var util_exports = {};
__export(util_exports, {
  TextDecoder: () => TextDecoder,
  TextEncoder: () => TextEncoder,
  _extend: () => _extend,
  callbackify: () => callbackify,
  debuglog: () => debuglog,
  deprecate: () => deprecate,
  format: () => format,
  inherits: () => inherits,
  inspect: () => inspect,
  isArray: () => isArray,
  isBoolean: () => isBoolean,
  isBuffer: () => isBuffer,
  isDate: () => isDate,
  isError: () => isError,
  isFunction: () => isFunction,
  isNull: () => isNull,
  isNullOrUndefined: () => isNullOrUndefined,
  isNumber: () => isNumber,
  isObject: () => isObject,
  isPrimitive: () => isPrimitive,
  isRegExp: () => isRegExp,
  isString: () => isString,
  isSymbol: () => isSymbol,
  isUndefined: () => isUndefined,
  log: () => log,
  promisify: () => promisify,
  types: () => types
});
var init_util2 = __esm({
  "node-modules-polyfills-commonjs:util"() {
    init_util();
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+swagger-parser@12.0.0_openapi-types@12.1.3/node_modules/@apidevtools/swagger-parser/lib/util.js
var require_util = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+swagger-parser@12.0.0_openapi-types@12.1.3/node_modules/@apidevtools/swagger-parser/lib/util.js"(exports5) {
    "use strict";
    var util = (init_util2(), __toCommonJS(util_exports));
    exports5.format = util.format;
    exports5.inherits = util.inherits;
    var parse3 = (u) => new URL(u);
    exports5.swaggerParamRegExp = /\{([^/}]+)}/g;
    var operationsList = ["get", "post", "put", "delete", "patch", "options", "head", "trace"];
    function fixServers(server, path) {
      if (server.url && server.url.startsWith("/")) {
        const inUrl = parse3(path);
        const finalUrl = inUrl.protocol + "//" + inUrl.hostname + server.url;
        server.url = finalUrl;
        return server;
      }
    }
    function fixOasRelativeServers(schema4, filePath) {
      if (schema4.openapi && filePath && (filePath.startsWith("http:") || filePath.startsWith("https:"))) {
        if (schema4.servers) {
          schema4.servers.map((server) => fixServers(server, filePath));
        }
        ["paths", "webhooks"].forEach((component) => {
          Object.keys(schema4[component] || []).forEach((path) => {
            const pathItem = schema4[component][path];
            Object.keys(pathItem).forEach((opItem) => {
              if (opItem === "servers") {
                pathItem[opItem].map((server) => fixServers(server, filePath));
              } else if (operationsList.includes(opItem)) {
                if (pathItem[opItem].servers) {
                  pathItem[opItem].servers.map((server) => fixServers(server, filePath));
                }
              }
            });
          });
        });
      } else {
      }
    }
    exports5.fixOasRelativeServers = fixOasRelativeServers;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/codegen/code.js
var require_code = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/codegen/code.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.regexpCode = exports5.getEsmExportName = exports5.getProperty = exports5.safeStringify = exports5.stringify = exports5.strConcat = exports5.addCodeArg = exports5.str = exports5._ = exports5.nil = exports5._Code = exports5.Name = exports5.IDENTIFIER = exports5._CodeOrName = void 0;
    var _CodeOrName = class {
    };
    exports5._CodeOrName = _CodeOrName;
    exports5.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
    var Name = class extends _CodeOrName {
      constructor(s) {
        super();
        if (!exports5.IDENTIFIER.test(s))
          throw new Error("CodeGen: name must be a valid identifier");
        this.str = s;
      }
      toString() {
        return this.str;
      }
      emptyStr() {
        return false;
      }
      get names() {
        return { [this.str]: 1 };
      }
    };
    exports5.Name = Name;
    var _Code = class extends _CodeOrName {
      constructor(code2) {
        super();
        this._items = typeof code2 === "string" ? [code2] : code2;
      }
      toString() {
        return this.str;
      }
      emptyStr() {
        if (this._items.length > 1)
          return false;
        const item = this._items[0];
        return item === "" || item === '""';
      }
      get str() {
        var _a;
        return (_a = this._str) !== null && _a !== void 0 ? _a : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
      }
      get names() {
        var _a;
        return (_a = this._names) !== null && _a !== void 0 ? _a : this._names = this._items.reduce((names, c) => {
          if (c instanceof Name)
            names[c.str] = (names[c.str] || 0) + 1;
          return names;
        }, {});
      }
    };
    exports5._Code = _Code;
    exports5.nil = new _Code("");
    function _(strs, ...args) {
      const code2 = [strs[0]];
      let i = 0;
      while (i < args.length) {
        addCodeArg(code2, args[i]);
        code2.push(strs[++i]);
      }
      return new _Code(code2);
    }
    exports5._ = _;
    var plus = new _Code("+");
    function str(strs, ...args) {
      const expr = [safeStringify(strs[0])];
      let i = 0;
      while (i < args.length) {
        expr.push(plus);
        addCodeArg(expr, args[i]);
        expr.push(plus, safeStringify(strs[++i]));
      }
      optimize(expr);
      return new _Code(expr);
    }
    exports5.str = str;
    function addCodeArg(code2, arg) {
      if (arg instanceof _Code)
        code2.push(...arg._items);
      else if (arg instanceof Name)
        code2.push(arg);
      else
        code2.push(interpolate(arg));
    }
    exports5.addCodeArg = addCodeArg;
    function optimize(expr) {
      let i = 1;
      while (i < expr.length - 1) {
        if (expr[i] === plus) {
          const res = mergeExprItems(expr[i - 1], expr[i + 1]);
          if (res !== void 0) {
            expr.splice(i - 1, 3, res);
            continue;
          }
          expr[i++] = "+";
        }
        i++;
      }
    }
    function mergeExprItems(a, b) {
      if (b === '""')
        return a;
      if (a === '""')
        return b;
      if (typeof a == "string") {
        if (b instanceof Name || a[a.length - 1] !== '"')
          return;
        if (typeof b != "string")
          return `${a.slice(0, -1)}${b}"`;
        if (b[0] === '"')
          return a.slice(0, -1) + b.slice(1);
        return;
      }
      if (typeof b == "string" && b[0] === '"' && !(a instanceof Name))
        return `"${a}${b.slice(1)}`;
      return;
    }
    function strConcat(c1, c2) {
      return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}`;
    }
    exports5.strConcat = strConcat;
    function interpolate(x) {
      return typeof x == "number" || typeof x == "boolean" || x === null ? x : safeStringify(Array.isArray(x) ? x.join(",") : x);
    }
    function stringify4(x) {
      return new _Code(safeStringify(x));
    }
    exports5.stringify = stringify4;
    function safeStringify(x) {
      return JSON.stringify(x).replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
    }
    exports5.safeStringify = safeStringify;
    function getProperty(key) {
      return typeof key == "string" && exports5.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]`;
    }
    exports5.getProperty = getProperty;
    function getEsmExportName(key) {
      if (typeof key == "string" && exports5.IDENTIFIER.test(key)) {
        return new _Code(`${key}`);
      }
      throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`);
    }
    exports5.getEsmExportName = getEsmExportName;
    function regexpCode(rx) {
      return new _Code(rx.toString());
    }
    exports5.regexpCode = regexpCode;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/codegen/scope.js
var require_scope = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/codegen/scope.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.ValueScope = exports5.ValueScopeName = exports5.Scope = exports5.varKinds = exports5.UsedValueState = void 0;
    var code_1 = require_code();
    var ValueError = class extends Error {
      constructor(name) {
        super(`CodeGen: "code" for ${name} not defined`);
        this.value = name.value;
      }
    };
    var UsedValueState;
    (function(UsedValueState2) {
      UsedValueState2[UsedValueState2["Started"] = 0] = "Started";
      UsedValueState2[UsedValueState2["Completed"] = 1] = "Completed";
    })(UsedValueState || (exports5.UsedValueState = UsedValueState = {}));
    exports5.varKinds = {
      const: new code_1.Name("const"),
      let: new code_1.Name("let"),
      var: new code_1.Name("var")
    };
    var Scope = class {
      constructor({ prefixes, parent } = {}) {
        this._names = {};
        this._prefixes = prefixes;
        this._parent = parent;
      }
      toName(nameOrPrefix) {
        return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix);
      }
      name(prefix) {
        return new code_1.Name(this._newName(prefix));
      }
      _newName(prefix) {
        const ng = this._names[prefix] || this._nameGroup(prefix);
        return `${prefix}${ng.index++}`;
      }
      _nameGroup(prefix) {
        var _a, _b;
        if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
          throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
        }
        return this._names[prefix] = { prefix, index: 0 };
      }
    };
    exports5.Scope = Scope;
    var ValueScopeName = class extends code_1.Name {
      constructor(prefix, nameStr) {
        super(nameStr);
        this.prefix = prefix;
      }
      setValue(value, { property, itemIndex }) {
        this.value = value;
        this.scopePath = (0, code_1._)`.${new code_1.Name(property)}[${itemIndex}]`;
      }
    };
    exports5.ValueScopeName = ValueScopeName;
    var line = (0, code_1._)`\n`;
    var ValueScope = class extends Scope {
      constructor(opts) {
        super(opts);
        this._values = {};
        this._scope = opts.scope;
        this.opts = { ...opts, _n: opts.lines ? line : code_1.nil };
      }
      get() {
        return this._scope;
      }
      name(prefix) {
        return new ValueScopeName(prefix, this._newName(prefix));
      }
      value(nameOrPrefix, value) {
        var _a;
        if (value.ref === void 0)
          throw new Error("CodeGen: ref must be passed in value");
        const name = this.toName(nameOrPrefix);
        const { prefix } = name;
        const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref;
        let vs = this._values[prefix];
        if (vs) {
          const _name = vs.get(valueKey);
          if (_name)
            return _name;
        } else {
          vs = this._values[prefix] = /* @__PURE__ */ new Map();
        }
        vs.set(valueKey, name);
        const s = this._scope[prefix] || (this._scope[prefix] = []);
        const itemIndex = s.length;
        s[itemIndex] = value.ref;
        name.setValue(value, { property: prefix, itemIndex });
        return name;
      }
      getValue(prefix, keyOrRef) {
        const vs = this._values[prefix];
        if (!vs)
          return;
        return vs.get(keyOrRef);
      }
      scopeRefs(scopeName, values = this._values) {
        return this._reduceValues(values, (name) => {
          if (name.scopePath === void 0)
            throw new Error(`CodeGen: name "${name}" has no value`);
          return (0, code_1._)`${scopeName}${name.scopePath}`;
        });
      }
      scopeCode(values = this._values, usedValues, getCode) {
        return this._reduceValues(values, (name) => {
          if (name.value === void 0)
            throw new Error(`CodeGen: name "${name}" has no value`);
          return name.value.code;
        }, usedValues, getCode);
      }
      _reduceValues(values, valueCode, usedValues = {}, getCode) {
        let code2 = code_1.nil;
        for (const prefix in values) {
          const vs = values[prefix];
          if (!vs)
            continue;
          const nameSet = usedValues[prefix] = usedValues[prefix] || /* @__PURE__ */ new Map();
          vs.forEach((name) => {
            if (nameSet.has(name))
              return;
            nameSet.set(name, UsedValueState.Started);
            let c = valueCode(name);
            if (c) {
              const def = this.opts.es5 ? exports5.varKinds.var : exports5.varKinds.const;
              code2 = (0, code_1._)`${code2}${def} ${name} = ${c};${this.opts._n}`;
            } else if (c = getCode === null || getCode === void 0 ? void 0 : getCode(name)) {
              code2 = (0, code_1._)`${code2}${c}${this.opts._n}`;
            } else {
              throw new ValueError(name);
            }
            nameSet.set(name, UsedValueState.Completed);
          });
        }
        return code2;
      }
    };
    exports5.ValueScope = ValueScope;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/codegen/index.js
var require_codegen = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/codegen/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.or = exports5.and = exports5.not = exports5.CodeGen = exports5.operators = exports5.varKinds = exports5.ValueScopeName = exports5.ValueScope = exports5.Scope = exports5.Name = exports5.regexpCode = exports5.stringify = exports5.getProperty = exports5.nil = exports5.strConcat = exports5.str = exports5._ = void 0;
    var code_1 = require_code();
    var scope_1 = require_scope();
    var code_2 = require_code();
    Object.defineProperty(exports5, "_", { enumerable: true, get: function() {
      return code_2._;
    } });
    Object.defineProperty(exports5, "str", { enumerable: true, get: function() {
      return code_2.str;
    } });
    Object.defineProperty(exports5, "strConcat", { enumerable: true, get: function() {
      return code_2.strConcat;
    } });
    Object.defineProperty(exports5, "nil", { enumerable: true, get: function() {
      return code_2.nil;
    } });
    Object.defineProperty(exports5, "getProperty", { enumerable: true, get: function() {
      return code_2.getProperty;
    } });
    Object.defineProperty(exports5, "stringify", { enumerable: true, get: function() {
      return code_2.stringify;
    } });
    Object.defineProperty(exports5, "regexpCode", { enumerable: true, get: function() {
      return code_2.regexpCode;
    } });
    Object.defineProperty(exports5, "Name", { enumerable: true, get: function() {
      return code_2.Name;
    } });
    var scope_2 = require_scope();
    Object.defineProperty(exports5, "Scope", { enumerable: true, get: function() {
      return scope_2.Scope;
    } });
    Object.defineProperty(exports5, "ValueScope", { enumerable: true, get: function() {
      return scope_2.ValueScope;
    } });
    Object.defineProperty(exports5, "ValueScopeName", { enumerable: true, get: function() {
      return scope_2.ValueScopeName;
    } });
    Object.defineProperty(exports5, "varKinds", { enumerable: true, get: function() {
      return scope_2.varKinds;
    } });
    exports5.operators = {
      GT: new code_1._Code(">"),
      GTE: new code_1._Code(">="),
      LT: new code_1._Code("<"),
      LTE: new code_1._Code("<="),
      EQ: new code_1._Code("==="),
      NEQ: new code_1._Code("!=="),
      NOT: new code_1._Code("!"),
      OR: new code_1._Code("||"),
      AND: new code_1._Code("&&"),
      ADD: new code_1._Code("+")
    };
    var Node = class {
      optimizeNodes() {
        return this;
      }
      optimizeNames(_names, _constants) {
        return this;
      }
    };
    var Def = class extends Node {
      constructor(varKind, name, rhs) {
        super();
        this.varKind = varKind;
        this.name = name;
        this.rhs = rhs;
      }
      render({ es5, _n }) {
        const varKind = es5 ? scope_1.varKinds.var : this.varKind;
        const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
        return `${varKind} ${this.name}${rhs};` + _n;
      }
      optimizeNames(names, constants) {
        if (!names[this.name.str])
          return;
        if (this.rhs)
          this.rhs = optimizeExpr(this.rhs, names, constants);
        return this;
      }
      get names() {
        return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {};
      }
    };
    var Assign = class extends Node {
      constructor(lhs, rhs, sideEffects) {
        super();
        this.lhs = lhs;
        this.rhs = rhs;
        this.sideEffects = sideEffects;
      }
      render({ _n }) {
        return `${this.lhs} = ${this.rhs};` + _n;
      }
      optimizeNames(names, constants) {
        if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
          return;
        this.rhs = optimizeExpr(this.rhs, names, constants);
        return this;
      }
      get names() {
        const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names };
        return addExprNames(names, this.rhs);
      }
    };
    var AssignOp = class extends Assign {
      constructor(lhs, op, rhs, sideEffects) {
        super(lhs, rhs, sideEffects);
        this.op = op;
      }
      render({ _n }) {
        return `${this.lhs} ${this.op}= ${this.rhs};` + _n;
      }
    };
    var Label = class extends Node {
      constructor(label) {
        super();
        this.label = label;
        this.names = {};
      }
      render({ _n }) {
        return `${this.label}:` + _n;
      }
    };
    var Break = class extends Node {
      constructor(label) {
        super();
        this.label = label;
        this.names = {};
      }
      render({ _n }) {
        const label = this.label ? ` ${this.label}` : "";
        return `break${label};` + _n;
      }
    };
    var Throw = class extends Node {
      constructor(error) {
        super();
        this.error = error;
      }
      render({ _n }) {
        return `throw ${this.error};` + _n;
      }
      get names() {
        return this.error.names;
      }
    };
    var AnyCode = class extends Node {
      constructor(code2) {
        super();
        this.code = code2;
      }
      render({ _n }) {
        return `${this.code};` + _n;
      }
      optimizeNodes() {
        return `${this.code}` ? this : void 0;
      }
      optimizeNames(names, constants) {
        this.code = optimizeExpr(this.code, names, constants);
        return this;
      }
      get names() {
        return this.code instanceof code_1._CodeOrName ? this.code.names : {};
      }
    };
    var ParentNode = class extends Node {
      constructor(nodes = []) {
        super();
        this.nodes = nodes;
      }
      render(opts) {
        return this.nodes.reduce((code2, n) => code2 + n.render(opts), "");
      }
      optimizeNodes() {
        const { nodes } = this;
        let i = nodes.length;
        while (i--) {
          const n = nodes[i].optimizeNodes();
          if (Array.isArray(n))
            nodes.splice(i, 1, ...n);
          else if (n)
            nodes[i] = n;
          else
            nodes.splice(i, 1);
        }
        return nodes.length > 0 ? this : void 0;
      }
      optimizeNames(names, constants) {
        const { nodes } = this;
        let i = nodes.length;
        while (i--) {
          const n = nodes[i];
          if (n.optimizeNames(names, constants))
            continue;
          subtractNames(names, n.names);
          nodes.splice(i, 1);
        }
        return nodes.length > 0 ? this : void 0;
      }
      get names() {
        return this.nodes.reduce((names, n) => addNames(names, n.names), {});
      }
    };
    var BlockNode = class extends ParentNode {
      render(opts) {
        return "{" + opts._n + super.render(opts) + "}" + opts._n;
      }
    };
    var Root = class extends ParentNode {
    };
    var Else = class extends BlockNode {
    };
    Else.kind = "else";
    var If = class _If extends BlockNode {
      constructor(condition, nodes) {
        super(nodes);
        this.condition = condition;
      }
      render(opts) {
        let code2 = `if(${this.condition})` + super.render(opts);
        if (this.else)
          code2 += "else " + this.else.render(opts);
        return code2;
      }
      optimizeNodes() {
        super.optimizeNodes();
        const cond = this.condition;
        if (cond === true)
          return this.nodes;
        let e = this.else;
        if (e) {
          const ns = e.optimizeNodes();
          e = this.else = Array.isArray(ns) ? new Else(ns) : ns;
        }
        if (e) {
          if (cond === false)
            return e instanceof _If ? e : e.nodes;
          if (this.nodes.length)
            return this;
          return new _If(not(cond), e instanceof _If ? [e] : e.nodes);
        }
        if (cond === false || !this.nodes.length)
          return void 0;
        return this;
      }
      optimizeNames(names, constants) {
        var _a;
        this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
        if (!(super.optimizeNames(names, constants) || this.else))
          return;
        this.condition = optimizeExpr(this.condition, names, constants);
        return this;
      }
      get names() {
        const names = super.names;
        addExprNames(names, this.condition);
        if (this.else)
          addNames(names, this.else.names);
        return names;
      }
    };
    If.kind = "if";
    var For = class extends BlockNode {
    };
    For.kind = "for";
    var ForLoop = class extends For {
      constructor(iteration) {
        super();
        this.iteration = iteration;
      }
      render(opts) {
        return `for(${this.iteration})` + super.render(opts);
      }
      optimizeNames(names, constants) {
        if (!super.optimizeNames(names, constants))
          return;
        this.iteration = optimizeExpr(this.iteration, names, constants);
        return this;
      }
      get names() {
        return addNames(super.names, this.iteration.names);
      }
    };
    var ForRange = class extends For {
      constructor(varKind, name, from, to) {
        super();
        this.varKind = varKind;
        this.name = name;
        this.from = from;
        this.to = to;
      }
      render(opts) {
        const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind;
        const { name, from, to } = this;
        return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts);
      }
      get names() {
        const names = addExprNames(super.names, this.from);
        return addExprNames(names, this.to);
      }
    };
    var ForIter = class extends For {
      constructor(loop, varKind, name, iterable) {
        super();
        this.loop = loop;
        this.varKind = varKind;
        this.name = name;
        this.iterable = iterable;
      }
      render(opts) {
        return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
      }
      optimizeNames(names, constants) {
        if (!super.optimizeNames(names, constants))
          return;
        this.iterable = optimizeExpr(this.iterable, names, constants);
        return this;
      }
      get names() {
        return addNames(super.names, this.iterable.names);
      }
    };
    var Func = class extends BlockNode {
      constructor(name, args, async) {
        super();
        this.name = name;
        this.args = args;
        this.async = async;
      }
      render(opts) {
        const _async = this.async ? "async " : "";
        return `${_async}function ${this.name}(${this.args})` + super.render(opts);
      }
    };
    Func.kind = "func";
    var Return = class extends ParentNode {
      render(opts) {
        return "return " + super.render(opts);
      }
    };
    Return.kind = "return";
    var Try = class extends BlockNode {
      render(opts) {
        let code2 = "try" + super.render(opts);
        if (this.catch)
          code2 += this.catch.render(opts);
        if (this.finally)
          code2 += this.finally.render(opts);
        return code2;
      }
      optimizeNodes() {
        var _a, _b;
        super.optimizeNodes();
        (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes();
        (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
        return this;
      }
      optimizeNames(names, constants) {
        var _a, _b;
        super.optimizeNames(names, constants);
        (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
        (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
        return this;
      }
      get names() {
        const names = super.names;
        if (this.catch)
          addNames(names, this.catch.names);
        if (this.finally)
          addNames(names, this.finally.names);
        return names;
      }
    };
    var Catch = class extends BlockNode {
      constructor(error) {
        super();
        this.error = error;
      }
      render(opts) {
        return `catch(${this.error})` + super.render(opts);
      }
    };
    Catch.kind = "catch";
    var Finally = class extends BlockNode {
      render(opts) {
        return "finally" + super.render(opts);
      }
    };
    Finally.kind = "finally";
    var CodeGen = class {
      constructor(extScope, opts = {}) {
        this._values = {};
        this._blockStarts = [];
        this._constants = {};
        this.opts = { ...opts, _n: opts.lines ? "\n" : "" };
        this._extScope = extScope;
        this._scope = new scope_1.Scope({ parent: extScope });
        this._nodes = [new Root()];
      }
      toString() {
        return this._root.render(this.opts);
      }
      // returns unique name in the internal scope
      name(prefix) {
        return this._scope.name(prefix);
      }
      // reserves unique name in the external scope
      scopeName(prefix) {
        return this._extScope.name(prefix);
      }
      // reserves unique name in the external scope and assigns value to it
      scopeValue(prefixOrName, value) {
        const name = this._extScope.value(prefixOrName, value);
        const vs = this._values[name.prefix] || (this._values[name.prefix] = /* @__PURE__ */ new Set());
        vs.add(name);
        return name;
      }
      getScopeValue(prefix, keyOrRef) {
        return this._extScope.getValue(prefix, keyOrRef);
      }
      // return code that assigns values in the external scope to the names that are used internally
      // (same names that were returned by gen.scopeName or gen.scopeValue)
      scopeRefs(scopeName) {
        return this._extScope.scopeRefs(scopeName, this._values);
      }
      scopeCode() {
        return this._extScope.scopeCode(this._values);
      }
      _def(varKind, nameOrPrefix, rhs, constant) {
        const name = this._scope.toName(nameOrPrefix);
        if (rhs !== void 0 && constant)
          this._constants[name.str] = rhs;
        this._leafNode(new Def(varKind, name, rhs));
        return name;
      }
      // `const` declaration (`var` in es5 mode)
      const(nameOrPrefix, rhs, _constant) {
        return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant);
      }
      // `let` declaration with optional assignment (`var` in es5 mode)
      let(nameOrPrefix, rhs, _constant) {
        return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant);
      }
      // `var` declaration with optional assignment
      var(nameOrPrefix, rhs, _constant) {
        return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant);
      }
      // assignment code
      assign(lhs, rhs, sideEffects) {
        return this._leafNode(new Assign(lhs, rhs, sideEffects));
      }
      // `+=` code
      add(lhs, rhs) {
        return this._leafNode(new AssignOp(lhs, exports5.operators.ADD, rhs));
      }
      // appends passed SafeExpr to code or executes Block
      code(c) {
        if (typeof c == "function")
          c();
        else if (c !== code_1.nil)
          this._leafNode(new AnyCode(c));
        return this;
      }
      // returns code for object literal for the passed argument list of key-value pairs
      object(...keyValues) {
        const code2 = ["{"];
        for (const [key, value] of keyValues) {
          if (code2.length > 1)
            code2.push(",");
          code2.push(key);
          if (key !== value || this.opts.es5) {
            code2.push(":");
            (0, code_1.addCodeArg)(code2, value);
          }
        }
        code2.push("}");
        return new code_1._Code(code2);
      }
      // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
      if(condition, thenBody, elseBody) {
        this._blockNode(new If(condition));
        if (thenBody && elseBody) {
          this.code(thenBody).else().code(elseBody).endIf();
        } else if (thenBody) {
          this.code(thenBody).endIf();
        } else if (elseBody) {
          throw new Error('CodeGen: "else" body without "then" body');
        }
        return this;
      }
      // `else if` clause - invalid without `if` or after `else` clauses
      elseIf(condition) {
        return this._elseNode(new If(condition));
      }
      // `else` clause - only valid after `if` or `else if` clauses
      else() {
        return this._elseNode(new Else());
      }
      // end `if` statement (needed if gen.if was used only with condition)
      endIf() {
        return this._endBlockNode(If, Else);
      }
      _for(node, forBody) {
        this._blockNode(node);
        if (forBody)
          this.code(forBody).endFor();
        return this;
      }
      // a generic `for` clause (or statement if `forBody` is passed)
      for(iteration, forBody) {
        return this._for(new ForLoop(iteration), forBody);
      }
      // `for` statement for a range of values
      forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) {
        const name = this._scope.toName(nameOrPrefix);
        return this._for(new ForRange(varKind, name, from, to), () => forBody(name));
      }
      // `for-of` statement (in es5 mode replace with a normal for loop)
      forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
        const name = this._scope.toName(nameOrPrefix);
        if (this.opts.es5) {
          const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable);
          return this.forRange("_i", 0, (0, code_1._)`${arr}.length`, (i) => {
            this.var(name, (0, code_1._)`${arr}[${i}]`);
            forBody(name);
          });
        }
        return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name));
      }
      // `for-in` statement.
      // With option `ownProperties` replaced with a `for-of` loop for object keys
      forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) {
        if (this.opts.ownProperties) {
          return this.forOf(nameOrPrefix, (0, code_1._)`Object.keys(${obj})`, forBody);
        }
        const name = this._scope.toName(nameOrPrefix);
        return this._for(new ForIter("in", varKind, name, obj), () => forBody(name));
      }
      // end `for` loop
      endFor() {
        return this._endBlockNode(For);
      }
      // `label` statement
      label(label) {
        return this._leafNode(new Label(label));
      }
      // `break` statement
      break(label) {
        return this._leafNode(new Break(label));
      }
      // `return` statement
      return(value) {
        const node = new Return();
        this._blockNode(node);
        this.code(value);
        if (node.nodes.length !== 1)
          throw new Error('CodeGen: "return" should have one node');
        return this._endBlockNode(Return);
      }
      // `try` statement
      try(tryBody, catchCode, finallyCode) {
        if (!catchCode && !finallyCode)
          throw new Error('CodeGen: "try" without "catch" and "finally"');
        const node = new Try();
        this._blockNode(node);
        this.code(tryBody);
        if (catchCode) {
          const error = this.name("e");
          this._currNode = node.catch = new Catch(error);
          catchCode(error);
        }
        if (finallyCode) {
          this._currNode = node.finally = new Finally();
          this.code(finallyCode);
        }
        return this._endBlockNode(Catch, Finally);
      }
      // `throw` statement
      throw(error) {
        return this._leafNode(new Throw(error));
      }
      // start self-balancing block
      block(body, nodeCount) {
        this._blockStarts.push(this._nodes.length);
        if (body)
          this.code(body).endBlock(nodeCount);
        return this;
      }
      // end the current self-balancing block
      endBlock(nodeCount) {
        const len = this._blockStarts.pop();
        if (len === void 0)
          throw new Error("CodeGen: not in self-balancing block");
        const toClose = this._nodes.length - len;
        if (toClose < 0 || nodeCount !== void 0 && toClose !== nodeCount) {
          throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`);
        }
        this._nodes.length = len;
        return this;
      }
      // `function` heading (or definition if funcBody is passed)
      func(name, args = code_1.nil, async, funcBody) {
        this._blockNode(new Func(name, args, async));
        if (funcBody)
          this.code(funcBody).endFunc();
        return this;
      }
      // end function definition
      endFunc() {
        return this._endBlockNode(Func);
      }
      optimize(n = 1) {
        while (n-- > 0) {
          this._root.optimizeNodes();
          this._root.optimizeNames(this._root.names, this._constants);
        }
      }
      _leafNode(node) {
        this._currNode.nodes.push(node);
        return this;
      }
      _blockNode(node) {
        this._currNode.nodes.push(node);
        this._nodes.push(node);
      }
      _endBlockNode(N1, N2) {
        const n = this._currNode;
        if (n instanceof N1 || N2 && n instanceof N2) {
          this._nodes.pop();
          return this;
        }
        throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`);
      }
      _elseNode(node) {
        const n = this._currNode;
        if (!(n instanceof If)) {
          throw new Error('CodeGen: "else" without "if"');
        }
        this._currNode = n.else = node;
        return this;
      }
      get _root() {
        return this._nodes[0];
      }
      get _currNode() {
        const ns = this._nodes;
        return ns[ns.length - 1];
      }
      set _currNode(node) {
        const ns = this._nodes;
        ns[ns.length - 1] = node;
      }
    };
    exports5.CodeGen = CodeGen;
    function addNames(names, from) {
      for (const n in from)
        names[n] = (names[n] || 0) + (from[n] || 0);
      return names;
    }
    function addExprNames(names, from) {
      return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
    }
    function optimizeExpr(expr, names, constants) {
      if (expr instanceof code_1.Name)
        return replaceName(expr);
      if (!canOptimize(expr))
        return expr;
      return new code_1._Code(expr._items.reduce((items, c) => {
        if (c instanceof code_1.Name)
          c = replaceName(c);
        if (c instanceof code_1._Code)
          items.push(...c._items);
        else
          items.push(c);
        return items;
      }, []));
      function replaceName(n) {
        const c = constants[n.str];
        if (c === void 0 || names[n.str] !== 1)
          return n;
        delete names[n.str];
        return c;
      }
      function canOptimize(e) {
        return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== void 0);
      }
    }
    function subtractNames(names, from) {
      for (const n in from)
        names[n] = (names[n] || 0) - (from[n] || 0);
    }
    function not(x) {
      return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._)`!${par(x)}`;
    }
    exports5.not = not;
    var andCode = mappend(exports5.operators.AND);
    function and(...args) {
      return args.reduce(andCode);
    }
    exports5.and = and;
    var orCode = mappend(exports5.operators.OR);
    function or(...args) {
      return args.reduce(orCode);
    }
    exports5.or = or;
    function mappend(op) {
      return (x, y) => x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._)`${par(x)} ${op} ${par(y)}`;
    }
    function par(x) {
      return x instanceof code_1.Name ? x : (0, code_1._)`(${x})`;
    }
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/util.js
var require_util2 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/util.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.checkStrictMode = exports5.getErrorPath = exports5.Type = exports5.useFunc = exports5.setEvaluated = exports5.evaluatedPropsToName = exports5.mergeEvaluated = exports5.eachItem = exports5.unescapeJsonPointer = exports5.escapeJsonPointer = exports5.escapeFragment = exports5.unescapeFragment = exports5.schemaRefOrVal = exports5.schemaHasRulesButRef = exports5.schemaHasRules = exports5.checkUnknownRules = exports5.alwaysValidSchema = exports5.toHash = void 0;
    var codegen_1 = require_codegen();
    var code_1 = require_code();
    function toHash(arr) {
      const hash = {};
      for (const item of arr)
        hash[item] = true;
      return hash;
    }
    exports5.toHash = toHash;
    function alwaysValidSchema(it, schema4) {
      if (typeof schema4 == "boolean")
        return schema4;
      if (Object.keys(schema4).length === 0)
        return true;
      checkUnknownRules(it, schema4);
      return !schemaHasRules(schema4, it.self.RULES.all);
    }
    exports5.alwaysValidSchema = alwaysValidSchema;
    function checkUnknownRules(it, schema4 = it.schema) {
      const { opts, self: self2 } = it;
      if (!opts.strictSchema)
        return;
      if (typeof schema4 === "boolean")
        return;
      const rules = self2.RULES.keywords;
      for (const key in schema4) {
        if (!rules[key])
          checkStrictMode(it, `unknown keyword: "${key}"`);
      }
    }
    exports5.checkUnknownRules = checkUnknownRules;
    function schemaHasRules(schema4, rules) {
      if (typeof schema4 == "boolean")
        return !schema4;
      for (const key in schema4)
        if (rules[key])
          return true;
      return false;
    }
    exports5.schemaHasRules = schemaHasRules;
    function schemaHasRulesButRef(schema4, RULES) {
      if (typeof schema4 == "boolean")
        return !schema4;
      for (const key in schema4)
        if (key !== "$ref" && RULES.all[key])
          return true;
      return false;
    }
    exports5.schemaHasRulesButRef = schemaHasRulesButRef;
    function schemaRefOrVal({ topSchemaRef, schemaPath }, schema4, keyword, $data) {
      if (!$data) {
        if (typeof schema4 == "number" || typeof schema4 == "boolean")
          return schema4;
        if (typeof schema4 == "string")
          return (0, codegen_1._)`${schema4}`;
      }
      return (0, codegen_1._)`${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
    }
    exports5.schemaRefOrVal = schemaRefOrVal;
    function unescapeFragment(str) {
      return unescapeJsonPointer(decodeURIComponent(str));
    }
    exports5.unescapeFragment = unescapeFragment;
    function escapeFragment(str) {
      return encodeURIComponent(escapeJsonPointer(str));
    }
    exports5.escapeFragment = escapeFragment;
    function escapeJsonPointer(str) {
      if (typeof str == "number")
        return `${str}`;
      return str.replace(/~/g, "~0").replace(/\//g, "~1");
    }
    exports5.escapeJsonPointer = escapeJsonPointer;
    function unescapeJsonPointer(str) {
      return str.replace(/~1/g, "/").replace(/~0/g, "~");
    }
    exports5.unescapeJsonPointer = unescapeJsonPointer;
    function eachItem(xs, f) {
      if (Array.isArray(xs)) {
        for (const x of xs)
          f(x);
      } else {
        f(xs);
      }
    }
    exports5.eachItem = eachItem;
    function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName }) {
      return (gen, from, to, toName) => {
        const res = to === void 0 ? from : to instanceof codegen_1.Name ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) : from instanceof codegen_1.Name ? (mergeToName(gen, to, from), from) : mergeValues(from, to);
        return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res;
      };
    }
    exports5.mergeEvaluated = {
      props: makeMergeEvaluated({
        mergeNames: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true && ${from} !== undefined`, () => {
          gen.if((0, codegen_1._)`${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._)`${to} || {}`).code((0, codegen_1._)`Object.assign(${to}, ${from})`));
        }),
        mergeToName: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true`, () => {
          if (from === true) {
            gen.assign(to, true);
          } else {
            gen.assign(to, (0, codegen_1._)`${to} || {}`);
            setEvaluated(gen, to, from);
          }
        }),
        mergeValues: (from, to) => from === true ? true : { ...from, ...to },
        resultToName: evaluatedPropsToName
      }),
      items: makeMergeEvaluated({
        mergeNames: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._)`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
        mergeToName: (gen, from, to) => gen.if((0, codegen_1._)`${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._)`${to} > ${from} ? ${to} : ${from}`)),
        mergeValues: (from, to) => from === true ? true : Math.max(from, to),
        resultToName: (gen, items) => gen.var("items", items)
      })
    };
    function evaluatedPropsToName(gen, ps) {
      if (ps === true)
        return gen.var("props", true);
      const props = gen.var("props", (0, codegen_1._)`{}`);
      if (ps !== void 0)
        setEvaluated(gen, props, ps);
      return props;
    }
    exports5.evaluatedPropsToName = evaluatedPropsToName;
    function setEvaluated(gen, props, ps) {
      Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._)`${props}${(0, codegen_1.getProperty)(p)}`, true));
    }
    exports5.setEvaluated = setEvaluated;
    var snippets = {};
    function useFunc(gen, f) {
      return gen.scopeValue("func", {
        ref: f,
        code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code))
      });
    }
    exports5.useFunc = useFunc;
    var Type;
    (function(Type2) {
      Type2[Type2["Num"] = 0] = "Num";
      Type2[Type2["Str"] = 1] = "Str";
    })(Type || (exports5.Type = Type = {}));
    function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
      if (dataProp instanceof codegen_1.Name) {
        const isNumber2 = dataPropType === Type.Num;
        return jsPropertySyntax ? isNumber2 ? (0, codegen_1._)`"[" + ${dataProp} + "]"` : (0, codegen_1._)`"['" + ${dataProp} + "']"` : isNumber2 ? (0, codegen_1._)`"/" + ${dataProp}` : (0, codegen_1._)`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`;
      }
      return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
    }
    exports5.getErrorPath = getErrorPath;
    function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
      if (!mode)
        return;
      msg = `strict mode: ${msg}`;
      if (mode === true)
        throw new Error(msg);
      it.self.logger.warn(msg);
    }
    exports5.checkStrictMode = checkStrictMode;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/names.js
var require_names = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/names.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var names = {
      // validation function arguments
      data: new codegen_1.Name("data"),
      // data passed to validation function
      // args passed from referencing schema
      valCxt: new codegen_1.Name("valCxt"),
      // validation/data context - should not be used directly, it is destructured to the names below
      instancePath: new codegen_1.Name("instancePath"),
      parentData: new codegen_1.Name("parentData"),
      parentDataProperty: new codegen_1.Name("parentDataProperty"),
      rootData: new codegen_1.Name("rootData"),
      // root data - same as the data passed to the first/top validation function
      dynamicAnchors: new codegen_1.Name("dynamicAnchors"),
      // used to support recursiveRef and dynamicRef
      // function scoped variables
      vErrors: new codegen_1.Name("vErrors"),
      // null or array of validation errors
      errors: new codegen_1.Name("errors"),
      // counter of validation errors
      this: new codegen_1.Name("this"),
      // "globals"
      self: new codegen_1.Name("self"),
      scope: new codegen_1.Name("scope"),
      // JTD serialize/parse name for JSON string and position
      json: new codegen_1.Name("json"),
      jsonPos: new codegen_1.Name("jsonPos"),
      jsonLen: new codegen_1.Name("jsonLen"),
      jsonPart: new codegen_1.Name("jsonPart")
    };
    exports5.default = names;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/errors.js
var require_errors = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/errors.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.extendErrors = exports5.resetErrorsCount = exports5.reportExtraError = exports5.reportError = exports5.keyword$DataError = exports5.keywordError = void 0;
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var names_1 = require_names();
    exports5.keywordError = {
      message: ({ keyword }) => (0, codegen_1.str)`must pass "${keyword}" keyword validation`
    };
    exports5.keyword$DataError = {
      message: ({ keyword, schemaType }) => schemaType ? (0, codegen_1.str)`"${keyword}" keyword must be ${schemaType} ($data)` : (0, codegen_1.str)`"${keyword}" keyword is invalid ($data)`
    };
    function reportError(cxt, error = exports5.keywordError, errorPaths, overrideAllErrors) {
      const { it } = cxt;
      const { gen, compositeRule, allErrors } = it;
      const errObj = errorObjectCode(cxt, error, errorPaths);
      if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : compositeRule || allErrors) {
        addError(gen, errObj);
      } else {
        returnErrors(it, (0, codegen_1._)`[${errObj}]`);
      }
    }
    exports5.reportError = reportError;
    function reportExtraError(cxt, error = exports5.keywordError, errorPaths) {
      const { it } = cxt;
      const { gen, compositeRule, allErrors } = it;
      const errObj = errorObjectCode(cxt, error, errorPaths);
      addError(gen, errObj);
      if (!(compositeRule || allErrors)) {
        returnErrors(it, names_1.default.vErrors);
      }
    }
    exports5.reportExtraError = reportExtraError;
    function resetErrorsCount(gen, errsCount) {
      gen.assign(names_1.default.errors, errsCount);
      gen.if((0, codegen_1._)`${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._)`${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null)));
    }
    exports5.resetErrorsCount = resetErrorsCount;
    function extendErrors({ gen, keyword, schemaValue, data, errsCount, it }) {
      if (errsCount === void 0)
        throw new Error("ajv implementation error");
      const err = gen.name("err");
      gen.forRange("i", errsCount, names_1.default.errors, (i) => {
        gen.const(err, (0, codegen_1._)`${names_1.default.vErrors}[${i}]`);
        gen.if((0, codegen_1._)`${err}.instancePath === undefined`, () => gen.assign((0, codegen_1._)`${err}.instancePath`, (0, codegen_1.strConcat)(names_1.default.instancePath, it.errorPath)));
        gen.assign((0, codegen_1._)`${err}.schemaPath`, (0, codegen_1.str)`${it.errSchemaPath}/${keyword}`);
        if (it.opts.verbose) {
          gen.assign((0, codegen_1._)`${err}.schema`, schemaValue);
          gen.assign((0, codegen_1._)`${err}.data`, data);
        }
      });
    }
    exports5.extendErrors = extendErrors;
    function addError(gen, errObj) {
      const err = gen.const("err", errObj);
      gen.if((0, codegen_1._)`${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._)`[${err}]`), (0, codegen_1._)`${names_1.default.vErrors}.push(${err})`);
      gen.code((0, codegen_1._)`${names_1.default.errors}++`);
    }
    function returnErrors(it, errs) {
      const { gen, validateName, schemaEnv } = it;
      if (schemaEnv.$async) {
        gen.throw((0, codegen_1._)`new ${it.ValidationError}(${errs})`);
      } else {
        gen.assign((0, codegen_1._)`${validateName}.errors`, errs);
        gen.return(false);
      }
    }
    var E = {
      keyword: new codegen_1.Name("keyword"),
      schemaPath: new codegen_1.Name("schemaPath"),
      // also used in JTD errors
      params: new codegen_1.Name("params"),
      propertyName: new codegen_1.Name("propertyName"),
      message: new codegen_1.Name("message"),
      schema: new codegen_1.Name("schema"),
      parentSchema: new codegen_1.Name("parentSchema")
    };
    function errorObjectCode(cxt, error, errorPaths) {
      const { createErrors } = cxt.it;
      if (createErrors === false)
        return (0, codegen_1._)`{}`;
      return errorObject(cxt, error, errorPaths);
    }
    function errorObject(cxt, error, errorPaths = {}) {
      const { gen, it } = cxt;
      const keyValues = [
        errorInstancePath(it, errorPaths),
        errorSchemaPath(cxt, errorPaths)
      ];
      extraErrorProps(cxt, error, keyValues);
      return gen.object(...keyValues);
    }
    function errorInstancePath({ errorPath }, { instancePath }) {
      const instPath = instancePath ? (0, codegen_1.str)`${errorPath}${(0, util_1.getErrorPath)(instancePath, util_1.Type.Str)}` : errorPath;
      return [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, instPath)];
    }
    function errorSchemaPath({ keyword, it: { errSchemaPath } }, { schemaPath, parentSchema }) {
      let schPath = parentSchema ? errSchemaPath : (0, codegen_1.str)`${errSchemaPath}/${keyword}`;
      if (schemaPath) {
        schPath = (0, codegen_1.str)`${schPath}${(0, util_1.getErrorPath)(schemaPath, util_1.Type.Str)}`;
      }
      return [E.schemaPath, schPath];
    }
    function extraErrorProps(cxt, { params, message }, keyValues) {
      const { keyword, data, schemaValue, it } = cxt;
      const { opts, propertyName, topSchemaRef, schemaPath } = it;
      keyValues.push([E.keyword, keyword], [E.params, typeof params == "function" ? params(cxt) : params || (0, codegen_1._)`{}`]);
      if (opts.messages) {
        keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]);
      }
      if (opts.verbose) {
        keyValues.push([E.schema, schemaValue], [E.parentSchema, (0, codegen_1._)`${topSchemaRef}${schemaPath}`], [names_1.default.data, data]);
      }
      if (propertyName)
        keyValues.push([E.propertyName, propertyName]);
    }
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/boolSchema.js
var require_boolSchema = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/boolSchema.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.boolOrEmptySchema = exports5.topBoolOrEmptySchema = void 0;
    var errors_1 = require_errors();
    var codegen_1 = require_codegen();
    var names_1 = require_names();
    var boolError = {
      message: "boolean schema is false"
    };
    function topBoolOrEmptySchema(it) {
      const { gen, schema: schema4, validateName } = it;
      if (schema4 === false) {
        falseSchemaError(it, false);
      } else if (typeof schema4 == "object" && schema4.$async === true) {
        gen.return(names_1.default.data);
      } else {
        gen.assign((0, codegen_1._)`${validateName}.errors`, null);
        gen.return(true);
      }
    }
    exports5.topBoolOrEmptySchema = topBoolOrEmptySchema;
    function boolOrEmptySchema(it, valid) {
      const { gen, schema: schema4 } = it;
      if (schema4 === false) {
        gen.var(valid, false);
        falseSchemaError(it);
      } else {
        gen.var(valid, true);
      }
    }
    exports5.boolOrEmptySchema = boolOrEmptySchema;
    function falseSchemaError(it, overrideAllErrors) {
      const { gen, data } = it;
      const cxt = {
        gen,
        keyword: "false schema",
        data,
        schema: false,
        schemaCode: false,
        schemaValue: false,
        params: {},
        it
      };
      (0, errors_1.reportError)(cxt, boolError, void 0, overrideAllErrors);
    }
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/rules.js
var require_rules = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/rules.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.getRules = exports5.isJSONType = void 0;
    var _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"];
    var jsonTypes = new Set(_jsonTypes);
    function isJSONType(x) {
      return typeof x == "string" && jsonTypes.has(x);
    }
    exports5.isJSONType = isJSONType;
    function getRules() {
      const groups = {
        number: { type: "number", rules: [] },
        string: { type: "string", rules: [] },
        array: { type: "array", rules: [] },
        object: { type: "object", rules: [] }
      };
      return {
        types: { ...groups, integer: true, boolean: true, null: true },
        rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object],
        post: { rules: [] },
        all: {},
        keywords: {}
      };
    }
    exports5.getRules = getRules;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/applicability.js
var require_applicability = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/applicability.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.shouldUseRule = exports5.shouldUseGroup = exports5.schemaHasRulesForType = void 0;
    function schemaHasRulesForType({ schema: schema4, self: self2 }, type) {
      const group = self2.RULES.types[type];
      return group && group !== true && shouldUseGroup(schema4, group);
    }
    exports5.schemaHasRulesForType = schemaHasRulesForType;
    function shouldUseGroup(schema4, group) {
      return group.rules.some((rule) => shouldUseRule(schema4, rule));
    }
    exports5.shouldUseGroup = shouldUseGroup;
    function shouldUseRule(schema4, rule) {
      var _a;
      return schema4[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema4[kwd] !== void 0));
    }
    exports5.shouldUseRule = shouldUseRule;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/dataType.js
var require_dataType = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/dataType.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.reportTypeError = exports5.checkDataTypes = exports5.checkDataType = exports5.coerceAndCheckDataType = exports5.getJSONTypes = exports5.getSchemaTypes = exports5.DataType = void 0;
    var rules_1 = require_rules();
    var applicability_1 = require_applicability();
    var errors_1 = require_errors();
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var DataType;
    (function(DataType2) {
      DataType2[DataType2["Correct"] = 0] = "Correct";
      DataType2[DataType2["Wrong"] = 1] = "Wrong";
    })(DataType || (exports5.DataType = DataType = {}));
    function getSchemaTypes(schema4) {
      const types2 = getJSONTypes(schema4.type);
      const hasNull = types2.includes("null");
      if (hasNull) {
        if (schema4.nullable === false)
          throw new Error("type: null contradicts nullable: false");
      } else {
        if (!types2.length && schema4.nullable !== void 0) {
          throw new Error('"nullable" cannot be used without "type"');
        }
        if (schema4.nullable === true)
          types2.push("null");
      }
      return types2;
    }
    exports5.getSchemaTypes = getSchemaTypes;
    function getJSONTypes(ts) {
      const types2 = Array.isArray(ts) ? ts : ts ? [ts] : [];
      if (types2.every(rules_1.isJSONType))
        return types2;
      throw new Error("type must be JSONType or JSONType[]: " + types2.join(","));
    }
    exports5.getJSONTypes = getJSONTypes;
    function coerceAndCheckDataType(it, types2) {
      const { gen, data, opts } = it;
      const coerceTo = coerceToTypes(types2, opts.coerceTypes);
      const checkTypes = types2.length > 0 && !(coerceTo.length === 0 && types2.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types2[0]));
      if (checkTypes) {
        const wrongType = checkDataTypes(types2, data, opts.strictNumbers, DataType.Wrong);
        gen.if(wrongType, () => {
          if (coerceTo.length)
            coerceData(it, types2, coerceTo);
          else
            reportTypeError(it);
        });
      }
      return checkTypes;
    }
    exports5.coerceAndCheckDataType = coerceAndCheckDataType;
    var COERCIBLE = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "null"]);
    function coerceToTypes(types2, coerceTypes) {
      return coerceTypes ? types2.filter((t) => COERCIBLE.has(t) || coerceTypes === "array" && t === "array") : [];
    }
    function coerceData(it, types2, coerceTo) {
      const { gen, data, opts } = it;
      const dataType = gen.let("dataType", (0, codegen_1._)`typeof ${data}`);
      const coerced = gen.let("coerced", (0, codegen_1._)`undefined`);
      if (opts.coerceTypes === "array") {
        gen.if((0, codegen_1._)`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen.assign(data, (0, codegen_1._)`${data}[0]`).assign(dataType, (0, codegen_1._)`typeof ${data}`).if(checkDataTypes(types2, data, opts.strictNumbers), () => gen.assign(coerced, data)));
      }
      gen.if((0, codegen_1._)`${coerced} !== undefined`);
      for (const t of coerceTo) {
        if (COERCIBLE.has(t) || t === "array" && opts.coerceTypes === "array") {
          coerceSpecificType(t);
        }
      }
      gen.else();
      reportTypeError(it);
      gen.endIf();
      gen.if((0, codegen_1._)`${coerced} !== undefined`, () => {
        gen.assign(data, coerced);
        assignParentData(it, coerced);
      });
      function coerceSpecificType(t) {
        switch (t) {
          case "string":
            gen.elseIf((0, codegen_1._)`${dataType} == "number" || ${dataType} == "boolean"`).assign(coerced, (0, codegen_1._)`"" + ${data}`).elseIf((0, codegen_1._)`${data} === null`).assign(coerced, (0, codegen_1._)`""`);
            return;
          case "number":
            gen.elseIf((0, codegen_1._)`${dataType} == "boolean" || ${data} === null
              || (${dataType} == "string" && ${data} && ${data} == +${data})`).assign(coerced, (0, codegen_1._)`+${data}`);
            return;
          case "integer":
            gen.elseIf((0, codegen_1._)`${dataType} === "boolean" || ${data} === null
              || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`).assign(coerced, (0, codegen_1._)`+${data}`);
            return;
          case "boolean":
            gen.elseIf((0, codegen_1._)`${data} === "false" || ${data} === 0 || ${data} === null`).assign(coerced, false).elseIf((0, codegen_1._)`${data} === "true" || ${data} === 1`).assign(coerced, true);
            return;
          case "null":
            gen.elseIf((0, codegen_1._)`${data} === "" || ${data} === 0 || ${data} === false`);
            gen.assign(coerced, null);
            return;
          case "array":
            gen.elseIf((0, codegen_1._)`${dataType} === "string" || ${dataType} === "number"
              || ${dataType} === "boolean" || ${data} === null`).assign(coerced, (0, codegen_1._)`[${data}]`);
        }
      }
    }
    function assignParentData({ gen, parentData, parentDataProperty }, expr) {
      gen.if((0, codegen_1._)`${parentData} !== undefined`, () => gen.assign((0, codegen_1._)`${parentData}[${parentDataProperty}]`, expr));
    }
    function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
      const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
      let cond;
      switch (dataType) {
        case "null":
          return (0, codegen_1._)`${data} ${EQ} null`;
        case "array":
          cond = (0, codegen_1._)`Array.isArray(${data})`;
          break;
        case "object":
          cond = (0, codegen_1._)`${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
          break;
        case "integer":
          cond = numCond((0, codegen_1._)`!(${data} % 1) && !isNaN(${data})`);
          break;
        case "number":
          cond = numCond();
          break;
        default:
          return (0, codegen_1._)`typeof ${data} ${EQ} ${dataType}`;
      }
      return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
      function numCond(_cond = codegen_1.nil) {
        return (0, codegen_1.and)((0, codegen_1._)`typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._)`isFinite(${data})` : codegen_1.nil);
      }
    }
    exports5.checkDataType = checkDataType;
    function checkDataTypes(dataTypes, data, strictNums, correct) {
      if (dataTypes.length === 1) {
        return checkDataType(dataTypes[0], data, strictNums, correct);
      }
      let cond;
      const types2 = (0, util_1.toHash)(dataTypes);
      if (types2.array && types2.object) {
        const notObj = (0, codegen_1._)`typeof ${data} != "object"`;
        cond = types2.null ? notObj : (0, codegen_1._)`!${data} || ${notObj}`;
        delete types2.null;
        delete types2.array;
        delete types2.object;
      } else {
        cond = codegen_1.nil;
      }
      if (types2.number)
        delete types2.integer;
      for (const t in types2)
        cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));
      return cond;
    }
    exports5.checkDataTypes = checkDataTypes;
    var typeError = {
      message: ({ schema: schema4 }) => `must be ${schema4}`,
      params: ({ schema: schema4, schemaValue }) => typeof schema4 == "string" ? (0, codegen_1._)`{type: ${schema4}}` : (0, codegen_1._)`{type: ${schemaValue}}`
    };
    function reportTypeError(it) {
      const cxt = getTypeErrorContext(it);
      (0, errors_1.reportError)(cxt, typeError);
    }
    exports5.reportTypeError = reportTypeError;
    function getTypeErrorContext(it) {
      const { gen, data, schema: schema4 } = it;
      const schemaCode = (0, util_1.schemaRefOrVal)(it, schema4, "type");
      return {
        gen,
        keyword: "type",
        data,
        schema: schema4.type,
        schemaCode,
        schemaValue: schemaCode,
        parentSchema: schema4,
        params: {},
        it
      };
    }
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/defaults.js
var require_defaults = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/defaults.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.assignDefaults = void 0;
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    function assignDefaults(it, ty) {
      const { properties, items } = it.schema;
      if (ty === "object" && properties) {
        for (const key in properties) {
          assignDefault(it, key, properties[key].default);
        }
      } else if (ty === "array" && Array.isArray(items)) {
        items.forEach((sch, i) => assignDefault(it, i, sch.default));
      }
    }
    exports5.assignDefaults = assignDefaults;
    function assignDefault(it, prop, defaultValue) {
      const { gen, compositeRule, data, opts } = it;
      if (defaultValue === void 0)
        return;
      const childData = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(prop)}`;
      if (compositeRule) {
        (0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`);
        return;
      }
      let condition = (0, codegen_1._)`${childData} === undefined`;
      if (opts.useDefaults === "empty") {
        condition = (0, codegen_1._)`${condition} || ${childData} === null || ${childData} === ""`;
      }
      gen.if(condition, (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
    }
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/code.js
var require_code2 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/code.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.validateUnion = exports5.validateArray = exports5.usePattern = exports5.callValidateCode = exports5.schemaProperties = exports5.allSchemaProperties = exports5.noPropertyInData = exports5.propertyInData = exports5.isOwnProperty = exports5.hasPropFunc = exports5.reportMissingProp = exports5.checkMissingProp = exports5.checkReportMissingProp = void 0;
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var names_1 = require_names();
    var util_2 = require_util2();
    function checkReportMissingProp(cxt, prop) {
      const { gen, data, it } = cxt;
      gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
        cxt.setParams({ missingProperty: (0, codegen_1._)`${prop}` }, true);
        cxt.error();
      });
    }
    exports5.checkReportMissingProp = checkReportMissingProp;
    function checkMissingProp({ gen, data, it: { opts } }, properties, missing) {
      return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._)`${missing} = ${prop}`)));
    }
    exports5.checkMissingProp = checkMissingProp;
    function reportMissingProp(cxt, missing) {
      cxt.setParams({ missingProperty: missing }, true);
      cxt.error();
    }
    exports5.reportMissingProp = reportMissingProp;
    function hasPropFunc(gen) {
      return gen.scopeValue("func", {
        // eslint-disable-next-line @typescript-eslint/unbound-method
        ref: Object.prototype.hasOwnProperty,
        code: (0, codegen_1._)`Object.prototype.hasOwnProperty`
      });
    }
    exports5.hasPropFunc = hasPropFunc;
    function isOwnProperty(gen, data, property) {
      return (0, codegen_1._)`${hasPropFunc(gen)}.call(${data}, ${property})`;
    }
    exports5.isOwnProperty = isOwnProperty;
    function propertyInData(gen, data, property, ownProperties) {
      const cond = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(property)} !== undefined`;
      return ownProperties ? (0, codegen_1._)`${cond} && ${isOwnProperty(gen, data, property)}` : cond;
    }
    exports5.propertyInData = propertyInData;
    function noPropertyInData(gen, data, property, ownProperties) {
      const cond = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(property)} === undefined`;
      return ownProperties ? (0, codegen_1.or)(cond, (0, codegen_1.not)(isOwnProperty(gen, data, property))) : cond;
    }
    exports5.noPropertyInData = noPropertyInData;
    function allSchemaProperties(schemaMap) {
      return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [];
    }
    exports5.allSchemaProperties = allSchemaProperties;
    function schemaProperties(it, schemaMap) {
      return allSchemaProperties(schemaMap).filter((p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p]));
    }
    exports5.schemaProperties = schemaProperties;
    function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) {
      const dataAndSchema = passSchema ? (0, codegen_1._)`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data;
      const valCxt = [
        [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, errorPath)],
        [names_1.default.parentData, it.parentData],
        [names_1.default.parentDataProperty, it.parentDataProperty],
        [names_1.default.rootData, names_1.default.rootData]
      ];
      if (it.opts.dynamicRef)
        valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]);
      const args = (0, codegen_1._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
      return context !== codegen_1.nil ? (0, codegen_1._)`${func}.call(${context}, ${args})` : (0, codegen_1._)`${func}(${args})`;
    }
    exports5.callValidateCode = callValidateCode;
    var newRegExp = (0, codegen_1._)`new RegExp`;
    function usePattern({ gen, it: { opts } }, pattern) {
      const u = opts.unicodeRegExp ? "u" : "";
      const { regExp } = opts.code;
      const rx = regExp(pattern, u);
      return gen.scopeValue("pattern", {
        key: rx.toString(),
        ref: rx,
        code: (0, codegen_1._)`${regExp.code === "new RegExp" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})`
      });
    }
    exports5.usePattern = usePattern;
    function validateArray(cxt) {
      const { gen, data, keyword, it } = cxt;
      const valid = gen.name("valid");
      if (it.allErrors) {
        const validArr = gen.let("valid", true);
        validateItems(() => gen.assign(validArr, false));
        return validArr;
      }
      gen.var(valid, true);
      validateItems(() => gen.break());
      return valid;
      function validateItems(notValid) {
        const len = gen.const("len", (0, codegen_1._)`${data}.length`);
        gen.forRange("i", 0, len, (i) => {
          cxt.subschema({
            keyword,
            dataProp: i,
            dataPropType: util_1.Type.Num
          }, valid);
          gen.if((0, codegen_1.not)(valid), notValid);
        });
      }
    }
    exports5.validateArray = validateArray;
    function validateUnion(cxt) {
      const { gen, schema: schema4, keyword, it } = cxt;
      if (!Array.isArray(schema4))
        throw new Error("ajv implementation error");
      const alwaysValid = schema4.some((sch) => (0, util_1.alwaysValidSchema)(it, sch));
      if (alwaysValid && !it.opts.unevaluated)
        return;
      const valid = gen.let("valid", false);
      const schValid = gen.name("_valid");
      gen.block(() => schema4.forEach((_sch, i) => {
        const schCxt = cxt.subschema({
          keyword,
          schemaProp: i,
          compositeRule: true
        }, schValid);
        gen.assign(valid, (0, codegen_1._)`${valid} || ${schValid}`);
        const merged = cxt.mergeValidEvaluated(schCxt, schValid);
        if (!merged)
          gen.if((0, codegen_1.not)(valid));
      }));
      cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
    }
    exports5.validateUnion = validateUnion;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/keyword.js
var require_keyword = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/keyword.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.validateKeywordUsage = exports5.validSchemaType = exports5.funcKeywordCode = exports5.macroKeywordCode = void 0;
    var codegen_1 = require_codegen();
    var names_1 = require_names();
    var code_1 = require_code2();
    var errors_1 = require_errors();
    function macroKeywordCode(cxt, def) {
      const { gen, keyword, schema: schema4, parentSchema, it } = cxt;
      const macroSchema = def.macro.call(it.self, schema4, parentSchema, it);
      const schemaRef = useKeyword(gen, keyword, macroSchema);
      if (it.opts.validateSchema !== false)
        it.self.validateSchema(macroSchema, true);
      const valid = gen.name("valid");
      cxt.subschema({
        schema: macroSchema,
        schemaPath: codegen_1.nil,
        errSchemaPath: `${it.errSchemaPath}/${keyword}`,
        topSchemaRef: schemaRef,
        compositeRule: true
      }, valid);
      cxt.pass(valid, () => cxt.error(true));
    }
    exports5.macroKeywordCode = macroKeywordCode;
    function funcKeywordCode(cxt, def) {
      var _a;
      const { gen, keyword, schema: schema4, parentSchema, $data, it } = cxt;
      checkAsyncKeyword(it, def);
      const validate = !$data && def.compile ? def.compile.call(it.self, schema4, parentSchema, it) : def.validate;
      const validateRef = useKeyword(gen, keyword, validate);
      const valid = gen.let("valid");
      cxt.block$data(valid, validateKeyword);
      cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);
      function validateKeyword() {
        if (def.errors === false) {
          assignValid();
          if (def.modifying)
            modifyData(cxt);
          reportErrs(() => cxt.error());
        } else {
          const ruleErrs = def.async ? validateAsync() : validateSync();
          if (def.modifying)
            modifyData(cxt);
          reportErrs(() => addErrs(cxt, ruleErrs));
        }
      }
      function validateAsync() {
        const ruleErrs = gen.let("ruleErrs", null);
        gen.try(() => assignValid((0, codegen_1._)`await `), (e) => gen.assign(valid, false).if((0, codegen_1._)`${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._)`${e}.errors`), () => gen.throw(e)));
        return ruleErrs;
      }
      function validateSync() {
        const validateErrs = (0, codegen_1._)`${validateRef}.errors`;
        gen.assign(validateErrs, null);
        assignValid(codegen_1.nil);
        return validateErrs;
      }
      function assignValid(_await = def.async ? (0, codegen_1._)`await ` : codegen_1.nil) {
        const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self;
        const passSchema = !("compile" in def && !$data || def.schema === false);
        gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
      }
      function reportErrs(errors) {
        var _a2;
        gen.if((0, codegen_1.not)((_a2 = def.valid) !== null && _a2 !== void 0 ? _a2 : valid), errors);
      }
    }
    exports5.funcKeywordCode = funcKeywordCode;
    function modifyData(cxt) {
      const { gen, data, it } = cxt;
      gen.if(it.parentData, () => gen.assign(data, (0, codegen_1._)`${it.parentData}[${it.parentDataProperty}]`));
    }
    function addErrs(cxt, errs) {
      const { gen } = cxt;
      gen.if((0, codegen_1._)`Array.isArray(${errs})`, () => {
        gen.assign(names_1.default.vErrors, (0, codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`).assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
        (0, errors_1.extendErrors)(cxt);
      }, () => cxt.error());
    }
    function checkAsyncKeyword({ schemaEnv }, def) {
      if (def.async && !schemaEnv.$async)
        throw new Error("async keyword in sync schema");
    }
    function useKeyword(gen, keyword, result) {
      if (result === void 0)
        throw new Error(`keyword "${keyword}" failed to compile`);
      return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) });
    }
    function validSchemaType(schema4, schemaType, allowUndefined = false) {
      return !schemaType.length || schemaType.some((st) => st === "array" ? Array.isArray(schema4) : st === "object" ? schema4 && typeof schema4 == "object" && !Array.isArray(schema4) : typeof schema4 == st || allowUndefined && typeof schema4 == "undefined");
    }
    exports5.validSchemaType = validSchemaType;
    function validateKeywordUsage({ schema: schema4, opts, self: self2, errSchemaPath }, def, keyword) {
      if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) {
        throw new Error("ajv implementation error");
      }
      const deps = def.dependencies;
      if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema4, kwd))) {
        throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`);
      }
      if (def.validateSchema) {
        const valid = def.validateSchema(schema4[keyword]);
        if (!valid) {
          const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + self2.errorsText(def.validateSchema.errors);
          if (opts.validateSchema === "log")
            self2.logger.error(msg);
          else
            throw new Error(msg);
        }
      }
    }
    exports5.validateKeywordUsage = validateKeywordUsage;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/subschema.js
var require_subschema = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/subschema.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.extendSubschemaMode = exports5.extendSubschemaData = exports5.getSubschema = void 0;
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    function getSubschema(it, { keyword, schemaProp, schema: schema4, schemaPath, errSchemaPath, topSchemaRef }) {
      if (keyword !== void 0 && schema4 !== void 0) {
        throw new Error('both "keyword" and "schema" passed, only one allowed');
      }
      if (keyword !== void 0) {
        const sch = it.schema[keyword];
        return schemaProp === void 0 ? {
          schema: sch,
          schemaPath: (0, codegen_1._)`${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}`,
          errSchemaPath: `${it.errSchemaPath}/${keyword}`
        } : {
          schema: sch[schemaProp],
          schemaPath: (0, codegen_1._)`${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}${(0, codegen_1.getProperty)(schemaProp)}`,
          errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`
        };
      }
      if (schema4 !== void 0) {
        if (schemaPath === void 0 || errSchemaPath === void 0 || topSchemaRef === void 0) {
          throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');
        }
        return {
          schema: schema4,
          schemaPath,
          topSchemaRef,
          errSchemaPath
        };
      }
      throw new Error('either "keyword" or "schema" must be passed');
    }
    exports5.getSubschema = getSubschema;
    function extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) {
      if (data !== void 0 && dataProp !== void 0) {
        throw new Error('both "data" and "dataProp" passed, only one allowed');
      }
      const { gen } = it;
      if (dataProp !== void 0) {
        const { errorPath, dataPathArr, opts } = it;
        const nextData = gen.let("data", (0, codegen_1._)`${it.data}${(0, codegen_1.getProperty)(dataProp)}`, true);
        dataContextProps(nextData);
        subschema.errorPath = (0, codegen_1.str)`${errorPath}${(0, util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`;
        subschema.parentDataProperty = (0, codegen_1._)`${dataProp}`;
        subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty];
      }
      if (data !== void 0) {
        const nextData = data instanceof codegen_1.Name ? data : gen.let("data", data, true);
        dataContextProps(nextData);
        if (propertyName !== void 0)
          subschema.propertyName = propertyName;
      }
      if (dataTypes)
        subschema.dataTypes = dataTypes;
      function dataContextProps(_nextData) {
        subschema.data = _nextData;
        subschema.dataLevel = it.dataLevel + 1;
        subschema.dataTypes = [];
        it.definedProperties = /* @__PURE__ */ new Set();
        subschema.parentData = it.data;
        subschema.dataNames = [...it.dataNames, _nextData];
      }
    }
    exports5.extendSubschemaData = extendSubschemaData;
    function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) {
      if (compositeRule !== void 0)
        subschema.compositeRule = compositeRule;
      if (createErrors !== void 0)
        subschema.createErrors = createErrors;
      if (allErrors !== void 0)
        subschema.allErrors = allErrors;
      subschema.jtdDiscriminator = jtdDiscriminator;
      subschema.jtdMetadata = jtdMetadata;
    }
    exports5.extendSubschemaMode = extendSubschemaMode;
  }
});

// src/typespec/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js
var require_fast_deep_equal = __commonJS({
  "src/typespec/node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js"(exports5, module) {
    "use strict";
    module.exports = function equal(a, b) {
      if (a === b) return true;
      if (a && b && typeof a == "object" && typeof b == "object") {
        if (a.constructor !== b.constructor) return false;
        var length, i, keys;
        if (Array.isArray(a)) {
          length = a.length;
          if (length != b.length) return false;
          for (i = length; i-- !== 0; )
            if (!equal(a[i], b[i])) return false;
          return true;
        }
        if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
        if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
        if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
        keys = Object.keys(a);
        length = keys.length;
        if (length !== Object.keys(b).length) return false;
        for (i = length; i-- !== 0; )
          if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
        for (i = length; i-- !== 0; ) {
          var key = keys[i];
          if (!equal(a[key], b[key])) return false;
        }
        return true;
      }
      return a !== a && b !== b;
    };
  }
});

// src/typespec/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js
var require_json_schema_traverse = __commonJS({
  "src/typespec/node_modules/.pnpm/json-schema-traverse@1.0.0/node_modules/json-schema-traverse/index.js"(exports5, module) {
    "use strict";
    var traverse = module.exports = function(schema4, opts, cb) {
      if (typeof opts == "function") {
        cb = opts;
        opts = {};
      }
      cb = opts.cb || cb;
      var pre = typeof cb == "function" ? cb : cb.pre || function() {
      };
      var post = cb.post || function() {
      };
      _traverse(opts, pre, post, schema4, "", schema4);
    };
    traverse.keywords = {
      additionalItems: true,
      items: true,
      contains: true,
      additionalProperties: true,
      propertyNames: true,
      not: true,
      if: true,
      then: true,
      else: true
    };
    traverse.arrayKeywords = {
      items: true,
      allOf: true,
      anyOf: true,
      oneOf: true
    };
    traverse.propsKeywords = {
      $defs: true,
      definitions: true,
      properties: true,
      patternProperties: true,
      dependencies: true
    };
    traverse.skipKeywords = {
      default: true,
      enum: true,
      const: true,
      required: true,
      maximum: true,
      minimum: true,
      exclusiveMaximum: true,
      exclusiveMinimum: true,
      multipleOf: true,
      maxLength: true,
      minLength: true,
      pattern: true,
      format: true,
      maxItems: true,
      minItems: true,
      uniqueItems: true,
      maxProperties: true,
      minProperties: true
    };
    function _traverse(opts, pre, post, schema4, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
      if (schema4 && typeof schema4 == "object" && !Array.isArray(schema4)) {
        pre(schema4, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
        for (var key in schema4) {
          var sch = schema4[key];
          if (Array.isArray(sch)) {
            if (key in traverse.arrayKeywords) {
              for (var i = 0; i < sch.length; i++)
                _traverse(opts, pre, post, sch[i], jsonPtr + "/" + key + "/" + i, rootSchema, jsonPtr, key, schema4, i);
            }
          } else if (key in traverse.propsKeywords) {
            if (sch && typeof sch == "object") {
              for (var prop in sch)
                _traverse(opts, pre, post, sch[prop], jsonPtr + "/" + key + "/" + escapeJsonPtr(prop), rootSchema, jsonPtr, key, schema4, prop);
            }
          } else if (key in traverse.keywords || opts.allKeys && !(key in traverse.skipKeywords)) {
            _traverse(opts, pre, post, sch, jsonPtr + "/" + key, rootSchema, jsonPtr, key, schema4);
          }
        }
        post(schema4, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex);
      }
    }
    function escapeJsonPtr(str) {
      return str.replace(/~/g, "~0").replace(/\//g, "~1");
    }
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/resolve.js
var require_resolve = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/resolve.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.getSchemaRefs = exports5.resolveUrl = exports5.normalizeId = exports5._getFullPath = exports5.getFullPath = exports5.inlineRef = void 0;
    var util_1 = require_util2();
    var equal = require_fast_deep_equal();
    var traverse = require_json_schema_traverse();
    var SIMPLE_INLINED = /* @__PURE__ */ new Set([
      "type",
      "format",
      "pattern",
      "maxLength",
      "minLength",
      "maxProperties",
      "minProperties",
      "maxItems",
      "minItems",
      "maximum",
      "minimum",
      "uniqueItems",
      "multipleOf",
      "required",
      "enum",
      "const"
    ]);
    function inlineRef(schema4, limit = true) {
      if (typeof schema4 == "boolean")
        return true;
      if (limit === true)
        return !hasRef(schema4);
      if (!limit)
        return false;
      return countKeys(schema4) <= limit;
    }
    exports5.inlineRef = inlineRef;
    var REF_KEYWORDS = /* @__PURE__ */ new Set([
      "$ref",
      "$recursiveRef",
      "$recursiveAnchor",
      "$dynamicRef",
      "$dynamicAnchor"
    ]);
    function hasRef(schema4) {
      for (const key in schema4) {
        if (REF_KEYWORDS.has(key))
          return true;
        const sch = schema4[key];
        if (Array.isArray(sch) && sch.some(hasRef))
          return true;
        if (typeof sch == "object" && hasRef(sch))
          return true;
      }
      return false;
    }
    function countKeys(schema4) {
      let count = 0;
      for (const key in schema4) {
        if (key === "$ref")
          return Infinity;
        count++;
        if (SIMPLE_INLINED.has(key))
          continue;
        if (typeof schema4[key] == "object") {
          (0, util_1.eachItem)(schema4[key], (sch) => count += countKeys(sch));
        }
        if (count === Infinity)
          return Infinity;
      }
      return count;
    }
    function getFullPath(resolver, id = "", normalize2) {
      if (normalize2 !== false)
        id = normalizeId(id);
      const p = resolver.parse(id);
      return _getFullPath(resolver, p);
    }
    exports5.getFullPath = getFullPath;
    function _getFullPath(resolver, p) {
      const serialized = resolver.serialize(p);
      return serialized.split("#")[0] + "#";
    }
    exports5._getFullPath = _getFullPath;
    var TRAILING_SLASH_HASH = /#\/?$/;
    function normalizeId(id) {
      return id ? id.replace(TRAILING_SLASH_HASH, "") : "";
    }
    exports5.normalizeId = normalizeId;
    function resolveUrl(resolver, baseId, id) {
      id = normalizeId(id);
      return resolver.resolve(baseId, id);
    }
    exports5.resolveUrl = resolveUrl;
    var ANCHOR = /^[a-z_][-a-z0-9._]*$/i;
    function getSchemaRefs(schema4, baseId) {
      if (typeof schema4 == "boolean")
        return {};
      const { schemaId, uriResolver } = this.opts;
      const schId = normalizeId(schema4[schemaId] || baseId);
      const baseIds = { "": schId };
      const pathPrefix = getFullPath(uriResolver, schId, false);
      const localRefs = {};
      const schemaRefs = /* @__PURE__ */ new Set();
      traverse(schema4, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => {
        if (parentJsonPtr === void 0)
          return;
        const fullPath = pathPrefix + jsonPtr;
        let innerBaseId = baseIds[parentJsonPtr];
        if (typeof sch[schemaId] == "string")
          innerBaseId = addRef.call(this, sch[schemaId]);
        addAnchor.call(this, sch.$anchor);
        addAnchor.call(this, sch.$dynamicAnchor);
        baseIds[jsonPtr] = innerBaseId;
        function addRef(ref) {
          const _resolve = this.opts.uriResolver.resolve;
          ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref);
          if (schemaRefs.has(ref))
            throw ambiguos(ref);
          schemaRefs.add(ref);
          let schOrRef = this.refs[ref];
          if (typeof schOrRef == "string")
            schOrRef = this.refs[schOrRef];
          if (typeof schOrRef == "object") {
            checkAmbiguosRef(sch, schOrRef.schema, ref);
          } else if (ref !== normalizeId(fullPath)) {
            if (ref[0] === "#") {
              checkAmbiguosRef(sch, localRefs[ref], ref);
              localRefs[ref] = sch;
            } else {
              this.refs[ref] = fullPath;
            }
          }
          return ref;
        }
        function addAnchor(anchor) {
          if (typeof anchor == "string") {
            if (!ANCHOR.test(anchor))
              throw new Error(`invalid anchor "${anchor}"`);
            addRef.call(this, `#${anchor}`);
          }
        }
      });
      return localRefs;
      function checkAmbiguosRef(sch1, sch2, ref) {
        if (sch2 !== void 0 && !equal(sch1, sch2))
          throw ambiguos(ref);
      }
      function ambiguos(ref) {
        return new Error(`reference "${ref}" resolves to more than one schema`);
      }
    }
    exports5.getSchemaRefs = getSchemaRefs;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/index.js
var require_validate = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/validate/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.getData = exports5.KeywordCxt = exports5.validateFunctionCode = void 0;
    var boolSchema_1 = require_boolSchema();
    var dataType_1 = require_dataType();
    var applicability_1 = require_applicability();
    var dataType_2 = require_dataType();
    var defaults_1 = require_defaults();
    var keyword_1 = require_keyword();
    var subschema_1 = require_subschema();
    var codegen_1 = require_codegen();
    var names_1 = require_names();
    var resolve_1 = require_resolve();
    var util_1 = require_util2();
    var errors_1 = require_errors();
    function validateFunctionCode(it) {
      if (isSchemaObj(it)) {
        checkKeywords(it);
        if (schemaCxtHasRules(it)) {
          topSchemaObjCode(it);
          return;
        }
      }
      validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it));
    }
    exports5.validateFunctionCode = validateFunctionCode;
    function validateFunction({ gen, validateName, schema: schema4, schemaEnv, opts }, body) {
      if (opts.code.es5) {
        gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => {
          gen.code((0, codegen_1._)`"use strict"; ${funcSourceUrl(schema4, opts)}`);
          destructureValCxtES5(gen, opts);
          gen.code(body);
        });
      } else {
        gen.func(validateName, (0, codegen_1._)`${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema4, opts)).code(body));
      }
    }
    function destructureValCxt(opts) {
      return (0, codegen_1._)`{${names_1.default.instancePath}="", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? (0, codegen_1._)`, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`;
    }
    function destructureValCxtES5(gen, opts) {
      gen.if(names_1.default.valCxt, () => {
        gen.var(names_1.default.instancePath, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.instancePath}`);
        gen.var(names_1.default.parentData, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.parentData}`);
        gen.var(names_1.default.parentDataProperty, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.parentDataProperty}`);
        gen.var(names_1.default.rootData, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.rootData}`);
        if (opts.dynamicRef)
          gen.var(names_1.default.dynamicAnchors, (0, codegen_1._)`${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`);
      }, () => {
        gen.var(names_1.default.instancePath, (0, codegen_1._)`""`);
        gen.var(names_1.default.parentData, (0, codegen_1._)`undefined`);
        gen.var(names_1.default.parentDataProperty, (0, codegen_1._)`undefined`);
        gen.var(names_1.default.rootData, names_1.default.data);
        if (opts.dynamicRef)
          gen.var(names_1.default.dynamicAnchors, (0, codegen_1._)`{}`);
      });
    }
    function topSchemaObjCode(it) {
      const { schema: schema4, opts, gen } = it;
      validateFunction(it, () => {
        if (opts.$comment && schema4.$comment)
          commentKeyword(it);
        checkNoDefault(it);
        gen.let(names_1.default.vErrors, null);
        gen.let(names_1.default.errors, 0);
        if (opts.unevaluated)
          resetEvaluated(it);
        typeAndKeywords(it);
        returnResults(it);
      });
      return;
    }
    function resetEvaluated(it) {
      const { gen, validateName } = it;
      it.evaluated = gen.const("evaluated", (0, codegen_1._)`${validateName}.evaluated`);
      gen.if((0, codegen_1._)`${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._)`${it.evaluated}.props`, (0, codegen_1._)`undefined`));
      gen.if((0, codegen_1._)`${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._)`${it.evaluated}.items`, (0, codegen_1._)`undefined`));
    }
    function funcSourceUrl(schema4, opts) {
      const schId = typeof schema4 == "object" && schema4[opts.schemaId];
      return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._)`/*# sourceURL=${schId} */` : codegen_1.nil;
    }
    function subschemaCode(it, valid) {
      if (isSchemaObj(it)) {
        checkKeywords(it);
        if (schemaCxtHasRules(it)) {
          subSchemaObjCode(it, valid);
          return;
        }
      }
      (0, boolSchema_1.boolOrEmptySchema)(it, valid);
    }
    function schemaCxtHasRules({ schema: schema4, self: self2 }) {
      if (typeof schema4 == "boolean")
        return !schema4;
      for (const key in schema4)
        if (self2.RULES.all[key])
          return true;
      return false;
    }
    function isSchemaObj(it) {
      return typeof it.schema != "boolean";
    }
    function subSchemaObjCode(it, valid) {
      const { schema: schema4, gen, opts } = it;
      if (opts.$comment && schema4.$comment)
        commentKeyword(it);
      updateContext(it);
      checkAsyncSchema(it);
      const errsCount = gen.const("_errs", names_1.default.errors);
      typeAndKeywords(it, errsCount);
      gen.var(valid, (0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
    }
    function checkKeywords(it) {
      (0, util_1.checkUnknownRules)(it);
      checkRefsAndKeywords(it);
    }
    function typeAndKeywords(it, errsCount) {
      if (it.opts.jtd)
        return schemaKeywords(it, [], false, errsCount);
      const types2 = (0, dataType_1.getSchemaTypes)(it.schema);
      const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types2);
      schemaKeywords(it, types2, !checkedTypes, errsCount);
    }
    function checkRefsAndKeywords(it) {
      const { schema: schema4, errSchemaPath, opts, self: self2 } = it;
      if (schema4.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema4, self2.RULES)) {
        self2.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`);
      }
    }
    function checkNoDefault(it) {
      const { schema: schema4, opts } = it;
      if (schema4.default !== void 0 && opts.useDefaults && opts.strictSchema) {
        (0, util_1.checkStrictMode)(it, "default is ignored in the schema root");
      }
    }
    function updateContext(it) {
      const schId = it.schema[it.opts.schemaId];
      if (schId)
        it.baseId = (0, resolve_1.resolveUrl)(it.opts.uriResolver, it.baseId, schId);
    }
    function checkAsyncSchema(it) {
      if (it.schema.$async && !it.schemaEnv.$async)
        throw new Error("async schema in sync schema");
    }
    function commentKeyword({ gen, schemaEnv, schema: schema4, errSchemaPath, opts }) {
      const msg = schema4.$comment;
      if (opts.$comment === true) {
        gen.code((0, codegen_1._)`${names_1.default.self}.logger.log(${msg})`);
      } else if (typeof opts.$comment == "function") {
        const schemaPath = (0, codegen_1.str)`${errSchemaPath}/$comment`;
        const rootName = gen.scopeValue("root", { ref: schemaEnv.root });
        gen.code((0, codegen_1._)`${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`);
      }
    }
    function returnResults(it) {
      const { gen, schemaEnv, validateName, ValidationError, opts } = it;
      if (schemaEnv.$async) {
        gen.if((0, codegen_1._)`${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._)`new ${ValidationError}(${names_1.default.vErrors})`));
      } else {
        gen.assign((0, codegen_1._)`${validateName}.errors`, names_1.default.vErrors);
        if (opts.unevaluated)
          assignEvaluated(it);
        gen.return((0, codegen_1._)`${names_1.default.errors} === 0`);
      }
    }
    function assignEvaluated({ gen, evaluated, props, items }) {
      if (props instanceof codegen_1.Name)
        gen.assign((0, codegen_1._)`${evaluated}.props`, props);
      if (items instanceof codegen_1.Name)
        gen.assign((0, codegen_1._)`${evaluated}.items`, items);
    }
    function schemaKeywords(it, types2, typeErrors, errsCount) {
      const { gen, schema: schema4, data, allErrors, opts, self: self2 } = it;
      const { RULES } = self2;
      if (schema4.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema4, RULES))) {
        gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition));
        return;
      }
      if (!opts.jtd)
        checkStrictTypes(it, types2);
      gen.block(() => {
        for (const group of RULES.rules)
          groupKeywords(group);
        groupKeywords(RULES.post);
      });
      function groupKeywords(group) {
        if (!(0, applicability_1.shouldUseGroup)(schema4, group))
          return;
        if (group.type) {
          gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers));
          iterateKeywords(it, group);
          if (types2.length === 1 && types2[0] === group.type && typeErrors) {
            gen.else();
            (0, dataType_2.reportTypeError)(it);
          }
          gen.endIf();
        } else {
          iterateKeywords(it, group);
        }
        if (!allErrors)
          gen.if((0, codegen_1._)`${names_1.default.errors} === ${errsCount || 0}`);
      }
    }
    function iterateKeywords(it, group) {
      const { gen, schema: schema4, opts: { useDefaults } } = it;
      if (useDefaults)
        (0, defaults_1.assignDefaults)(it, group.type);
      gen.block(() => {
        for (const rule of group.rules) {
          if ((0, applicability_1.shouldUseRule)(schema4, rule)) {
            keywordCode(it, rule.keyword, rule.definition, group.type);
          }
        }
      });
    }
    function checkStrictTypes(it, types2) {
      if (it.schemaEnv.meta || !it.opts.strictTypes)
        return;
      checkContextTypes(it, types2);
      if (!it.opts.allowUnionTypes)
        checkMultipleTypes(it, types2);
      checkKeywordTypes(it, it.dataTypes);
    }
    function checkContextTypes(it, types2) {
      if (!types2.length)
        return;
      if (!it.dataTypes.length) {
        it.dataTypes = types2;
        return;
      }
      types2.forEach((t) => {
        if (!includesType(it.dataTypes, t)) {
          strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
        }
      });
      narrowSchemaTypes(it, types2);
    }
    function checkMultipleTypes(it, ts) {
      if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
        strictTypesError(it, "use allowUnionTypes to allow union type keyword");
      }
    }
    function checkKeywordTypes(it, ts) {
      const rules = it.self.RULES.all;
      for (const keyword in rules) {
        const rule = rules[keyword];
        if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) {
          const { type } = rule.definition;
          if (type.length && !type.some((t) => hasApplicableType(ts, t))) {
            strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`);
          }
        }
      }
    }
    function hasApplicableType(schTs, kwdT) {
      return schTs.includes(kwdT) || kwdT === "number" && schTs.includes("integer");
    }
    function includesType(ts, t) {
      return ts.includes(t) || t === "integer" && ts.includes("number");
    }
    function narrowSchemaTypes(it, withTypes) {
      const ts = [];
      for (const t of it.dataTypes) {
        if (includesType(withTypes, t))
          ts.push(t);
        else if (withTypes.includes("integer") && t === "number")
          ts.push("integer");
      }
      it.dataTypes = ts;
    }
    function strictTypesError(it, msg) {
      const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
      msg += ` at "${schemaPath}" (strictTypes)`;
      (0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes);
    }
    var KeywordCxt = class {
      constructor(it, def, keyword) {
        (0, keyword_1.validateKeywordUsage)(it, def, keyword);
        this.gen = it.gen;
        this.allErrors = it.allErrors;
        this.keyword = keyword;
        this.data = it.data;
        this.schema = it.schema[keyword];
        this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data;
        this.schemaValue = (0, util_1.schemaRefOrVal)(it, this.schema, keyword, this.$data);
        this.schemaType = def.schemaType;
        this.parentSchema = it.schema;
        this.params = {};
        this.it = it;
        this.def = def;
        if (this.$data) {
          this.schemaCode = it.gen.const("vSchema", getData(this.$data, it));
        } else {
          this.schemaCode = this.schemaValue;
          if (!(0, keyword_1.validSchemaType)(this.schema, def.schemaType, def.allowUndefined)) {
            throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`);
          }
        }
        if ("code" in def ? def.trackErrors : def.errors !== false) {
          this.errsCount = it.gen.const("_errs", names_1.default.errors);
        }
      }
      result(condition, successAction, failAction) {
        this.failResult((0, codegen_1.not)(condition), successAction, failAction);
      }
      failResult(condition, successAction, failAction) {
        this.gen.if(condition);
        if (failAction)
          failAction();
        else
          this.error();
        if (successAction) {
          this.gen.else();
          successAction();
          if (this.allErrors)
            this.gen.endIf();
        } else {
          if (this.allErrors)
            this.gen.endIf();
          else
            this.gen.else();
        }
      }
      pass(condition, failAction) {
        this.failResult((0, codegen_1.not)(condition), void 0, failAction);
      }
      fail(condition) {
        if (condition === void 0) {
          this.error();
          if (!this.allErrors)
            this.gen.if(false);
          return;
        }
        this.gen.if(condition);
        this.error();
        if (this.allErrors)
          this.gen.endIf();
        else
          this.gen.else();
      }
      fail$data(condition) {
        if (!this.$data)
          return this.fail(condition);
        const { schemaCode } = this;
        this.fail((0, codegen_1._)`${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`);
      }
      error(append, errorParams, errorPaths) {
        if (errorParams) {
          this.setParams(errorParams);
          this._error(append, errorPaths);
          this.setParams({});
          return;
        }
        this._error(append, errorPaths);
      }
      _error(append, errorPaths) {
        ;
        (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths);
      }
      $dataError() {
        (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError);
      }
      reset() {
        if (this.errsCount === void 0)
          throw new Error('add "trackErrors" to keyword definition');
        (0, errors_1.resetErrorsCount)(this.gen, this.errsCount);
      }
      ok(cond) {
        if (!this.allErrors)
          this.gen.if(cond);
      }
      setParams(obj, assign) {
        if (assign)
          Object.assign(this.params, obj);
        else
          this.params = obj;
      }
      block$data(valid, codeBlock, $dataValid = codegen_1.nil) {
        this.gen.block(() => {
          this.check$data(valid, $dataValid);
          codeBlock();
        });
      }
      check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) {
        if (!this.$data)
          return;
        const { gen, schemaCode, schemaType, def } = this;
        gen.if((0, codegen_1.or)((0, codegen_1._)`${schemaCode} === undefined`, $dataValid));
        if (valid !== codegen_1.nil)
          gen.assign(valid, true);
        if (schemaType.length || def.validateSchema) {
          gen.elseIf(this.invalid$data());
          this.$dataError();
          if (valid !== codegen_1.nil)
            gen.assign(valid, false);
        }
        gen.else();
      }
      invalid$data() {
        const { gen, schemaCode, schemaType, def, it } = this;
        return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema());
        function wrong$DataType() {
          if (schemaType.length) {
            if (!(schemaCode instanceof codegen_1.Name))
              throw new Error("ajv implementation error");
            const st = Array.isArray(schemaType) ? schemaType : [schemaType];
            return (0, codegen_1._)`${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`;
          }
          return codegen_1.nil;
        }
        function invalid$DataSchema() {
          if (def.validateSchema) {
            const validateSchemaRef = gen.scopeValue("validate$data", { ref: def.validateSchema });
            return (0, codegen_1._)`!${validateSchemaRef}(${schemaCode})`;
          }
          return codegen_1.nil;
        }
      }
      subschema(appl, valid) {
        const subschema = (0, subschema_1.getSubschema)(this.it, appl);
        (0, subschema_1.extendSubschemaData)(subschema, this.it, appl);
        (0, subschema_1.extendSubschemaMode)(subschema, appl);
        const nextContext = { ...this.it, ...subschema, items: void 0, props: void 0 };
        subschemaCode(nextContext, valid);
        return nextContext;
      }
      mergeEvaluated(schemaCxt, toName) {
        const { it, gen } = this;
        if (!it.opts.unevaluated)
          return;
        if (it.props !== true && schemaCxt.props !== void 0) {
          it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName);
        }
        if (it.items !== true && schemaCxt.items !== void 0) {
          it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName);
        }
      }
      mergeValidEvaluated(schemaCxt, valid) {
        const { it, gen } = this;
        if (it.opts.unevaluated && (it.props !== true || it.items !== true)) {
          gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name));
          return true;
        }
      }
    };
    exports5.KeywordCxt = KeywordCxt;
    function keywordCode(it, keyword, def, ruleType) {
      const cxt = new KeywordCxt(it, def, keyword);
      if ("code" in def) {
        def.code(cxt, ruleType);
      } else if (cxt.$data && def.validate) {
        (0, keyword_1.funcKeywordCode)(cxt, def);
      } else if ("macro" in def) {
        (0, keyword_1.macroKeywordCode)(cxt, def);
      } else if (def.compile || def.validate) {
        (0, keyword_1.funcKeywordCode)(cxt, def);
      }
    }
    var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
    var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
    function getData($data, { dataLevel, dataNames, dataPathArr }) {
      let jsonPointer;
      let data;
      if ($data === "")
        return names_1.default.rootData;
      if ($data[0] === "/") {
        if (!JSON_POINTER.test($data))
          throw new Error(`Invalid JSON-pointer: ${$data}`);
        jsonPointer = $data;
        data = names_1.default.rootData;
      } else {
        const matches = RELATIVE_JSON_POINTER.exec($data);
        if (!matches)
          throw new Error(`Invalid JSON-pointer: ${$data}`);
        const up = +matches[1];
        jsonPointer = matches[2];
        if (jsonPointer === "#") {
          if (up >= dataLevel)
            throw new Error(errorMsg("property/index", up));
          return dataPathArr[dataLevel - up];
        }
        if (up > dataLevel)
          throw new Error(errorMsg("data", up));
        data = dataNames[dataLevel - up];
        if (!jsonPointer)
          return data;
      }
      let expr = data;
      const segments = jsonPointer.split("/");
      for (const segment of segments) {
        if (segment) {
          data = (0, codegen_1._)`${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`;
          expr = (0, codegen_1._)`${expr} && ${data}`;
        }
      }
      return expr;
      function errorMsg(pointerType, up) {
        return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`;
      }
    }
    exports5.getData = getData;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/runtime/validation_error.js
var require_validation_error = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/runtime/validation_error.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var ValidationError = class extends Error {
      constructor(errors) {
        super("validation failed");
        this.errors = errors;
        this.ajv = this.validation = true;
      }
    };
    exports5.default = ValidationError;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/ref_error.js
var require_ref_error = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/ref_error.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var resolve_1 = require_resolve();
    var MissingRefError = class extends Error {
      constructor(resolver, baseId, ref, msg) {
        super(msg || `can't resolve reference ${ref} from id ${baseId}`);
        this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref);
        this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef));
      }
    };
    exports5.default = MissingRefError;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/index.js
var require_compile = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/compile/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.resolveSchema = exports5.getCompilingSchema = exports5.resolveRef = exports5.compileSchema = exports5.SchemaEnv = void 0;
    var codegen_1 = require_codegen();
    var validation_error_1 = require_validation_error();
    var names_1 = require_names();
    var resolve_1 = require_resolve();
    var util_1 = require_util2();
    var validate_1 = require_validate();
    var SchemaEnv = class {
      constructor(env3) {
        var _a;
        this.refs = {};
        this.dynamicAnchors = {};
        let schema4;
        if (typeof env3.schema == "object")
          schema4 = env3.schema;
        this.schema = env3.schema;
        this.schemaId = env3.schemaId;
        this.root = env3.root || this;
        this.baseId = (_a = env3.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema4 === null || schema4 === void 0 ? void 0 : schema4[env3.schemaId || "$id"]);
        this.schemaPath = env3.schemaPath;
        this.localRefs = env3.localRefs;
        this.meta = env3.meta;
        this.$async = schema4 === null || schema4 === void 0 ? void 0 : schema4.$async;
        this.refs = {};
      }
    };
    exports5.SchemaEnv = SchemaEnv;
    function compileSchema(sch) {
      const _sch = getCompilingSchema.call(this, sch);
      if (_sch)
        return _sch;
      const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId);
      const { es5, lines } = this.opts.code;
      const { ownProperties } = this.opts;
      const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties });
      let _ValidationError;
      if (sch.$async) {
        _ValidationError = gen.scopeValue("Error", {
          ref: validation_error_1.default,
          code: (0, codegen_1._)`require("ajv/dist/runtime/validation_error").default`
        });
      }
      const validateName = gen.scopeName("validate");
      sch.validateName = validateName;
      const schemaCxt = {
        gen,
        allErrors: this.opts.allErrors,
        data: names_1.default.data,
        parentData: names_1.default.parentData,
        parentDataProperty: names_1.default.parentDataProperty,
        dataNames: [names_1.default.data],
        dataPathArr: [codegen_1.nil],
        // TODO can its length be used as dataLevel if nil is removed?
        dataLevel: 0,
        dataTypes: [],
        definedProperties: /* @__PURE__ */ new Set(),
        topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) } : { ref: sch.schema }),
        validateName,
        ValidationError: _ValidationError,
        schema: sch.schema,
        schemaEnv: sch,
        rootId,
        baseId: sch.baseId || rootId,
        schemaPath: codegen_1.nil,
        errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"),
        errorPath: (0, codegen_1._)`""`,
        opts: this.opts,
        self: this
      };
      let sourceCode;
      try {
        this._compilations.add(sch);
        (0, validate_1.validateFunctionCode)(schemaCxt);
        gen.optimize(this.opts.code.optimize);
        const validateCode = gen.toString();
        sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`;
        if (this.opts.code.process)
          sourceCode = this.opts.code.process(sourceCode, sch);
        const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode);
        const validate = makeValidate(this, this.scope.get());
        this.scope.value(validateName, { ref: validate });
        validate.errors = null;
        validate.schema = sch.schema;
        validate.schemaEnv = sch;
        if (sch.$async)
          validate.$async = true;
        if (this.opts.code.source === true) {
          validate.source = { validateName, validateCode, scopeValues: gen._values };
        }
        if (this.opts.unevaluated) {
          const { props, items } = schemaCxt;
          validate.evaluated = {
            props: props instanceof codegen_1.Name ? void 0 : props,
            items: items instanceof codegen_1.Name ? void 0 : items,
            dynamicProps: props instanceof codegen_1.Name,
            dynamicItems: items instanceof codegen_1.Name
          };
          if (validate.source)
            validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated);
        }
        sch.validate = validate;
        return sch;
      } catch (e) {
        delete sch.validate;
        delete sch.validateName;
        if (sourceCode)
          this.logger.error("Error compiling schema, function code:", sourceCode);
        throw e;
      } finally {
        this._compilations.delete(sch);
      }
    }
    exports5.compileSchema = compileSchema;
    function resolveRef(root, baseId, ref) {
      var _a;
      ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref);
      const schOrFunc = root.refs[ref];
      if (schOrFunc)
        return schOrFunc;
      let _sch = resolve2.call(this, root, ref);
      if (_sch === void 0) {
        const schema4 = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
        const { schemaId } = this.opts;
        if (schema4)
          _sch = new SchemaEnv({ schema: schema4, schemaId, root, baseId });
      }
      if (_sch === void 0)
        return;
      return root.refs[ref] = inlineOrCompile.call(this, _sch);
    }
    exports5.resolveRef = resolveRef;
    function inlineOrCompile(sch) {
      if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs))
        return sch.schema;
      return sch.validate ? sch : compileSchema.call(this, sch);
    }
    function getCompilingSchema(schEnv) {
      for (const sch of this._compilations) {
        if (sameSchemaEnv(sch, schEnv))
          return sch;
      }
    }
    exports5.getCompilingSchema = getCompilingSchema;
    function sameSchemaEnv(s1, s2) {
      return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
    }
    function resolve2(root, ref) {
      let sch;
      while (typeof (sch = this.refs[ref]) == "string")
        ref = sch;
      return sch || this.schemas[ref] || resolveSchema.call(this, root, ref);
    }
    function resolveSchema(root, ref) {
      const p = this.opts.uriResolver.parse(ref);
      const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p);
      let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, void 0);
      if (Object.keys(root.schema).length > 0 && refPath === baseId) {
        return getJsonPointer.call(this, p, root);
      }
      const id = (0, resolve_1.normalizeId)(refPath);
      const schOrRef = this.refs[id] || this.schemas[id];
      if (typeof schOrRef == "string") {
        const sch = resolveSchema.call(this, root, schOrRef);
        if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object")
          return;
        return getJsonPointer.call(this, p, sch);
      }
      if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object")
        return;
      if (!schOrRef.validate)
        compileSchema.call(this, schOrRef);
      if (id === (0, resolve_1.normalizeId)(ref)) {
        const { schema: schema4 } = schOrRef;
        const { schemaId } = this.opts;
        const schId = schema4[schemaId];
        if (schId)
          baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
        return new SchemaEnv({ schema: schema4, schemaId, root, baseId });
      }
      return getJsonPointer.call(this, p, schOrRef);
    }
    exports5.resolveSchema = resolveSchema;
    var PREVENT_SCOPE_CHANGE = /* @__PURE__ */ new Set([
      "properties",
      "patternProperties",
      "enum",
      "dependencies",
      "definitions"
    ]);
    function getJsonPointer(parsedRef, { baseId, schema: schema4, root }) {
      var _a;
      if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/")
        return;
      for (const part of parsedRef.fragment.slice(1).split("/")) {
        if (typeof schema4 === "boolean")
          return;
        const partSchema = schema4[(0, util_1.unescapeFragment)(part)];
        if (partSchema === void 0)
          return;
        schema4 = partSchema;
        const schId = typeof schema4 === "object" && schema4[this.opts.schemaId];
        if (!PREVENT_SCOPE_CHANGE.has(part) && schId) {
          baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
        }
      }
      let env3;
      if (typeof schema4 != "boolean" && schema4.$ref && !(0, util_1.schemaHasRulesButRef)(schema4, this.RULES)) {
        const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema4.$ref);
        env3 = resolveSchema.call(this, root, $ref);
      }
      const { schemaId } = this.opts;
      env3 = env3 || new SchemaEnv({ schema: schema4, schemaId, root, baseId });
      if (env3.schema !== env3.root.schema)
        return env3;
      return void 0;
    }
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/data.json
var require_data = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/data.json"(exports5, module) {
    module.exports = {
      $id: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
      description: "Meta-schema for $data reference (JSON AnySchema extension proposal)",
      type: "object",
      required: ["$data"],
      properties: {
        $data: {
          type: "string",
          anyOf: [{ format: "relative-json-pointer" }, { format: "json-pointer" }]
        }
      },
      additionalProperties: false
    };
  }
});

// src/typespec/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js
var require_utils = __commonJS({
  "src/typespec/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/utils.js"(exports5, module) {
    "use strict";
    var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
    var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
    function stringArrayToHexStripped(input) {
      let acc = "";
      let code2 = 0;
      let i = 0;
      for (i = 0; i < input.length; i++) {
        code2 = input[i].charCodeAt(0);
        if (code2 === 48) {
          continue;
        }
        if (!(code2 >= 48 && code2 <= 57 || code2 >= 65 && code2 <= 70 || code2 >= 97 && code2 <= 102)) {
          return "";
        }
        acc += input[i];
        break;
      }
      for (i += 1; i < input.length; i++) {
        code2 = input[i].charCodeAt(0);
        if (!(code2 >= 48 && code2 <= 57 || code2 >= 65 && code2 <= 70 || code2 >= 97 && code2 <= 102)) {
          return "";
        }
        acc += input[i];
      }
      return acc;
    }
    var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
    function consumeIsZone(buffer) {
      buffer.length = 0;
      return true;
    }
    function consumeHextets(buffer, address, output) {
      if (buffer.length) {
        const hex = stringArrayToHexStripped(buffer);
        if (hex !== "") {
          address.push(hex);
        } else {
          output.error = true;
          return false;
        }
        buffer.length = 0;
      }
      return true;
    }
    function getIPV6(input) {
      let tokenCount = 0;
      const output = { error: false, address: "", zone: "" };
      const address = [];
      const buffer = [];
      let endipv6Encountered = false;
      let endIpv6 = false;
      let consume = consumeHextets;
      for (let i = 0; i < input.length; i++) {
        const cursor = input[i];
        if (cursor === "[" || cursor === "]") {
          continue;
        }
        if (cursor === ":") {
          if (endipv6Encountered === true) {
            endIpv6 = true;
          }
          if (!consume(buffer, address, output)) {
            break;
          }
          if (++tokenCount > 7) {
            output.error = true;
            break;
          }
          if (i > 0 && input[i - 1] === ":") {
            endipv6Encountered = true;
          }
          address.push(":");
          continue;
        } else if (cursor === "%") {
          if (!consume(buffer, address, output)) {
            break;
          }
          consume = consumeIsZone;
        } else {
          buffer.push(cursor);
          continue;
        }
      }
      if (buffer.length) {
        if (consume === consumeIsZone) {
          output.zone = buffer.join("");
        } else if (endIpv6) {
          address.push(buffer.join(""));
        } else {
          address.push(stringArrayToHexStripped(buffer));
        }
      }
      output.address = address.join("");
      return output;
    }
    function normalizeIPv6(host) {
      if (findToken(host, ":") < 2) {
        return { host, isIPV6: false };
      }
      const ipv6 = getIPV6(host);
      if (!ipv6.error) {
        let newHost = ipv6.address;
        let escapedHost = ipv6.address;
        if (ipv6.zone) {
          newHost += "%" + ipv6.zone;
          escapedHost += "%25" + ipv6.zone;
        }
        return { host: newHost, isIPV6: true, escapedHost };
      } else {
        return { host, isIPV6: false };
      }
    }
    function findToken(str, token) {
      let ind = 0;
      for (let i = 0; i < str.length; i++) {
        if (str[i] === token) ind++;
      }
      return ind;
    }
    function removeDotSegments(path) {
      let input = path;
      const output = [];
      let nextSlash = -1;
      let len = 0;
      while (len = input.length) {
        if (len === 1) {
          if (input === ".") {
            break;
          } else if (input === "/") {
            output.push("/");
            break;
          } else {
            output.push(input);
            break;
          }
        } else if (len === 2) {
          if (input[0] === ".") {
            if (input[1] === ".") {
              break;
            } else if (input[1] === "/") {
              input = input.slice(2);
              continue;
            }
          } else if (input[0] === "/") {
            if (input[1] === "." || input[1] === "/") {
              output.push("/");
              break;
            }
          }
        } else if (len === 3) {
          if (input === "/..") {
            if (output.length !== 0) {
              output.pop();
            }
            output.push("/");
            break;
          }
        }
        if (input[0] === ".") {
          if (input[1] === ".") {
            if (input[2] === "/") {
              input = input.slice(3);
              continue;
            }
          } else if (input[1] === "/") {
            input = input.slice(2);
            continue;
          }
        } else if (input[0] === "/") {
          if (input[1] === ".") {
            if (input[2] === "/") {
              input = input.slice(2);
              continue;
            } else if (input[2] === ".") {
              if (input[3] === "/") {
                input = input.slice(3);
                if (output.length !== 0) {
                  output.pop();
                }
                continue;
              }
            }
          }
        }
        if ((nextSlash = input.indexOf("/", 1)) === -1) {
          output.push(input);
          break;
        } else {
          output.push(input.slice(0, nextSlash));
          input = input.slice(nextSlash);
        }
      }
      return output.join("");
    }
    function normalizeComponentEncoding(component, esc) {
      const func = esc !== true ? escape : unescape;
      if (component.scheme !== void 0) {
        component.scheme = func(component.scheme);
      }
      if (component.userinfo !== void 0) {
        component.userinfo = func(component.userinfo);
      }
      if (component.host !== void 0) {
        component.host = func(component.host);
      }
      if (component.path !== void 0) {
        component.path = func(component.path);
      }
      if (component.query !== void 0) {
        component.query = func(component.query);
      }
      if (component.fragment !== void 0) {
        component.fragment = func(component.fragment);
      }
      return component;
    }
    function recomposeAuthority(component) {
      const uriTokens = [];
      if (component.userinfo !== void 0) {
        uriTokens.push(component.userinfo);
        uriTokens.push("@");
      }
      if (component.host !== void 0) {
        let host = unescape(component.host);
        if (!isIPv4(host)) {
          const ipV6res = normalizeIPv6(host);
          if (ipV6res.isIPV6 === true) {
            host = `[${ipV6res.escapedHost}]`;
          } else {
            host = component.host;
          }
        }
        uriTokens.push(host);
      }
      if (typeof component.port === "number" || typeof component.port === "string") {
        uriTokens.push(":");
        uriTokens.push(String(component.port));
      }
      return uriTokens.length ? uriTokens.join("") : void 0;
    }
    module.exports = {
      nonSimpleDomain,
      recomposeAuthority,
      normalizeComponentEncoding,
      removeDotSegments,
      isIPv4,
      isUUID,
      normalizeIPv6,
      stringArrayToHexStripped
    };
  }
});

// src/typespec/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js
var require_schemes = __commonJS({
  "src/typespec/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/lib/schemes.js"(exports5, module) {
    "use strict";
    var { isUUID } = require_utils();
    var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
    var supportedSchemeNames = (
      /** @type {const} */
      [
        "http",
        "https",
        "ws",
        "wss",
        "urn",
        "urn:uuid"
      ]
    );
    function isValidSchemeName(name) {
      return supportedSchemeNames.indexOf(
        /** @type {*} */
        name
      ) !== -1;
    }
    function wsIsSecure(wsComponent) {
      if (wsComponent.secure === true) {
        return true;
      } else if (wsComponent.secure === false) {
        return false;
      } else if (wsComponent.scheme) {
        return wsComponent.scheme.length === 3 && (wsComponent.scheme[0] === "w" || wsComponent.scheme[0] === "W") && (wsComponent.scheme[1] === "s" || wsComponent.scheme[1] === "S") && (wsComponent.scheme[2] === "s" || wsComponent.scheme[2] === "S");
      } else {
        return false;
      }
    }
    function httpParse(component) {
      if (!component.host) {
        component.error = component.error || "HTTP URIs must have a host.";
      }
      return component;
    }
    function httpSerialize(component) {
      const secure = String(component.scheme).toLowerCase() === "https";
      if (component.port === (secure ? 443 : 80) || component.port === "") {
        component.port = void 0;
      }
      if (!component.path) {
        component.path = "/";
      }
      return component;
    }
    function wsParse(wsComponent) {
      wsComponent.secure = wsIsSecure(wsComponent);
      wsComponent.resourceName = (wsComponent.path || "/") + (wsComponent.query ? "?" + wsComponent.query : "");
      wsComponent.path = void 0;
      wsComponent.query = void 0;
      return wsComponent;
    }
    function wsSerialize(wsComponent) {
      if (wsComponent.port === (wsIsSecure(wsComponent) ? 443 : 80) || wsComponent.port === "") {
        wsComponent.port = void 0;
      }
      if (typeof wsComponent.secure === "boolean") {
        wsComponent.scheme = wsComponent.secure ? "wss" : "ws";
        wsComponent.secure = void 0;
      }
      if (wsComponent.resourceName) {
        const [path, query] = wsComponent.resourceName.split("?");
        wsComponent.path = path && path !== "/" ? path : void 0;
        wsComponent.query = query;
        wsComponent.resourceName = void 0;
      }
      wsComponent.fragment = void 0;
      return wsComponent;
    }
    function urnParse(urnComponent, options) {
      if (!urnComponent.path) {
        urnComponent.error = "URN can not be parsed";
        return urnComponent;
      }
      const matches = urnComponent.path.match(URN_REG);
      if (matches) {
        const scheme = options.scheme || urnComponent.scheme || "urn";
        urnComponent.nid = matches[1].toLowerCase();
        urnComponent.nss = matches[2];
        const urnScheme = `${scheme}:${options.nid || urnComponent.nid}`;
        const schemeHandler = getSchemeHandler(urnScheme);
        urnComponent.path = void 0;
        if (schemeHandler) {
          urnComponent = schemeHandler.parse(urnComponent, options);
        }
      } else {
        urnComponent.error = urnComponent.error || "URN can not be parsed.";
      }
      return urnComponent;
    }
    function urnSerialize(urnComponent, options) {
      if (urnComponent.nid === void 0) {
        throw new Error("URN without nid cannot be serialized");
      }
      const scheme = options.scheme || urnComponent.scheme || "urn";
      const nid = urnComponent.nid.toLowerCase();
      const urnScheme = `${scheme}:${options.nid || nid}`;
      const schemeHandler = getSchemeHandler(urnScheme);
      if (schemeHandler) {
        urnComponent = schemeHandler.serialize(urnComponent, options);
      }
      const uriComponent = urnComponent;
      const nss = urnComponent.nss;
      uriComponent.path = `${nid || options.nid}:${nss}`;
      options.skipEscape = true;
      return uriComponent;
    }
    function urnuuidParse(urnComponent, options) {
      const uuidComponent = urnComponent;
      uuidComponent.uuid = uuidComponent.nss;
      uuidComponent.nss = void 0;
      if (!options.tolerant && (!uuidComponent.uuid || !isUUID(uuidComponent.uuid))) {
        uuidComponent.error = uuidComponent.error || "UUID is not valid.";
      }
      return uuidComponent;
    }
    function urnuuidSerialize(uuidComponent) {
      const urnComponent = uuidComponent;
      urnComponent.nss = (uuidComponent.uuid || "").toLowerCase();
      return urnComponent;
    }
    var http = (
      /** @type {SchemeHandler} */
      {
        scheme: "http",
        domainHost: true,
        parse: httpParse,
        serialize: httpSerialize
      }
    );
    var https = (
      /** @type {SchemeHandler} */
      {
        scheme: "https",
        domainHost: http.domainHost,
        parse: httpParse,
        serialize: httpSerialize
      }
    );
    var ws = (
      /** @type {SchemeHandler} */
      {
        scheme: "ws",
        domainHost: true,
        parse: wsParse,
        serialize: wsSerialize
      }
    );
    var wss = (
      /** @type {SchemeHandler} */
      {
        scheme: "wss",
        domainHost: ws.domainHost,
        parse: ws.parse,
        serialize: ws.serialize
      }
    );
    var urn = (
      /** @type {SchemeHandler} */
      {
        scheme: "urn",
        parse: urnParse,
        serialize: urnSerialize,
        skipNormalize: true
      }
    );
    var urnuuid = (
      /** @type {SchemeHandler} */
      {
        scheme: "urn:uuid",
        parse: urnuuidParse,
        serialize: urnuuidSerialize,
        skipNormalize: true
      }
    );
    var SCHEMES = (
      /** @type {Record<SchemeName, SchemeHandler>} */
      {
        http,
        https,
        ws,
        wss,
        urn,
        "urn:uuid": urnuuid
      }
    );
    Object.setPrototypeOf(SCHEMES, null);
    function getSchemeHandler(scheme) {
      return scheme && (SCHEMES[
        /** @type {SchemeName} */
        scheme
      ] || SCHEMES[
        /** @type {SchemeName} */
        scheme.toLowerCase()
      ]) || void 0;
    }
    module.exports = {
      wsIsSecure,
      SCHEMES,
      isValidSchemeName,
      getSchemeHandler
    };
  }
});

// src/typespec/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js
var require_fast_uri = __commonJS({
  "src/typespec/node_modules/.pnpm/fast-uri@3.1.0/node_modules/fast-uri/index.js"(exports5, module) {
    "use strict";
    var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
    var { SCHEMES, getSchemeHandler } = require_schemes();
    function normalize2(uri, options) {
      if (typeof uri === "string") {
        uri = /** @type {T} */
        serialize(parse3(uri, options), options);
      } else if (typeof uri === "object") {
        uri = /** @type {T} */
        parse3(serialize(uri, options), options);
      }
      return uri;
    }
    function resolve2(baseURI, relativeURI, options) {
      const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
      const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
      schemelessOptions.skipEscape = true;
      return serialize(resolved, schemelessOptions);
    }
    function resolveComponent(base, relative2, options, skipNormalization) {
      const target = {};
      if (!skipNormalization) {
        base = parse3(serialize(base, options), options);
        relative2 = parse3(serialize(relative2, options), options);
      }
      options = options || {};
      if (!options.tolerant && relative2.scheme) {
        target.scheme = relative2.scheme;
        target.userinfo = relative2.userinfo;
        target.host = relative2.host;
        target.port = relative2.port;
        target.path = removeDotSegments(relative2.path || "");
        target.query = relative2.query;
      } else {
        if (relative2.userinfo !== void 0 || relative2.host !== void 0 || relative2.port !== void 0) {
          target.userinfo = relative2.userinfo;
          target.host = relative2.host;
          target.port = relative2.port;
          target.path = removeDotSegments(relative2.path || "");
          target.query = relative2.query;
        } else {
          if (!relative2.path) {
            target.path = base.path;
            if (relative2.query !== void 0) {
              target.query = relative2.query;
            } else {
              target.query = base.query;
            }
          } else {
            if (relative2.path[0] === "/") {
              target.path = removeDotSegments(relative2.path);
            } else {
              if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
                target.path = "/" + relative2.path;
              } else if (!base.path) {
                target.path = relative2.path;
              } else {
                target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative2.path;
              }
              target.path = removeDotSegments(target.path);
            }
            target.query = relative2.query;
          }
          target.userinfo = base.userinfo;
          target.host = base.host;
          target.port = base.port;
        }
        target.scheme = base.scheme;
      }
      target.fragment = relative2.fragment;
      return target;
    }
    function equal(uriA, uriB, options) {
      if (typeof uriA === "string") {
        uriA = unescape(uriA);
        uriA = serialize(normalizeComponentEncoding(parse3(uriA, options), true), { ...options, skipEscape: true });
      } else if (typeof uriA === "object") {
        uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
      }
      if (typeof uriB === "string") {
        uriB = unescape(uriB);
        uriB = serialize(normalizeComponentEncoding(parse3(uriB, options), true), { ...options, skipEscape: true });
      } else if (typeof uriB === "object") {
        uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
      }
      return uriA.toLowerCase() === uriB.toLowerCase();
    }
    function serialize(cmpts, opts) {
      const component = {
        host: cmpts.host,
        scheme: cmpts.scheme,
        userinfo: cmpts.userinfo,
        port: cmpts.port,
        path: cmpts.path,
        query: cmpts.query,
        nid: cmpts.nid,
        nss: cmpts.nss,
        uuid: cmpts.uuid,
        fragment: cmpts.fragment,
        reference: cmpts.reference,
        resourceName: cmpts.resourceName,
        secure: cmpts.secure,
        error: ""
      };
      const options = Object.assign({}, opts);
      const uriTokens = [];
      const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
      if (schemeHandler && schemeHandler.serialize) schemeHandler.serialize(component, options);
      if (component.path !== void 0) {
        if (!options.skipEscape) {
          component.path = escape(component.path);
          if (component.scheme !== void 0) {
            component.path = component.path.split("%3A").join(":");
          }
        } else {
          component.path = unescape(component.path);
        }
      }
      if (options.reference !== "suffix" && component.scheme) {
        uriTokens.push(component.scheme, ":");
      }
      const authority = recomposeAuthority(component);
      if (authority !== void 0) {
        if (options.reference !== "suffix") {
          uriTokens.push("//");
        }
        uriTokens.push(authority);
        if (component.path && component.path[0] !== "/") {
          uriTokens.push("/");
        }
      }
      if (component.path !== void 0) {
        let s = component.path;
        if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
          s = removeDotSegments(s);
        }
        if (authority === void 0 && s[0] === "/" && s[1] === "/") {
          s = "/%2F" + s.slice(2);
        }
        uriTokens.push(s);
      }
      if (component.query !== void 0) {
        uriTokens.push("?", component.query);
      }
      if (component.fragment !== void 0) {
        uriTokens.push("#", component.fragment);
      }
      return uriTokens.join("");
    }
    var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
    function parse3(uri, opts) {
      const options = Object.assign({}, opts);
      const parsed = {
        scheme: void 0,
        userinfo: void 0,
        host: "",
        port: void 0,
        path: "",
        query: void 0,
        fragment: void 0
      };
      let isIP = false;
      if (options.reference === "suffix") {
        if (options.scheme) {
          uri = options.scheme + ":" + uri;
        } else {
          uri = "//" + uri;
        }
      }
      const matches = uri.match(URI_PARSE);
      if (matches) {
        parsed.scheme = matches[1];
        parsed.userinfo = matches[3];
        parsed.host = matches[4];
        parsed.port = parseInt(matches[5], 10);
        parsed.path = matches[6] || "";
        parsed.query = matches[7];
        parsed.fragment = matches[8];
        if (isNaN(parsed.port)) {
          parsed.port = matches[5];
        }
        if (parsed.host) {
          const ipv4result = isIPv4(parsed.host);
          if (ipv4result === false) {
            const ipv6result = normalizeIPv6(parsed.host);
            parsed.host = ipv6result.host.toLowerCase();
            isIP = ipv6result.isIPV6;
          } else {
            isIP = true;
          }
        }
        if (parsed.scheme === void 0 && parsed.userinfo === void 0 && parsed.host === void 0 && parsed.port === void 0 && parsed.query === void 0 && !parsed.path) {
          parsed.reference = "same-document";
        } else if (parsed.scheme === void 0) {
          parsed.reference = "relative";
        } else if (parsed.fragment === void 0) {
          parsed.reference = "absolute";
        } else {
          parsed.reference = "uri";
        }
        if (options.reference && options.reference !== "suffix" && options.reference !== parsed.reference) {
          parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
        }
        const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
        if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
          if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
            try {
              parsed.host = URL.domainToASCII(parsed.host.toLowerCase());
            } catch (e) {
              parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
            }
          }
        }
        if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
          if (uri.indexOf("%") !== -1) {
            if (parsed.scheme !== void 0) {
              parsed.scheme = unescape(parsed.scheme);
            }
            if (parsed.host !== void 0) {
              parsed.host = unescape(parsed.host);
            }
          }
          if (parsed.path) {
            parsed.path = escape(unescape(parsed.path));
          }
          if (parsed.fragment) {
            parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
          }
        }
        if (schemeHandler && schemeHandler.parse) {
          schemeHandler.parse(parsed, options);
        }
      } else {
        parsed.error = parsed.error || "URI can not be parsed.";
      }
      return parsed;
    }
    var fastUri = {
      SCHEMES,
      normalize: normalize2,
      resolve: resolve2,
      resolveComponent,
      equal,
      serialize,
      parse: parse3
    };
    module.exports = fastUri;
    module.exports.default = fastUri;
    module.exports.fastUri = fastUri;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/runtime/uri.js
var require_uri = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/runtime/uri.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var uri = require_fast_uri();
    uri.code = 'require("ajv/dist/runtime/uri").default';
    exports5.default = uri;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/core.js
var require_core = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/core.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.CodeGen = exports5.Name = exports5.nil = exports5.stringify = exports5.str = exports5._ = exports5.KeywordCxt = void 0;
    var validate_1 = require_validate();
    Object.defineProperty(exports5, "KeywordCxt", { enumerable: true, get: function() {
      return validate_1.KeywordCxt;
    } });
    var codegen_1 = require_codegen();
    Object.defineProperty(exports5, "_", { enumerable: true, get: function() {
      return codegen_1._;
    } });
    Object.defineProperty(exports5, "str", { enumerable: true, get: function() {
      return codegen_1.str;
    } });
    Object.defineProperty(exports5, "stringify", { enumerable: true, get: function() {
      return codegen_1.stringify;
    } });
    Object.defineProperty(exports5, "nil", { enumerable: true, get: function() {
      return codegen_1.nil;
    } });
    Object.defineProperty(exports5, "Name", { enumerable: true, get: function() {
      return codegen_1.Name;
    } });
    Object.defineProperty(exports5, "CodeGen", { enumerable: true, get: function() {
      return codegen_1.CodeGen;
    } });
    var validation_error_1 = require_validation_error();
    var ref_error_1 = require_ref_error();
    var rules_1 = require_rules();
    var compile_1 = require_compile();
    var codegen_2 = require_codegen();
    var resolve_1 = require_resolve();
    var dataType_1 = require_dataType();
    var util_1 = require_util2();
    var $dataRefSchema = require_data();
    var uri_1 = require_uri();
    var defaultRegExp = (str, flags) => new RegExp(str, flags);
    defaultRegExp.code = "new RegExp";
    var META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
    var EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
      "validate",
      "serialize",
      "parse",
      "wrapper",
      "root",
      "schema",
      "keyword",
      "pattern",
      "formats",
      "validate$data",
      "func",
      "obj",
      "Error"
    ]);
    var removedOptions = {
      errorDataPath: "",
      format: "`validateFormats: false` can be used instead.",
      nullable: '"nullable" keyword is supported by default.',
      jsonPointers: "Deprecated jsPropertySyntax can be used instead.",
      extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.",
      missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.",
      processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`",
      sourceCode: "Use option `code: {source: true}`",
      strictDefaults: "It is default now, see option `strict`.",
      strictKeywords: "It is default now, see option `strict`.",
      uniqueItems: '"uniqueItems" keyword is always validated.',
      unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",
      cache: "Map is used as cache, schema object as key.",
      serialize: "Map is used as cache, schema object as key.",
      ajvErrors: "It is default now."
    };
    var deprecatedOptions = {
      ignoreKeywordsWithRef: "",
      jsPropertySyntax: "",
      unicode: '"minLength"/"maxLength" account for unicode characters by default.'
    };
    var MAX_EXPRESSION = 200;
    function requiredOptions(o) {
      var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
      const s = o.strict;
      const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
      const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
      const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
      const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
      return {
        strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true,
        strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true,
        strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log",
        strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log",
        strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false,
        code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp },
        loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION,
        loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,
        meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true,
        messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true,
        inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true,
        schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id",
        addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true,
        validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true,
        validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true,
        unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true,
        int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true,
        uriResolver
      };
    }
    var Ajv = class {
      constructor(opts = {}) {
        this.schemas = {};
        this.refs = {};
        this.formats = {};
        this._compilations = /* @__PURE__ */ new Set();
        this._loading = {};
        this._cache = /* @__PURE__ */ new Map();
        opts = this.opts = { ...opts, ...requiredOptions(opts) };
        const { es5, lines } = this.opts.code;
        this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines });
        this.logger = getLogger(opts.logger);
        const formatOpt = opts.validateFormats;
        opts.validateFormats = false;
        this.RULES = (0, rules_1.getRules)();
        checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED");
        checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn");
        this._metaOpts = getMetaSchemaOptions.call(this);
        if (opts.formats)
          addInitialFormats.call(this);
        this._addVocabularies();
        this._addDefaultMetaSchema();
        if (opts.keywords)
          addInitialKeywords.call(this, opts.keywords);
        if (typeof opts.meta == "object")
          this.addMetaSchema(opts.meta);
        addInitialSchemas.call(this);
        opts.validateFormats = formatOpt;
      }
      _addVocabularies() {
        this.addKeyword("$async");
      }
      _addDefaultMetaSchema() {
        const { $data, meta, schemaId } = this.opts;
        let _dataRefSchema = $dataRefSchema;
        if (schemaId === "id") {
          _dataRefSchema = { ...$dataRefSchema };
          _dataRefSchema.id = _dataRefSchema.$id;
          delete _dataRefSchema.$id;
        }
        if (meta && $data)
          this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);
      }
      defaultMeta() {
        const { meta, schemaId } = this.opts;
        return this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : void 0;
      }
      validate(schemaKeyRef, data) {
        let v;
        if (typeof schemaKeyRef == "string") {
          v = this.getSchema(schemaKeyRef);
          if (!v)
            throw new Error(`no schema with key or ref "${schemaKeyRef}"`);
        } else {
          v = this.compile(schemaKeyRef);
        }
        const valid = v(data);
        if (!("$async" in v))
          this.errors = v.errors;
        return valid;
      }
      compile(schema4, _meta) {
        const sch = this._addSchema(schema4, _meta);
        return sch.validate || this._compileSchemaEnv(sch);
      }
      compileAsync(schema4, meta) {
        if (typeof this.opts.loadSchema != "function") {
          throw new Error("options.loadSchema should be a function");
        }
        const { loadSchema } = this.opts;
        return runCompileAsync.call(this, schema4, meta);
        async function runCompileAsync(_schema, _meta) {
          await loadMetaSchema.call(this, _schema.$schema);
          const sch = this._addSchema(_schema, _meta);
          return sch.validate || _compileAsync.call(this, sch);
        }
        async function loadMetaSchema($ref) {
          if ($ref && !this.getSchema($ref)) {
            await runCompileAsync.call(this, { $ref }, true);
          }
        }
        async function _compileAsync(sch) {
          try {
            return this._compileSchemaEnv(sch);
          } catch (e) {
            if (!(e instanceof ref_error_1.default))
              throw e;
            checkLoaded.call(this, e);
            await loadMissingSchema.call(this, e.missingSchema);
            return _compileAsync.call(this, sch);
          }
        }
        function checkLoaded({ missingSchema: ref, missingRef }) {
          if (this.refs[ref]) {
            throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`);
          }
        }
        async function loadMissingSchema(ref) {
          const _schema = await _loadSchema.call(this, ref);
          if (!this.refs[ref])
            await loadMetaSchema.call(this, _schema.$schema);
          if (!this.refs[ref])
            this.addSchema(_schema, ref, meta);
        }
        async function _loadSchema(ref) {
          const p = this._loading[ref];
          if (p)
            return p;
          try {
            return await (this._loading[ref] = loadSchema(ref));
          } finally {
            delete this._loading[ref];
          }
        }
      }
      // Adds schema to the instance
      addSchema(schema4, key, _meta, _validateSchema = this.opts.validateSchema) {
        if (Array.isArray(schema4)) {
          for (const sch of schema4)
            this.addSchema(sch, void 0, _meta, _validateSchema);
          return this;
        }
        let id;
        if (typeof schema4 === "object") {
          const { schemaId } = this.opts;
          id = schema4[schemaId];
          if (id !== void 0 && typeof id != "string") {
            throw new Error(`schema ${schemaId} must be string`);
          }
        }
        key = (0, resolve_1.normalizeId)(key || id);
        this._checkUnique(key);
        this.schemas[key] = this._addSchema(schema4, _meta, key, _validateSchema, true);
        return this;
      }
      // Add schema that will be used to validate other schemas
      // options in META_IGNORE_OPTIONS are alway set to false
      addMetaSchema(schema4, key, _validateSchema = this.opts.validateSchema) {
        this.addSchema(schema4, key, true, _validateSchema);
        return this;
      }
      //  Validate schema against its meta-schema
      validateSchema(schema4, throwOrLogError) {
        if (typeof schema4 == "boolean")
          return true;
        let $schema;
        $schema = schema4.$schema;
        if ($schema !== void 0 && typeof $schema != "string") {
          throw new Error("$schema must be a string");
        }
        $schema = $schema || this.opts.defaultMeta || this.defaultMeta();
        if (!$schema) {
          this.logger.warn("meta-schema not available");
          this.errors = null;
          return true;
        }
        const valid = this.validate($schema, schema4);
        if (!valid && throwOrLogError) {
          const message = "schema is invalid: " + this.errorsText();
          if (this.opts.validateSchema === "log")
            this.logger.error(message);
          else
            throw new Error(message);
        }
        return valid;
      }
      // Get compiled schema by `key` or `ref`.
      // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
      getSchema(keyRef) {
        let sch;
        while (typeof (sch = getSchEnv.call(this, keyRef)) == "string")
          keyRef = sch;
        if (sch === void 0) {
          const { schemaId } = this.opts;
          const root = new compile_1.SchemaEnv({ schema: {}, schemaId });
          sch = compile_1.resolveSchema.call(this, root, keyRef);
          if (!sch)
            return;
          this.refs[keyRef] = sch;
        }
        return sch.validate || this._compileSchemaEnv(sch);
      }
      // Remove cached schema(s).
      // If no parameter is passed all schemas but meta-schemas are removed.
      // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
      // Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
      removeSchema(schemaKeyRef) {
        if (schemaKeyRef instanceof RegExp) {
          this._removeAllSchemas(this.schemas, schemaKeyRef);
          this._removeAllSchemas(this.refs, schemaKeyRef);
          return this;
        }
        switch (typeof schemaKeyRef) {
          case "undefined":
            this._removeAllSchemas(this.schemas);
            this._removeAllSchemas(this.refs);
            this._cache.clear();
            return this;
          case "string": {
            const sch = getSchEnv.call(this, schemaKeyRef);
            if (typeof sch == "object")
              this._cache.delete(sch.schema);
            delete this.schemas[schemaKeyRef];
            delete this.refs[schemaKeyRef];
            return this;
          }
          case "object": {
            const cacheKey = schemaKeyRef;
            this._cache.delete(cacheKey);
            let id = schemaKeyRef[this.opts.schemaId];
            if (id) {
              id = (0, resolve_1.normalizeId)(id);
              delete this.schemas[id];
              delete this.refs[id];
            }
            return this;
          }
          default:
            throw new Error("ajv.removeSchema: invalid parameter");
        }
      }
      // add "vocabulary" - a collection of keywords
      addVocabulary(definitions) {
        for (const def of definitions)
          this.addKeyword(def);
        return this;
      }
      addKeyword(kwdOrDef, def) {
        let keyword;
        if (typeof kwdOrDef == "string") {
          keyword = kwdOrDef;
          if (typeof def == "object") {
            this.logger.warn("these parameters are deprecated, see docs for addKeyword");
            def.keyword = keyword;
          }
        } else if (typeof kwdOrDef == "object" && def === void 0) {
          def = kwdOrDef;
          keyword = def.keyword;
          if (Array.isArray(keyword) && !keyword.length) {
            throw new Error("addKeywords: keyword must be string or non-empty array");
          }
        } else {
          throw new Error("invalid addKeywords parameters");
        }
        checkKeyword.call(this, keyword, def);
        if (!def) {
          (0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd));
          return this;
        }
        keywordMetaschema.call(this, def);
        const definition = {
          ...def,
          type: (0, dataType_1.getJSONTypes)(def.type),
          schemaType: (0, dataType_1.getJSONTypes)(def.schemaType)
        };
        (0, util_1.eachItem)(keyword, definition.type.length === 0 ? (k) => addRule.call(this, k, definition) : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)));
        return this;
      }
      getKeyword(keyword) {
        const rule = this.RULES.all[keyword];
        return typeof rule == "object" ? rule.definition : !!rule;
      }
      // Remove keyword
      removeKeyword(keyword) {
        const { RULES } = this;
        delete RULES.keywords[keyword];
        delete RULES.all[keyword];
        for (const group of RULES.rules) {
          const i = group.rules.findIndex((rule) => rule.keyword === keyword);
          if (i >= 0)
            group.rules.splice(i, 1);
        }
        return this;
      }
      // Add format
      addFormat(name, format3) {
        if (typeof format3 == "string")
          format3 = new RegExp(format3);
        this.formats[name] = format3;
        return this;
      }
      errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
        if (!errors || errors.length === 0)
          return "No errors";
        return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text, msg) => text + separator + msg);
      }
      $dataMetaSchema(metaSchema, keywordsJsonPointers) {
        const rules = this.RULES.all;
        metaSchema = JSON.parse(JSON.stringify(metaSchema));
        for (const jsonPointer of keywordsJsonPointers) {
          const segments = jsonPointer.split("/").slice(1);
          let keywords = metaSchema;
          for (const seg of segments)
            keywords = keywords[seg];
          for (const key in rules) {
            const rule = rules[key];
            if (typeof rule != "object")
              continue;
            const { $data } = rule.definition;
            const schema4 = keywords[key];
            if ($data && schema4)
              keywords[key] = schemaOrData(schema4);
          }
        }
        return metaSchema;
      }
      _removeAllSchemas(schemas2, regex) {
        for (const keyRef in schemas2) {
          const sch = schemas2[keyRef];
          if (!regex || regex.test(keyRef)) {
            if (typeof sch == "string") {
              delete schemas2[keyRef];
            } else if (sch && !sch.meta) {
              this._cache.delete(sch.schema);
              delete schemas2[keyRef];
            }
          }
        }
      }
      _addSchema(schema4, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
        let id;
        const { schemaId } = this.opts;
        if (typeof schema4 == "object") {
          id = schema4[schemaId];
        } else {
          if (this.opts.jtd)
            throw new Error("schema must be object");
          else if (typeof schema4 != "boolean")
            throw new Error("schema must be object or boolean");
        }
        let sch = this._cache.get(schema4);
        if (sch !== void 0)
          return sch;
        baseId = (0, resolve_1.normalizeId)(id || baseId);
        const localRefs = resolve_1.getSchemaRefs.call(this, schema4, baseId);
        sch = new compile_1.SchemaEnv({ schema: schema4, schemaId, meta, baseId, localRefs });
        this._cache.set(sch.schema, sch);
        if (addSchema && !baseId.startsWith("#")) {
          if (baseId)
            this._checkUnique(baseId);
          this.refs[baseId] = sch;
        }
        if (validateSchema)
          this.validateSchema(schema4, true);
        return sch;
      }
      _checkUnique(id) {
        if (this.schemas[id] || this.refs[id]) {
          throw new Error(`schema with key or id "${id}" already exists`);
        }
      }
      _compileSchemaEnv(sch) {
        if (sch.meta)
          this._compileMetaSchema(sch);
        else
          compile_1.compileSchema.call(this, sch);
        if (!sch.validate)
          throw new Error("ajv implementation error");
        return sch.validate;
      }
      _compileMetaSchema(sch) {
        const currentOpts = this.opts;
        this.opts = this._metaOpts;
        try {
          compile_1.compileSchema.call(this, sch);
        } finally {
          this.opts = currentOpts;
        }
      }
    };
    Ajv.ValidationError = validation_error_1.default;
    Ajv.MissingRefError = ref_error_1.default;
    exports5.default = Ajv;
    function checkOptions(checkOpts, options, msg, log2 = "error") {
      for (const key in checkOpts) {
        const opt = key;
        if (opt in options)
          this.logger[log2](`${msg}: option ${key}. ${checkOpts[opt]}`);
      }
    }
    function getSchEnv(keyRef) {
      keyRef = (0, resolve_1.normalizeId)(keyRef);
      return this.schemas[keyRef] || this.refs[keyRef];
    }
    function addInitialSchemas() {
      const optsSchemas = this.opts.schemas;
      if (!optsSchemas)
        return;
      if (Array.isArray(optsSchemas))
        this.addSchema(optsSchemas);
      else
        for (const key in optsSchemas)
          this.addSchema(optsSchemas[key], key);
    }
    function addInitialFormats() {
      for (const name in this.opts.formats) {
        const format3 = this.opts.formats[name];
        if (format3)
          this.addFormat(name, format3);
      }
    }
    function addInitialKeywords(defs) {
      if (Array.isArray(defs)) {
        this.addVocabulary(defs);
        return;
      }
      this.logger.warn("keywords option as map is deprecated, pass array");
      for (const keyword in defs) {
        const def = defs[keyword];
        if (!def.keyword)
          def.keyword = keyword;
        this.addKeyword(def);
      }
    }
    function getMetaSchemaOptions() {
      const metaOpts = { ...this.opts };
      for (const opt of META_IGNORE_OPTIONS)
        delete metaOpts[opt];
      return metaOpts;
    }
    var noLogs = { log() {
    }, warn() {
    }, error() {
    } };
    function getLogger(logger) {
      if (logger === false)
        return noLogs;
      if (logger === void 0)
        return console;
      if (logger.log && logger.warn && logger.error)
        return logger;
      throw new Error("logger must implement log, warn and error methods");
    }
    var KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
    function checkKeyword(keyword, def) {
      const { RULES } = this;
      (0, util_1.eachItem)(keyword, (kwd) => {
        if (RULES.keywords[kwd])
          throw new Error(`Keyword ${kwd} is already defined`);
        if (!KEYWORD_NAME.test(kwd))
          throw new Error(`Keyword ${kwd} has invalid name`);
      });
      if (!def)
        return;
      if (def.$data && !("code" in def || "validate" in def)) {
        throw new Error('$data keyword must have "code" or "validate" function');
      }
    }
    function addRule(keyword, definition, dataType) {
      var _a;
      const post = definition === null || definition === void 0 ? void 0 : definition.post;
      if (dataType && post)
        throw new Error('keyword with "post" flag cannot have "type"');
      const { RULES } = this;
      let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType);
      if (!ruleGroup) {
        ruleGroup = { type: dataType, rules: [] };
        RULES.rules.push(ruleGroup);
      }
      RULES.keywords[keyword] = true;
      if (!definition)
        return;
      const rule = {
        keyword,
        definition: {
          ...definition,
          type: (0, dataType_1.getJSONTypes)(definition.type),
          schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType)
        }
      };
      if (definition.before)
        addBeforeRule.call(this, ruleGroup, rule, definition.before);
      else
        ruleGroup.rules.push(rule);
      RULES.all[keyword] = rule;
      (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));
    }
    function addBeforeRule(ruleGroup, rule, before) {
      const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
      if (i >= 0) {
        ruleGroup.rules.splice(i, 0, rule);
      } else {
        ruleGroup.rules.push(rule);
        this.logger.warn(`rule ${before} is not defined`);
      }
    }
    function keywordMetaschema(def) {
      let { metaSchema } = def;
      if (metaSchema === void 0)
        return;
      if (def.$data && this.opts.$data)
        metaSchema = schemaOrData(metaSchema);
      def.validateSchema = this.compile(metaSchema, true);
    }
    var $dataRef = {
      $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
    };
    function schemaOrData(schema4) {
      return { anyOf: [schema4, $dataRef] };
    }
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/core/id.js
var require_id = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/core/id.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var def = {
      keyword: "id",
      code() {
        throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID');
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/core/ref.js
var require_ref = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/core/ref.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.callRef = exports5.getValidate = void 0;
    var ref_error_1 = require_ref_error();
    var code_1 = require_code2();
    var codegen_1 = require_codegen();
    var names_1 = require_names();
    var compile_1 = require_compile();
    var util_1 = require_util2();
    var def = {
      keyword: "$ref",
      schemaType: "string",
      code(cxt) {
        const { gen, schema: $ref, it } = cxt;
        const { baseId, schemaEnv: env3, validateName, opts, self: self2 } = it;
        const { root } = env3;
        if (($ref === "#" || $ref === "#/") && baseId === root.baseId)
          return callRootRef();
        const schOrEnv = compile_1.resolveRef.call(self2, root, baseId, $ref);
        if (schOrEnv === void 0)
          throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref);
        if (schOrEnv instanceof compile_1.SchemaEnv)
          return callValidate(schOrEnv);
        return inlineRefSchema(schOrEnv);
        function callRootRef() {
          if (env3 === root)
            return callRef(cxt, validateName, env3, env3.$async);
          const rootName = gen.scopeValue("root", { ref: root });
          return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root, root.$async);
        }
        function callValidate(sch) {
          const v = getValidate(cxt, sch);
          callRef(cxt, v, sch, sch.$async);
        }
        function inlineRefSchema(sch) {
          const schName = gen.scopeValue("schema", opts.code.source === true ? { ref: sch, code: (0, codegen_1.stringify)(sch) } : { ref: sch });
          const valid = gen.name("valid");
          const schCxt = cxt.subschema({
            schema: sch,
            dataTypes: [],
            schemaPath: codegen_1.nil,
            topSchemaRef: schName,
            errSchemaPath: $ref
          }, valid);
          cxt.mergeEvaluated(schCxt);
          cxt.ok(valid);
        }
      }
    };
    function getValidate(cxt, sch) {
      const { gen } = cxt;
      return sch.validate ? gen.scopeValue("validate", { ref: sch.validate }) : (0, codegen_1._)`${gen.scopeValue("wrapper", { ref: sch })}.validate`;
    }
    exports5.getValidate = getValidate;
    function callRef(cxt, v, sch, $async) {
      const { gen, it } = cxt;
      const { allErrors, schemaEnv: env3, opts } = it;
      const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil;
      if ($async)
        callAsyncRef();
      else
        callSyncRef();
      function callAsyncRef() {
        if (!env3.$async)
          throw new Error("async schema referenced by sync schema");
        const valid = gen.let("valid");
        gen.try(() => {
          gen.code((0, codegen_1._)`await ${(0, code_1.callValidateCode)(cxt, v, passCxt)}`);
          addEvaluatedFrom(v);
          if (!allErrors)
            gen.assign(valid, true);
        }, (e) => {
          gen.if((0, codegen_1._)`!(${e} instanceof ${it.ValidationError})`, () => gen.throw(e));
          addErrorsFrom(e);
          if (!allErrors)
            gen.assign(valid, false);
        });
        cxt.ok(valid);
      }
      function callSyncRef() {
        cxt.result((0, code_1.callValidateCode)(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v));
      }
      function addErrorsFrom(source) {
        const errs = (0, codegen_1._)`${source}.errors`;
        gen.assign(names_1.default.vErrors, (0, codegen_1._)`${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`);
        gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
      }
      function addEvaluatedFrom(source) {
        var _a;
        if (!it.opts.unevaluated)
          return;
        const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated;
        if (it.props !== true) {
          if (schEvaluated && !schEvaluated.dynamicProps) {
            if (schEvaluated.props !== void 0) {
              it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props);
            }
          } else {
            const props = gen.var("props", (0, codegen_1._)`${source}.evaluated.props`);
            it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name);
          }
        }
        if (it.items !== true) {
          if (schEvaluated && !schEvaluated.dynamicItems) {
            if (schEvaluated.items !== void 0) {
              it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items);
            }
          } else {
            const items = gen.var("items", (0, codegen_1._)`${source}.evaluated.items`);
            it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name);
          }
        }
      }
    }
    exports5.callRef = callRef;
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/core/index.js
var require_core2 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/core/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var id_1 = require_id();
    var ref_1 = require_ref();
    var core = [
      "$schema",
      "$id",
      "$defs",
      "$vocabulary",
      { keyword: "$comment" },
      "definitions",
      id_1.default,
      ref_1.default
    ];
    exports5.default = core;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/limitNumber.js
var require_limitNumber = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/limitNumber.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var ops = codegen_1.operators;
    var KWDs = {
      maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT },
      minimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT },
      exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE },
      exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }
    };
    var error = {
      message: ({ keyword, schemaCode }) => (0, codegen_1.str)`must be ${KWDs[keyword].okStr} ${schemaCode}`,
      params: ({ keyword, schemaCode }) => (0, codegen_1._)`{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`
    };
    var def = {
      keyword: Object.keys(KWDs),
      type: "number",
      schemaType: "number",
      $data: true,
      error,
      code(cxt) {
        const { keyword, data, schemaCode } = cxt;
        cxt.fail$data((0, codegen_1._)`${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`);
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/multipleOf.js
var require_multipleOf = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/multipleOf.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var error = {
      message: ({ schemaCode }) => (0, codegen_1.str)`must be multiple of ${schemaCode}`,
      params: ({ schemaCode }) => (0, codegen_1._)`{multipleOf: ${schemaCode}}`
    };
    var def = {
      keyword: "multipleOf",
      type: "number",
      schemaType: "number",
      $data: true,
      error,
      code(cxt) {
        const { gen, data, schemaCode, it } = cxt;
        const prec = it.opts.multipleOfPrecision;
        const res = gen.let("res");
        const invalid = prec ? (0, codegen_1._)`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` : (0, codegen_1._)`${res} !== parseInt(${res})`;
        cxt.fail$data((0, codegen_1._)`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`);
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/runtime/ucs2length.js
var require_ucs2length = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/runtime/ucs2length.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    function ucs2length(str) {
      const len = str.length;
      let length = 0;
      let pos = 0;
      let value;
      while (pos < len) {
        length++;
        value = str.charCodeAt(pos++);
        if (value >= 55296 && value <= 56319 && pos < len) {
          value = str.charCodeAt(pos);
          if ((value & 64512) === 56320)
            pos++;
        }
      }
      return length;
    }
    exports5.default = ucs2length;
    ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/limitLength.js
var require_limitLength = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/limitLength.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var ucs2length_1 = require_ucs2length();
    var error = {
      message({ keyword, schemaCode }) {
        const comp = keyword === "maxLength" ? "more" : "fewer";
        return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} characters`;
      },
      params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`
    };
    var def = {
      keyword: ["maxLength", "minLength"],
      type: "string",
      schemaType: "number",
      $data: true,
      error,
      code(cxt) {
        const { keyword, data, schemaCode, it } = cxt;
        const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT;
        const len = it.opts.unicode === false ? (0, codegen_1._)`${data}.length` : (0, codegen_1._)`${(0, util_1.useFunc)(cxt.gen, ucs2length_1.default)}(${data})`;
        cxt.fail$data((0, codegen_1._)`${len} ${op} ${schemaCode}`);
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/pattern.js
var require_pattern = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/pattern.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var code_1 = require_code2();
    var codegen_1 = require_codegen();
    var error = {
      message: ({ schemaCode }) => (0, codegen_1.str)`must match pattern "${schemaCode}"`,
      params: ({ schemaCode }) => (0, codegen_1._)`{pattern: ${schemaCode}}`
    };
    var def = {
      keyword: "pattern",
      type: "string",
      schemaType: "string",
      $data: true,
      error,
      code(cxt) {
        const { data, $data, schema: schema4, schemaCode, it } = cxt;
        const u = it.opts.unicodeRegExp ? "u" : "";
        const regExp = $data ? (0, codegen_1._)`(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema4);
        cxt.fail$data((0, codegen_1._)`!${regExp}.test(${data})`);
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/limitProperties.js
var require_limitProperties = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/limitProperties.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var error = {
      message({ keyword, schemaCode }) {
        const comp = keyword === "maxProperties" ? "more" : "fewer";
        return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} properties`;
      },
      params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`
    };
    var def = {
      keyword: ["maxProperties", "minProperties"],
      type: "object",
      schemaType: "number",
      $data: true,
      error,
      code(cxt) {
        const { keyword, data, schemaCode } = cxt;
        const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT;
        cxt.fail$data((0, codegen_1._)`Object.keys(${data}).length ${op} ${schemaCode}`);
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/required.js
var require_required = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/required.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var code_1 = require_code2();
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var error = {
      message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
      params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
    };
    var def = {
      keyword: "required",
      type: "object",
      schemaType: "array",
      $data: true,
      error,
      code(cxt) {
        const { gen, schema: schema4, schemaCode, data, $data, it } = cxt;
        const { opts } = it;
        if (!$data && schema4.length === 0)
          return;
        const useLoop = schema4.length >= opts.loopRequired;
        if (it.allErrors)
          allErrorsMode();
        else
          exitOnErrorMode();
        if (opts.strictRequired) {
          const props = cxt.parentSchema.properties;
          const { definedProperties } = cxt.it;
          for (const requiredKey of schema4) {
            if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === void 0 && !definedProperties.has(requiredKey)) {
              const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
              const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`;
              (0, util_1.checkStrictMode)(it, msg, it.opts.strictRequired);
            }
          }
        }
        function allErrorsMode() {
          if (useLoop || $data) {
            cxt.block$data(codegen_1.nil, loopAllRequired);
          } else {
            for (const prop of schema4) {
              (0, code_1.checkReportMissingProp)(cxt, prop);
            }
          }
        }
        function exitOnErrorMode() {
          const missing = gen.let("missing");
          if (useLoop || $data) {
            const valid = gen.let("valid", true);
            cxt.block$data(valid, () => loopUntilMissing(missing, valid));
            cxt.ok(valid);
          } else {
            gen.if((0, code_1.checkMissingProp)(cxt, schema4, missing));
            (0, code_1.reportMissingProp)(cxt, missing);
            gen.else();
          }
        }
        function loopAllRequired() {
          gen.forOf("prop", schemaCode, (prop) => {
            cxt.setParams({ missingProperty: prop });
            gen.if((0, code_1.noPropertyInData)(gen, data, prop, opts.ownProperties), () => cxt.error());
          });
        }
        function loopUntilMissing(missing, valid) {
          cxt.setParams({ missingProperty: missing });
          gen.forOf(missing, schemaCode, () => {
            gen.assign(valid, (0, code_1.propertyInData)(gen, data, missing, opts.ownProperties));
            gen.if((0, codegen_1.not)(valid), () => {
              cxt.error();
              gen.break();
            });
          }, codegen_1.nil);
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/limitItems.js
var require_limitItems = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/limitItems.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var error = {
      message({ keyword, schemaCode }) {
        const comp = keyword === "maxItems" ? "more" : "fewer";
        return (0, codegen_1.str)`must NOT have ${comp} than ${schemaCode} items`;
      },
      params: ({ schemaCode }) => (0, codegen_1._)`{limit: ${schemaCode}}`
    };
    var def = {
      keyword: ["maxItems", "minItems"],
      type: "array",
      schemaType: "number",
      $data: true,
      error,
      code(cxt) {
        const { keyword, data, schemaCode } = cxt;
        const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT;
        cxt.fail$data((0, codegen_1._)`${data}.length ${op} ${schemaCode}`);
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/runtime/equal.js
var require_equal = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/runtime/equal.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var equal = require_fast_deep_equal();
    equal.code = 'require("ajv/dist/runtime/equal").default';
    exports5.default = equal;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js
var require_uniqueItems = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var dataType_1 = require_dataType();
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var equal_1 = require_equal();
    var error = {
      message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
      params: ({ params: { i, j } }) => (0, codegen_1._)`{i: ${i}, j: ${j}}`
    };
    var def = {
      keyword: "uniqueItems",
      type: "array",
      schemaType: "boolean",
      $data: true,
      error,
      code(cxt) {
        const { gen, data, $data, schema: schema4, parentSchema, schemaCode, it } = cxt;
        if (!$data && !schema4)
          return;
        const valid = gen.let("valid");
        const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : [];
        cxt.block$data(valid, validateUniqueItems, (0, codegen_1._)`${schemaCode} === false`);
        cxt.ok(valid);
        function validateUniqueItems() {
          const i = gen.let("i", (0, codegen_1._)`${data}.length`);
          const j = gen.let("j");
          cxt.setParams({ i, j });
          gen.assign(valid, true);
          gen.if((0, codegen_1._)`${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j));
        }
        function canOptimize() {
          return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array");
        }
        function loopN(i, j) {
          const item = gen.name("item");
          const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item, it.opts.strictNumbers, dataType_1.DataType.Wrong);
          const indices = gen.const("indices", (0, codegen_1._)`{}`);
          gen.for((0, codegen_1._)`;${i}--;`, () => {
            gen.let(item, (0, codegen_1._)`${data}[${i}]`);
            gen.if(wrongType, (0, codegen_1._)`continue`);
            if (itemTypes.length > 1)
              gen.if((0, codegen_1._)`typeof ${item} == "string"`, (0, codegen_1._)`${item} += "_"`);
            gen.if((0, codegen_1._)`typeof ${indices}[${item}] == "number"`, () => {
              gen.assign(j, (0, codegen_1._)`${indices}[${item}]`);
              cxt.error();
              gen.assign(valid, false).break();
            }).code((0, codegen_1._)`${indices}[${item}] = ${i}`);
          });
        }
        function loopN2(i, j) {
          const eql = (0, util_1.useFunc)(gen, equal_1.default);
          const outer = gen.name("outer");
          gen.label(outer).for((0, codegen_1._)`;${i}--;`, () => gen.for((0, codegen_1._)`${j} = ${i}; ${j}--;`, () => gen.if((0, codegen_1._)`${eql}(${data}[${i}], ${data}[${j}])`, () => {
            cxt.error();
            gen.assign(valid, false).break(outer);
          })));
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/const.js
var require_const = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/const.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var equal_1 = require_equal();
    var error = {
      message: "must be equal to constant",
      params: ({ schemaCode }) => (0, codegen_1._)`{allowedValue: ${schemaCode}}`
    };
    var def = {
      keyword: "const",
      $data: true,
      error,
      code(cxt) {
        const { gen, data, $data, schemaCode, schema: schema4 } = cxt;
        if ($data || schema4 && typeof schema4 == "object") {
          cxt.fail$data((0, codegen_1._)`!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`);
        } else {
          cxt.fail((0, codegen_1._)`${schema4} !== ${data}`);
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/enum.js
var require_enum = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/enum.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var equal_1 = require_equal();
    var error = {
      message: "must be equal to one of the allowed values",
      params: ({ schemaCode }) => (0, codegen_1._)`{allowedValues: ${schemaCode}}`
    };
    var def = {
      keyword: "enum",
      schemaType: "array",
      $data: true,
      error,
      code(cxt) {
        const { gen, data, $data, schema: schema4, schemaCode, it } = cxt;
        if (!$data && schema4.length === 0)
          throw new Error("enum must have non-empty array");
        const useLoop = schema4.length >= it.opts.loopEnum;
        let eql;
        const getEql = () => eql !== null && eql !== void 0 ? eql : eql = (0, util_1.useFunc)(gen, equal_1.default);
        let valid;
        if (useLoop || $data) {
          valid = gen.let("valid");
          cxt.block$data(valid, loopEnum);
        } else {
          if (!Array.isArray(schema4))
            throw new Error("ajv implementation error");
          const vSchema = gen.const("vSchema", schemaCode);
          valid = (0, codegen_1.or)(...schema4.map((_x, i) => equalCode(vSchema, i)));
        }
        cxt.pass(valid);
        function loopEnum() {
          gen.assign(valid, false);
          gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._)`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()));
        }
        function equalCode(vSchema, i) {
          const sch = schema4[i];
          return typeof sch === "object" && sch !== null ? (0, codegen_1._)`${getEql()}(${data}, ${vSchema}[${i}])` : (0, codegen_1._)`${data} === ${sch}`;
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/index.js
var require_validation = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var limitNumber_1 = require_limitNumber();
    var multipleOf_1 = require_multipleOf();
    var limitLength_1 = require_limitLength();
    var pattern_1 = require_pattern();
    var limitProperties_1 = require_limitProperties();
    var required_1 = require_required();
    var limitItems_1 = require_limitItems();
    var uniqueItems_1 = require_uniqueItems();
    var const_1 = require_const();
    var enum_1 = require_enum();
    var validation = [
      // number
      limitNumber_1.default,
      multipleOf_1.default,
      // string
      limitLength_1.default,
      pattern_1.default,
      // object
      limitProperties_1.default,
      required_1.default,
      // array
      limitItems_1.default,
      uniqueItems_1.default,
      // any
      { keyword: "type", schemaType: ["string", "array"] },
      { keyword: "nullable", schemaType: "boolean" },
      const_1.default,
      enum_1.default
    ];
    exports5.default = validation;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js
var require_additionalItems = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.validateAdditionalItems = void 0;
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var error = {
      message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
      params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
    };
    var def = {
      keyword: "additionalItems",
      type: "array",
      schemaType: ["boolean", "object"],
      before: "uniqueItems",
      error,
      code(cxt) {
        const { parentSchema, it } = cxt;
        const { items } = parentSchema;
        if (!Array.isArray(items)) {
          (0, util_1.checkStrictMode)(it, '"additionalItems" is ignored when "items" is not an array of schemas');
          return;
        }
        validateAdditionalItems(cxt, items);
      }
    };
    function validateAdditionalItems(cxt, items) {
      const { gen, schema: schema4, data, keyword, it } = cxt;
      it.items = true;
      const len = gen.const("len", (0, codegen_1._)`${data}.length`);
      if (schema4 === false) {
        cxt.setParams({ len: items.length });
        cxt.pass((0, codegen_1._)`${len} <= ${items.length}`);
      } else if (typeof schema4 == "object" && !(0, util_1.alwaysValidSchema)(it, schema4)) {
        const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items.length}`);
        gen.if((0, codegen_1.not)(valid), () => validateItems(valid));
        cxt.ok(valid);
      }
      function validateItems(valid) {
        gen.forRange("i", items.length, len, (i) => {
          cxt.subschema({ keyword, dataProp: i, dataPropType: util_1.Type.Num }, valid);
          if (!it.allErrors)
            gen.if((0, codegen_1.not)(valid), () => gen.break());
        });
      }
    }
    exports5.validateAdditionalItems = validateAdditionalItems;
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/items.js
var require_items = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/items.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.validateTuple = void 0;
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var code_1 = require_code2();
    var def = {
      keyword: "items",
      type: "array",
      schemaType: ["object", "array", "boolean"],
      before: "uniqueItems",
      code(cxt) {
        const { schema: schema4, it } = cxt;
        if (Array.isArray(schema4))
          return validateTuple(cxt, "additionalItems", schema4);
        it.items = true;
        if ((0, util_1.alwaysValidSchema)(it, schema4))
          return;
        cxt.ok((0, code_1.validateArray)(cxt));
      }
    };
    function validateTuple(cxt, extraItems, schArr = cxt.schema) {
      const { gen, parentSchema, data, keyword, it } = cxt;
      checkStrictTuple(parentSchema);
      if (it.opts.unevaluated && schArr.length && it.items !== true) {
        it.items = util_1.mergeEvaluated.items(gen, schArr.length, it.items);
      }
      const valid = gen.name("valid");
      const len = gen.const("len", (0, codegen_1._)`${data}.length`);
      schArr.forEach((sch, i) => {
        if ((0, util_1.alwaysValidSchema)(it, sch))
          return;
        gen.if((0, codegen_1._)`${len} > ${i}`, () => cxt.subschema({
          keyword,
          schemaProp: i,
          dataProp: i
        }, valid));
        cxt.ok(valid);
      });
      function checkStrictTuple(sch) {
        const { opts, errSchemaPath } = it;
        const l = schArr.length;
        const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false);
        if (opts.strictTuples && !fullTuple) {
          const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`;
          (0, util_1.checkStrictMode)(it, msg, opts.strictTuples);
        }
      }
    }
    exports5.validateTuple = validateTuple;
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js
var require_prefixItems = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var items_1 = require_items();
    var def = {
      keyword: "prefixItems",
      type: "array",
      schemaType: ["array"],
      before: "uniqueItems",
      code: (cxt) => (0, items_1.validateTuple)(cxt, "items")
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/items2020.js
var require_items2020 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/items2020.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var code_1 = require_code2();
    var additionalItems_1 = require_additionalItems();
    var error = {
      message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
      params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
    };
    var def = {
      keyword: "items",
      type: "array",
      schemaType: ["object", "boolean"],
      before: "uniqueItems",
      error,
      code(cxt) {
        const { schema: schema4, parentSchema, it } = cxt;
        const { prefixItems } = parentSchema;
        it.items = true;
        if ((0, util_1.alwaysValidSchema)(it, schema4))
          return;
        if (prefixItems)
          (0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems);
        else
          cxt.ok((0, code_1.validateArray)(cxt));
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/contains.js
var require_contains = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/contains.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var error = {
      message: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
      params: ({ params: { min, max } }) => max === void 0 ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
    };
    var def = {
      keyword: "contains",
      type: "array",
      schemaType: ["object", "boolean"],
      before: "uniqueItems",
      trackErrors: true,
      error,
      code(cxt) {
        const { gen, schema: schema4, parentSchema, data, it } = cxt;
        let min;
        let max;
        const { minContains, maxContains } = parentSchema;
        if (it.opts.next) {
          min = minContains === void 0 ? 1 : minContains;
          max = maxContains;
        } else {
          min = 1;
        }
        const len = gen.const("len", (0, codegen_1._)`${data}.length`);
        cxt.setParams({ min, max });
        if (max === void 0 && min === 0) {
          (0, util_1.checkStrictMode)(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`);
          return;
        }
        if (max !== void 0 && min > max) {
          (0, util_1.checkStrictMode)(it, `"minContains" > "maxContains" is always invalid`);
          cxt.fail();
          return;
        }
        if ((0, util_1.alwaysValidSchema)(it, schema4)) {
          let cond = (0, codegen_1._)`${len} >= ${min}`;
          if (max !== void 0)
            cond = (0, codegen_1._)`${cond} && ${len} <= ${max}`;
          cxt.pass(cond);
          return;
        }
        it.items = true;
        const valid = gen.name("valid");
        if (max === void 0 && min === 1) {
          validateItems(valid, () => gen.if(valid, () => gen.break()));
        } else if (min === 0) {
          gen.let(valid, true);
          if (max !== void 0)
            gen.if((0, codegen_1._)`${data}.length > 0`, validateItemsWithCount);
        } else {
          gen.let(valid, false);
          validateItemsWithCount();
        }
        cxt.result(valid, () => cxt.reset());
        function validateItemsWithCount() {
          const schValid = gen.name("_valid");
          const count = gen.let("count", 0);
          validateItems(schValid, () => gen.if(schValid, () => checkLimits(count)));
        }
        function validateItems(_valid, block) {
          gen.forRange("i", 0, len, (i) => {
            cxt.subschema({
              keyword: "contains",
              dataProp: i,
              dataPropType: util_1.Type.Num,
              compositeRule: true
            }, _valid);
            block();
          });
        }
        function checkLimits(count) {
          gen.code((0, codegen_1._)`${count}++`);
          if (max === void 0) {
            gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true).break());
          } else {
            gen.if((0, codegen_1._)`${count} > ${max}`, () => gen.assign(valid, false).break());
            if (min === 1)
              gen.assign(valid, true);
            else
              gen.if((0, codegen_1._)`${count} >= ${min}`, () => gen.assign(valid, true));
          }
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/dependencies.js
var require_dependencies = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/dependencies.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.validateSchemaDeps = exports5.validatePropertyDeps = exports5.error = void 0;
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var code_1 = require_code2();
    exports5.error = {
      message: ({ params: { property, depsCount, deps } }) => {
        const property_ies = depsCount === 1 ? "property" : "properties";
        return (0, codegen_1.str)`must have ${property_ies} ${deps} when property ${property} is present`;
      },
      params: ({ params: { property, depsCount, deps, missingProperty } }) => (0, codegen_1._)`{property: ${property},
    missingProperty: ${missingProperty},
    depsCount: ${depsCount},
    deps: ${deps}}`
      // TODO change to reference
    };
    var def = {
      keyword: "dependencies",
      type: "object",
      schemaType: "object",
      error: exports5.error,
      code(cxt) {
        const [propDeps, schDeps] = splitDependencies(cxt);
        validatePropertyDeps(cxt, propDeps);
        validateSchemaDeps(cxt, schDeps);
      }
    };
    function splitDependencies({ schema: schema4 }) {
      const propertyDeps = {};
      const schemaDeps = {};
      for (const key in schema4) {
        if (key === "__proto__")
          continue;
        const deps = Array.isArray(schema4[key]) ? propertyDeps : schemaDeps;
        deps[key] = schema4[key];
      }
      return [propertyDeps, schemaDeps];
    }
    function validatePropertyDeps(cxt, propertyDeps = cxt.schema) {
      const { gen, data, it } = cxt;
      if (Object.keys(propertyDeps).length === 0)
        return;
      const missing = gen.let("missing");
      for (const prop in propertyDeps) {
        const deps = propertyDeps[prop];
        if (deps.length === 0)
          continue;
        const hasProperty = (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties);
        cxt.setParams({
          property: prop,
          depsCount: deps.length,
          deps: deps.join(", ")
        });
        if (it.allErrors) {
          gen.if(hasProperty, () => {
            for (const depProp of deps) {
              (0, code_1.checkReportMissingProp)(cxt, depProp);
            }
          });
        } else {
          gen.if((0, codegen_1._)`${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps, missing)})`);
          (0, code_1.reportMissingProp)(cxt, missing);
          gen.else();
        }
      }
    }
    exports5.validatePropertyDeps = validatePropertyDeps;
    function validateSchemaDeps(cxt, schemaDeps = cxt.schema) {
      const { gen, data, keyword, it } = cxt;
      const valid = gen.name("valid");
      for (const prop in schemaDeps) {
        if ((0, util_1.alwaysValidSchema)(it, schemaDeps[prop]))
          continue;
        gen.if(
          (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties),
          () => {
            const schCxt = cxt.subschema({ keyword, schemaProp: prop }, valid);
            cxt.mergeValidEvaluated(schCxt, valid);
          },
          () => gen.var(valid, true)
          // TODO var
        );
        cxt.ok(valid);
      }
    }
    exports5.validateSchemaDeps = validateSchemaDeps;
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js
var require_propertyNames = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var error = {
      message: "property name must be valid",
      params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
    };
    var def = {
      keyword: "propertyNames",
      type: "object",
      schemaType: ["object", "boolean"],
      error,
      code(cxt) {
        const { gen, schema: schema4, data, it } = cxt;
        if ((0, util_1.alwaysValidSchema)(it, schema4))
          return;
        const valid = gen.name("valid");
        gen.forIn("key", data, (key) => {
          cxt.setParams({ propertyName: key });
          cxt.subschema({
            keyword: "propertyNames",
            data: key,
            dataTypes: ["string"],
            propertyName: key,
            compositeRule: true
          }, valid);
          gen.if((0, codegen_1.not)(valid), () => {
            cxt.error(true);
            if (!it.allErrors)
              gen.break();
          });
        });
        cxt.ok(valid);
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js
var require_additionalProperties = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var code_1 = require_code2();
    var codegen_1 = require_codegen();
    var names_1 = require_names();
    var util_1 = require_util2();
    var error = {
      message: "must NOT have additional properties",
      params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
    };
    var def = {
      keyword: "additionalProperties",
      type: ["object"],
      schemaType: ["boolean", "object"],
      allowUndefined: true,
      trackErrors: true,
      error,
      code(cxt) {
        const { gen, schema: schema4, parentSchema, data, errsCount, it } = cxt;
        if (!errsCount)
          throw new Error("ajv implementation error");
        const { allErrors, opts } = it;
        it.props = true;
        if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema4))
          return;
        const props = (0, code_1.allSchemaProperties)(parentSchema.properties);
        const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties);
        checkAdditionalProperties();
        cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
        function checkAdditionalProperties() {
          gen.forIn("key", data, (key) => {
            if (!props.length && !patProps.length)
              additionalPropertyCode(key);
            else
              gen.if(isAdditional(key), () => additionalPropertyCode(key));
          });
        }
        function isAdditional(key) {
          let definedProp;
          if (props.length > 8) {
            const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties");
            definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key);
          } else if (props.length) {
            definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._)`${key} === ${p}`));
          } else {
            definedProp = codegen_1.nil;
          }
          if (patProps.length) {
            definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._)`${(0, code_1.usePattern)(cxt, p)}.test(${key})`));
          }
          return (0, codegen_1.not)(definedProp);
        }
        function deleteAdditional(key) {
          gen.code((0, codegen_1._)`delete ${data}[${key}]`);
        }
        function additionalPropertyCode(key) {
          if (opts.removeAdditional === "all" || opts.removeAdditional && schema4 === false) {
            deleteAdditional(key);
            return;
          }
          if (schema4 === false) {
            cxt.setParams({ additionalProperty: key });
            cxt.error();
            if (!allErrors)
              gen.break();
            return;
          }
          if (typeof schema4 == "object" && !(0, util_1.alwaysValidSchema)(it, schema4)) {
            const valid = gen.name("valid");
            if (opts.removeAdditional === "failing") {
              applyAdditionalSchema(key, valid, false);
              gen.if((0, codegen_1.not)(valid), () => {
                cxt.reset();
                deleteAdditional(key);
              });
            } else {
              applyAdditionalSchema(key, valid);
              if (!allErrors)
                gen.if((0, codegen_1.not)(valid), () => gen.break());
            }
          }
        }
        function applyAdditionalSchema(key, valid, errors) {
          const subschema = {
            keyword: "additionalProperties",
            dataProp: key,
            dataPropType: util_1.Type.Str
          };
          if (errors === false) {
            Object.assign(subschema, {
              compositeRule: true,
              createErrors: false,
              allErrors: false
            });
          }
          cxt.subschema(subschema, valid);
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/properties.js
var require_properties = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/properties.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var validate_1 = require_validate();
    var code_1 = require_code2();
    var util_1 = require_util2();
    var additionalProperties_1 = require_additionalProperties();
    var def = {
      keyword: "properties",
      type: "object",
      schemaType: "object",
      code(cxt) {
        const { gen, schema: schema4, parentSchema, data, it } = cxt;
        if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === void 0) {
          additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties"));
        }
        const allProps = (0, code_1.allSchemaProperties)(schema4);
        for (const prop of allProps) {
          it.definedProperties.add(prop);
        }
        if (it.opts.unevaluated && allProps.length && it.props !== true) {
          it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props);
        }
        const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema4[p]));
        if (properties.length === 0)
          return;
        const valid = gen.name("valid");
        for (const prop of properties) {
          if (hasDefault(prop)) {
            applyPropertySchema(prop);
          } else {
            gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties));
            applyPropertySchema(prop);
            if (!it.allErrors)
              gen.else().var(valid, true);
            gen.endIf();
          }
          cxt.it.definedProperties.add(prop);
          cxt.ok(valid);
        }
        function hasDefault(prop) {
          return it.opts.useDefaults && !it.compositeRule && schema4[prop].default !== void 0;
        }
        function applyPropertySchema(prop) {
          cxt.subschema({
            keyword: "properties",
            schemaProp: prop,
            dataProp: prop
          }, valid);
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js
var require_patternProperties = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var code_1 = require_code2();
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var util_2 = require_util2();
    var def = {
      keyword: "patternProperties",
      type: "object",
      schemaType: "object",
      code(cxt) {
        const { gen, schema: schema4, data, parentSchema, it } = cxt;
        const { opts } = it;
        const patterns = (0, code_1.allSchemaProperties)(schema4);
        const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema4[p]));
        if (patterns.length === 0 || alwaysValidPatterns.length === patterns.length && (!it.opts.unevaluated || it.props === true)) {
          return;
        }
        const checkProperties = opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties;
        const valid = gen.name("valid");
        if (it.props !== true && !(it.props instanceof codegen_1.Name)) {
          it.props = (0, util_2.evaluatedPropsToName)(gen, it.props);
        }
        const { props } = it;
        validatePatternProperties();
        function validatePatternProperties() {
          for (const pat of patterns) {
            if (checkProperties)
              checkMatchingProperties(pat);
            if (it.allErrors) {
              validateProperties(pat);
            } else {
              gen.var(valid, true);
              validateProperties(pat);
              gen.if(valid);
            }
          }
        }
        function checkMatchingProperties(pat) {
          for (const prop in checkProperties) {
            if (new RegExp(pat).test(prop)) {
              (0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`);
            }
          }
        }
        function validateProperties(pat) {
          gen.forIn("key", data, (key) => {
            gen.if((0, codegen_1._)`${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => {
              const alwaysValid = alwaysValidPatterns.includes(pat);
              if (!alwaysValid) {
                cxt.subschema({
                  keyword: "patternProperties",
                  schemaProp: pat,
                  dataProp: key,
                  dataPropType: util_2.Type.Str
                }, valid);
              }
              if (it.opts.unevaluated && props !== true) {
                gen.assign((0, codegen_1._)`${props}[${key}]`, true);
              } else if (!alwaysValid && !it.allErrors) {
                gen.if((0, codegen_1.not)(valid), () => gen.break());
              }
            });
          });
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/not.js
var require_not = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/not.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var util_1 = require_util2();
    var def = {
      keyword: "not",
      schemaType: ["object", "boolean"],
      trackErrors: true,
      code(cxt) {
        const { gen, schema: schema4, it } = cxt;
        if ((0, util_1.alwaysValidSchema)(it, schema4)) {
          cxt.fail();
          return;
        }
        const valid = gen.name("valid");
        cxt.subschema({
          keyword: "not",
          compositeRule: true,
          createErrors: false,
          allErrors: false
        }, valid);
        cxt.failResult(valid, () => cxt.reset(), () => cxt.error());
      },
      error: { message: "must NOT be valid" }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/anyOf.js
var require_anyOf = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/anyOf.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var code_1 = require_code2();
    var def = {
      keyword: "anyOf",
      schemaType: "array",
      trackErrors: true,
      code: code_1.validateUnion,
      error: { message: "must match a schema in anyOf" }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/oneOf.js
var require_oneOf = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/oneOf.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var error = {
      message: "must match exactly one schema in oneOf",
      params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
    };
    var def = {
      keyword: "oneOf",
      schemaType: "array",
      trackErrors: true,
      error,
      code(cxt) {
        const { gen, schema: schema4, parentSchema, it } = cxt;
        if (!Array.isArray(schema4))
          throw new Error("ajv implementation error");
        if (it.opts.discriminator && parentSchema.discriminator)
          return;
        const schArr = schema4;
        const valid = gen.let("valid", false);
        const passing = gen.let("passing", null);
        const schValid = gen.name("_valid");
        cxt.setParams({ passing });
        gen.block(validateOneOf);
        cxt.result(valid, () => cxt.reset(), () => cxt.error(true));
        function validateOneOf() {
          schArr.forEach((sch, i) => {
            let schCxt;
            if ((0, util_1.alwaysValidSchema)(it, sch)) {
              gen.var(schValid, true);
            } else {
              schCxt = cxt.subschema({
                keyword: "oneOf",
                schemaProp: i,
                compositeRule: true
              }, schValid);
            }
            if (i > 0) {
              gen.if((0, codegen_1._)`${schValid} && ${valid}`).assign(valid, false).assign(passing, (0, codegen_1._)`[${passing}, ${i}]`).else();
            }
            gen.if(schValid, () => {
              gen.assign(valid, true);
              gen.assign(passing, i);
              if (schCxt)
                cxt.mergeEvaluated(schCxt, codegen_1.Name);
            });
          });
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/allOf.js
var require_allOf = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/allOf.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var util_1 = require_util2();
    var def = {
      keyword: "allOf",
      schemaType: "array",
      code(cxt) {
        const { gen, schema: schema4, it } = cxt;
        if (!Array.isArray(schema4))
          throw new Error("ajv implementation error");
        const valid = gen.name("valid");
        schema4.forEach((sch, i) => {
          if ((0, util_1.alwaysValidSchema)(it, sch))
            return;
          const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid);
          cxt.ok(valid);
          cxt.mergeEvaluated(schCxt);
        });
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/if.js
var require_if = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/if.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var error = {
      message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
      params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
    };
    var def = {
      keyword: "if",
      schemaType: ["object", "boolean"],
      trackErrors: true,
      error,
      code(cxt) {
        const { gen, parentSchema, it } = cxt;
        if (parentSchema.then === void 0 && parentSchema.else === void 0) {
          (0, util_1.checkStrictMode)(it, '"if" without "then" and "else" is ignored');
        }
        const hasThen = hasSchema(it, "then");
        const hasElse = hasSchema(it, "else");
        if (!hasThen && !hasElse)
          return;
        const valid = gen.let("valid", true);
        const schValid = gen.name("_valid");
        validateIf();
        cxt.reset();
        if (hasThen && hasElse) {
          const ifClause = gen.let("ifClause");
          cxt.setParams({ ifClause });
          gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause));
        } else if (hasThen) {
          gen.if(schValid, validateClause("then"));
        } else {
          gen.if((0, codegen_1.not)(schValid), validateClause("else"));
        }
        cxt.pass(valid, () => cxt.error(true));
        function validateIf() {
          const schCxt = cxt.subschema({
            keyword: "if",
            compositeRule: true,
            createErrors: false,
            allErrors: false
          }, schValid);
          cxt.mergeEvaluated(schCxt);
        }
        function validateClause(keyword, ifClause) {
          return () => {
            const schCxt = cxt.subschema({ keyword }, schValid);
            gen.assign(valid, schValid);
            cxt.mergeValidEvaluated(schCxt, valid);
            if (ifClause)
              gen.assign(ifClause, (0, codegen_1._)`${keyword}`);
            else
              cxt.setParams({ ifClause: keyword });
          };
        }
      }
    };
    function hasSchema(it, keyword) {
      const schema4 = it.schema[keyword];
      return schema4 !== void 0 && !(0, util_1.alwaysValidSchema)(it, schema4);
    }
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/thenElse.js
var require_thenElse = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/thenElse.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var util_1 = require_util2();
    var def = {
      keyword: ["then", "else"],
      schemaType: ["object", "boolean"],
      code({ keyword, parentSchema, it }) {
        if (parentSchema.if === void 0)
          (0, util_1.checkStrictMode)(it, `"${keyword}" without "if" is ignored`);
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/index.js
var require_applicator = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var additionalItems_1 = require_additionalItems();
    var prefixItems_1 = require_prefixItems();
    var items_1 = require_items();
    var items2020_1 = require_items2020();
    var contains_1 = require_contains();
    var dependencies_1 = require_dependencies();
    var propertyNames_1 = require_propertyNames();
    var additionalProperties_1 = require_additionalProperties();
    var properties_1 = require_properties();
    var patternProperties_1 = require_patternProperties();
    var not_1 = require_not();
    var anyOf_1 = require_anyOf();
    var oneOf_1 = require_oneOf();
    var allOf_1 = require_allOf();
    var if_1 = require_if();
    var thenElse_1 = require_thenElse();
    function getApplicator(draft2020 = false) {
      const applicator = [
        // any
        not_1.default,
        anyOf_1.default,
        oneOf_1.default,
        allOf_1.default,
        if_1.default,
        thenElse_1.default,
        // object
        propertyNames_1.default,
        additionalProperties_1.default,
        dependencies_1.default,
        properties_1.default,
        patternProperties_1.default
      ];
      if (draft2020)
        applicator.push(prefixItems_1.default, items2020_1.default);
      else
        applicator.push(additionalItems_1.default, items_1.default);
      applicator.push(contains_1.default);
      return applicator;
    }
    exports5.default = getApplicator;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js
var require_dynamicAnchor = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.dynamicAnchor = void 0;
    var codegen_1 = require_codegen();
    var names_1 = require_names();
    var compile_1 = require_compile();
    var ref_1 = require_ref();
    var def = {
      keyword: "$dynamicAnchor",
      schemaType: "string",
      code: (cxt) => dynamicAnchor(cxt, cxt.schema)
    };
    function dynamicAnchor(cxt, anchor) {
      const { gen, it } = cxt;
      it.schemaEnv.root.dynamicAnchors[anchor] = true;
      const v = (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`;
      const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt);
      gen.if((0, codegen_1._)`!${v}`, () => gen.assign(v, validate));
    }
    exports5.dynamicAnchor = dynamicAnchor;
    function _getValidate(cxt) {
      const { schemaEnv, schema: schema4, self: self2 } = cxt.it;
      const { root, baseId, localRefs, meta } = schemaEnv.root;
      const { schemaId } = self2.opts;
      const sch = new compile_1.SchemaEnv({ schema: schema4, schemaId, root, baseId, localRefs, meta });
      compile_1.compileSchema.call(self2, sch);
      return (0, ref_1.getValidate)(cxt, sch);
    }
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js
var require_dynamicRef = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.dynamicRef = void 0;
    var codegen_1 = require_codegen();
    var names_1 = require_names();
    var ref_1 = require_ref();
    var def = {
      keyword: "$dynamicRef",
      schemaType: "string",
      code: (cxt) => dynamicRef(cxt, cxt.schema)
    };
    function dynamicRef(cxt, ref) {
      const { gen, keyword, it } = cxt;
      if (ref[0] !== "#")
        throw new Error(`"${keyword}" only supports hash fragment reference`);
      const anchor = ref.slice(1);
      if (it.allErrors) {
        _dynamicRef();
      } else {
        const valid = gen.let("valid", false);
        _dynamicRef(valid);
        cxt.ok(valid);
      }
      function _dynamicRef(valid) {
        if (it.schemaEnv.root.dynamicAnchors[anchor]) {
          const v = gen.let("_v", (0, codegen_1._)`${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`);
          gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid));
        } else {
          _callRef(it.validateName, valid)();
        }
      }
      function _callRef(validate, valid) {
        return valid ? () => gen.block(() => {
          (0, ref_1.callRef)(cxt, validate);
          gen.let(valid, true);
        }) : () => (0, ref_1.callRef)(cxt, validate);
      }
    }
    exports5.dynamicRef = dynamicRef;
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js
var require_recursiveAnchor = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var dynamicAnchor_1 = require_dynamicAnchor();
    var util_1 = require_util2();
    var def = {
      keyword: "$recursiveAnchor",
      schemaType: "boolean",
      code(cxt) {
        if (cxt.schema)
          (0, dynamicAnchor_1.dynamicAnchor)(cxt, "");
        else
          (0, util_1.checkStrictMode)(cxt.it, "$recursiveAnchor: false is ignored");
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js
var require_recursiveRef = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var dynamicRef_1 = require_dynamicRef();
    var def = {
      keyword: "$recursiveRef",
      schemaType: "string",
      code: (cxt) => (0, dynamicRef_1.dynamicRef)(cxt, cxt.schema)
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/dynamic/index.js
var require_dynamic = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/dynamic/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var dynamicAnchor_1 = require_dynamicAnchor();
    var dynamicRef_1 = require_dynamicRef();
    var recursiveAnchor_1 = require_recursiveAnchor();
    var recursiveRef_1 = require_recursiveRef();
    var dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default];
    exports5.default = dynamic;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js
var require_dependentRequired = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var dependencies_1 = require_dependencies();
    var def = {
      keyword: "dependentRequired",
      type: "object",
      schemaType: "object",
      error: dependencies_1.error,
      code: (cxt) => (0, dependencies_1.validatePropertyDeps)(cxt)
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js
var require_dependentSchemas = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var dependencies_1 = require_dependencies();
    var def = {
      keyword: "dependentSchemas",
      type: "object",
      schemaType: "object",
      code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt)
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/limitContains.js
var require_limitContains = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/validation/limitContains.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var util_1 = require_util2();
    var def = {
      keyword: ["maxContains", "minContains"],
      type: "array",
      schemaType: "number",
      code({ keyword, parentSchema, it }) {
        if (parentSchema.contains === void 0) {
          (0, util_1.checkStrictMode)(it, `"${keyword}" without "contains" is ignored`);
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/next.js
var require_next = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/next.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var dependentRequired_1 = require_dependentRequired();
    var dependentSchemas_1 = require_dependentSchemas();
    var limitContains_1 = require_limitContains();
    var next = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default];
    exports5.default = next;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js
var require_unevaluatedProperties = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var names_1 = require_names();
    var error = {
      message: "must NOT have unevaluated properties",
      params: ({ params }) => (0, codegen_1._)`{unevaluatedProperty: ${params.unevaluatedProperty}}`
    };
    var def = {
      keyword: "unevaluatedProperties",
      type: "object",
      schemaType: ["boolean", "object"],
      trackErrors: true,
      error,
      code(cxt) {
        const { gen, schema: schema4, data, errsCount, it } = cxt;
        if (!errsCount)
          throw new Error("ajv implementation error");
        const { allErrors, props } = it;
        if (props instanceof codegen_1.Name) {
          gen.if((0, codegen_1._)`${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key))));
        } else if (props !== true) {
          gen.forIn("key", data, (key) => props === void 0 ? unevaluatedPropCode(key) : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)));
        }
        it.props = true;
        cxt.ok((0, codegen_1._)`${errsCount} === ${names_1.default.errors}`);
        function unevaluatedPropCode(key) {
          if (schema4 === false) {
            cxt.setParams({ unevaluatedProperty: key });
            cxt.error();
            if (!allErrors)
              gen.break();
            return;
          }
          if (!(0, util_1.alwaysValidSchema)(it, schema4)) {
            const valid = gen.name("valid");
            cxt.subschema({
              keyword: "unevaluatedProperties",
              dataProp: key,
              dataPropType: util_1.Type.Str
            }, valid);
            if (!allErrors)
              gen.if((0, codegen_1.not)(valid), () => gen.break());
          }
        }
        function unevaluatedDynamic(evaluatedProps, key) {
          return (0, codegen_1._)`!${evaluatedProps} || !${evaluatedProps}[${key}]`;
        }
        function unevaluatedStatic(evaluatedProps, key) {
          const ps = [];
          for (const p in evaluatedProps) {
            if (evaluatedProps[p] === true)
              ps.push((0, codegen_1._)`${key} !== ${p}`);
          }
          return (0, codegen_1.and)(...ps);
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js
var require_unevaluatedItems = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var util_1 = require_util2();
    var error = {
      message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
      params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
    };
    var def = {
      keyword: "unevaluatedItems",
      type: "array",
      schemaType: ["boolean", "object"],
      error,
      code(cxt) {
        const { gen, schema: schema4, data, it } = cxt;
        const items = it.items || 0;
        if (items === true)
          return;
        const len = gen.const("len", (0, codegen_1._)`${data}.length`);
        if (schema4 === false) {
          cxt.setParams({ len: items });
          cxt.fail((0, codegen_1._)`${len} > ${items}`);
        } else if (typeof schema4 == "object" && !(0, util_1.alwaysValidSchema)(it, schema4)) {
          const valid = gen.var("valid", (0, codegen_1._)`${len} <= ${items}`);
          gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items));
          cxt.ok(valid);
        }
        it.items = true;
        function validateItems(valid, from) {
          gen.forRange("i", from, len, (i) => {
            cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: util_1.Type.Num }, valid);
            if (!it.allErrors)
              gen.if((0, codegen_1.not)(valid), () => gen.break());
          });
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/unevaluated/index.js
var require_unevaluated = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/unevaluated/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var unevaluatedProperties_1 = require_unevaluatedProperties();
    var unevaluatedItems_1 = require_unevaluatedItems();
    var unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default];
    exports5.default = unevaluated;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/format/format.js
var require_format = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/format/format.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var error = {
      message: ({ schemaCode }) => (0, codegen_1.str)`must match format "${schemaCode}"`,
      params: ({ schemaCode }) => (0, codegen_1._)`{format: ${schemaCode}}`
    };
    var def = {
      keyword: "format",
      type: ["number", "string"],
      schemaType: "string",
      $data: true,
      error,
      code(cxt, ruleType) {
        const { gen, data, $data, schema: schema4, schemaCode, it } = cxt;
        const { opts, errSchemaPath, schemaEnv, self: self2 } = it;
        if (!opts.validateFormats)
          return;
        if ($data)
          validate$DataFormat();
        else
          validateFormat();
        function validate$DataFormat() {
          const fmts = gen.scopeValue("formats", {
            ref: self2.formats,
            code: opts.code.formats
          });
          const fDef = gen.const("fDef", (0, codegen_1._)`${fmts}[${schemaCode}]`);
          const fType = gen.let("fType");
          const format3 = gen.let("format");
          gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(format3, (0, codegen_1._)`${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._)`"string"`).assign(format3, fDef));
          cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt()));
          function unknownFmt() {
            if (opts.strictSchema === false)
              return codegen_1.nil;
            return (0, codegen_1._)`${schemaCode} && !${format3}`;
          }
          function invalidFmt() {
            const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format3}(${data}) : ${format3}(${data}))` : (0, codegen_1._)`${format3}(${data})`;
            const validData = (0, codegen_1._)`(typeof ${format3} == "function" ? ${callFormat} : ${format3}.test(${data}))`;
            return (0, codegen_1._)`${format3} && ${format3} !== true && ${fType} === ${ruleType} && !${validData}`;
          }
        }
        function validateFormat() {
          const formatDef = self2.formats[schema4];
          if (!formatDef) {
            unknownFormat();
            return;
          }
          if (formatDef === true)
            return;
          const [fmtType, format3, fmtRef] = getFormat3(formatDef);
          if (fmtType === ruleType)
            cxt.pass(validCondition());
          function unknownFormat() {
            if (opts.strictSchema === false) {
              self2.logger.warn(unknownMsg());
              return;
            }
            throw new Error(unknownMsg());
            function unknownMsg() {
              return `unknown format "${schema4}" ignored in schema at path "${errSchemaPath}"`;
            }
          }
          function getFormat3(fmtDef) {
            const code2 = fmtDef instanceof RegExp ? (0, codegen_1.regexpCode)(fmtDef) : opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(schema4)}` : void 0;
            const fmt = gen.scopeValue("formats", { key: schema4, ref: fmtDef, code: code2 });
            if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) {
              return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._)`${fmt}.validate`];
            }
            return ["string", fmtDef, fmt];
          }
          function validCondition() {
            if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) {
              if (!schemaEnv.$async)
                throw new Error("async format in sync schema");
              return (0, codegen_1._)`await ${fmtRef}(${data})`;
            }
            return typeof format3 == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
          }
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/format/index.js
var require_format2 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/format/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var format_1 = require_format();
    var format3 = [format_1.default];
    exports5.default = format3;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/metadata.js
var require_metadata = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/metadata.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.contentVocabulary = exports5.metadataVocabulary = void 0;
    exports5.metadataVocabulary = [
      "title",
      "description",
      "default",
      "deprecated",
      "readOnly",
      "writeOnly",
      "examples"
    ];
    exports5.contentVocabulary = [
      "contentMediaType",
      "contentEncoding",
      "contentSchema"
    ];
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/draft2020.js
var require_draft2020 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/draft2020.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var core_1 = require_core2();
    var validation_1 = require_validation();
    var applicator_1 = require_applicator();
    var dynamic_1 = require_dynamic();
    var next_1 = require_next();
    var unevaluated_1 = require_unevaluated();
    var format_1 = require_format2();
    var metadata_1 = require_metadata();
    var draft2020Vocabularies = [
      dynamic_1.default,
      core_1.default,
      validation_1.default,
      (0, applicator_1.default)(true),
      format_1.default,
      metadata_1.metadataVocabulary,
      metadata_1.contentVocabulary,
      next_1.default,
      unevaluated_1.default
    ];
    exports5.default = draft2020Vocabularies;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/discriminator/types.js
var require_types = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/discriminator/types.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.DiscrError = void 0;
    var DiscrError;
    (function(DiscrError2) {
      DiscrError2["Tag"] = "tag";
      DiscrError2["Mapping"] = "mapping";
    })(DiscrError || (exports5.DiscrError = DiscrError = {}));
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/discriminator/index.js
var require_discriminator = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/vocabularies/discriminator/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var codegen_1 = require_codegen();
    var types_1 = require_types();
    var compile_1 = require_compile();
    var ref_error_1 = require_ref_error();
    var util_1 = require_util2();
    var error = {
      message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
      params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
    };
    var def = {
      keyword: "discriminator",
      type: "object",
      schemaType: "object",
      error,
      code(cxt) {
        const { gen, data, schema: schema4, parentSchema, it } = cxt;
        const { oneOf } = parentSchema;
        if (!it.opts.discriminator) {
          throw new Error("discriminator: requires discriminator option");
        }
        const tagName = schema4.propertyName;
        if (typeof tagName != "string")
          throw new Error("discriminator: requires propertyName");
        if (schema4.mapping)
          throw new Error("discriminator: mapping is not supported");
        if (!oneOf)
          throw new Error("discriminator: requires oneOf keyword");
        const valid = gen.let("valid", false);
        const tag = gen.const("tag", (0, codegen_1._)`${data}${(0, codegen_1.getProperty)(tagName)}`);
        gen.if((0, codegen_1._)`typeof ${tag} == "string"`, () => validateMapping(), () => cxt.error(false, { discrError: types_1.DiscrError.Tag, tag, tagName }));
        cxt.ok(valid);
        function validateMapping() {
          const mapping = getMapping();
          gen.if(false);
          for (const tagValue in mapping) {
            gen.elseIf((0, codegen_1._)`${tag} === ${tagValue}`);
            gen.assign(valid, applyTagSchema(mapping[tagValue]));
          }
          gen.else();
          cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag, tagName });
          gen.endIf();
        }
        function applyTagSchema(schemaProp) {
          const _valid = gen.name("valid");
          const schCxt = cxt.subschema({ keyword: "oneOf", schemaProp }, _valid);
          cxt.mergeEvaluated(schCxt, codegen_1.Name);
          return _valid;
        }
        function getMapping() {
          var _a;
          const oneOfMapping = {};
          const topRequired = hasRequired(parentSchema);
          let tagRequired = true;
          for (let i = 0; i < oneOf.length; i++) {
            let sch = oneOf[i];
            if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) {
              const ref = sch.$ref;
              sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref);
              if (sch instanceof compile_1.SchemaEnv)
                sch = sch.schema;
              if (sch === void 0)
                throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
            }
            const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName];
            if (typeof propSch != "object") {
              throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
            }
            tagRequired = tagRequired && (topRequired || hasRequired(sch));
            addMappings(propSch, i);
          }
          if (!tagRequired)
            throw new Error(`discriminator: "${tagName}" must be required`);
          return oneOfMapping;
          function hasRequired({ required }) {
            return Array.isArray(required) && required.includes(tagName);
          }
          function addMappings(sch, i) {
            if (sch.const) {
              addMapping(sch.const, i);
            } else if (sch.enum) {
              for (const tagValue of sch.enum) {
                addMapping(tagValue, i);
              }
            } else {
              throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`);
            }
          }
          function addMapping(tagValue, i) {
            if (typeof tagValue != "string" || tagValue in oneOfMapping) {
              throw new Error(`discriminator: "${tagName}" values must be unique strings`);
            }
            oneOfMapping[tagValue] = i;
          }
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json
var require_schema = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json"(exports5, module) {
    module.exports = {
      $schema: "https://json-schema.org/draft/2020-12/schema",
      $id: "https://json-schema.org/draft/2020-12/schema",
      $vocabulary: {
        "https://json-schema.org/draft/2020-12/vocab/core": true,
        "https://json-schema.org/draft/2020-12/vocab/applicator": true,
        "https://json-schema.org/draft/2020-12/vocab/unevaluated": true,
        "https://json-schema.org/draft/2020-12/vocab/validation": true,
        "https://json-schema.org/draft/2020-12/vocab/meta-data": true,
        "https://json-schema.org/draft/2020-12/vocab/format-annotation": true,
        "https://json-schema.org/draft/2020-12/vocab/content": true
      },
      $dynamicAnchor: "meta",
      title: "Core and Validation specifications meta-schema",
      allOf: [
        { $ref: "meta/core" },
        { $ref: "meta/applicator" },
        { $ref: "meta/unevaluated" },
        { $ref: "meta/validation" },
        { $ref: "meta/meta-data" },
        { $ref: "meta/format-annotation" },
        { $ref: "meta/content" }
      ],
      type: ["object", "boolean"],
      $comment: "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",
      properties: {
        definitions: {
          $comment: '"definitions" has been replaced by "$defs".',
          type: "object",
          additionalProperties: { $dynamicRef: "#meta" },
          deprecated: true,
          default: {}
        },
        dependencies: {
          $comment: '"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',
          type: "object",
          additionalProperties: {
            anyOf: [{ $dynamicRef: "#meta" }, { $ref: "meta/validation#/$defs/stringArray" }]
          },
          deprecated: true,
          default: {}
        },
        $recursiveAnchor: {
          $comment: '"$recursiveAnchor" has been replaced by "$dynamicAnchor".',
          $ref: "meta/core#/$defs/anchorString",
          deprecated: true
        },
        $recursiveRef: {
          $comment: '"$recursiveRef" has been replaced by "$dynamicRef".',
          $ref: "meta/core#/$defs/uriReferenceString",
          deprecated: true
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json
var require_applicator2 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json"(exports5, module) {
    module.exports = {
      $schema: "https://json-schema.org/draft/2020-12/schema",
      $id: "https://json-schema.org/draft/2020-12/meta/applicator",
      $vocabulary: {
        "https://json-schema.org/draft/2020-12/vocab/applicator": true
      },
      $dynamicAnchor: "meta",
      title: "Applicator vocabulary meta-schema",
      type: ["object", "boolean"],
      properties: {
        prefixItems: { $ref: "#/$defs/schemaArray" },
        items: { $dynamicRef: "#meta" },
        contains: { $dynamicRef: "#meta" },
        additionalProperties: { $dynamicRef: "#meta" },
        properties: {
          type: "object",
          additionalProperties: { $dynamicRef: "#meta" },
          default: {}
        },
        patternProperties: {
          type: "object",
          additionalProperties: { $dynamicRef: "#meta" },
          propertyNames: { format: "regex" },
          default: {}
        },
        dependentSchemas: {
          type: "object",
          additionalProperties: { $dynamicRef: "#meta" },
          default: {}
        },
        propertyNames: { $dynamicRef: "#meta" },
        if: { $dynamicRef: "#meta" },
        then: { $dynamicRef: "#meta" },
        else: { $dynamicRef: "#meta" },
        allOf: { $ref: "#/$defs/schemaArray" },
        anyOf: { $ref: "#/$defs/schemaArray" },
        oneOf: { $ref: "#/$defs/schemaArray" },
        not: { $dynamicRef: "#meta" }
      },
      $defs: {
        schemaArray: {
          type: "array",
          minItems: 1,
          items: { $dynamicRef: "#meta" }
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json
var require_unevaluated2 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json"(exports5, module) {
    module.exports = {
      $schema: "https://json-schema.org/draft/2020-12/schema",
      $id: "https://json-schema.org/draft/2020-12/meta/unevaluated",
      $vocabulary: {
        "https://json-schema.org/draft/2020-12/vocab/unevaluated": true
      },
      $dynamicAnchor: "meta",
      title: "Unevaluated applicator vocabulary meta-schema",
      type: ["object", "boolean"],
      properties: {
        unevaluatedItems: { $dynamicRef: "#meta" },
        unevaluatedProperties: { $dynamicRef: "#meta" }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json
var require_content = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json"(exports5, module) {
    module.exports = {
      $schema: "https://json-schema.org/draft/2020-12/schema",
      $id: "https://json-schema.org/draft/2020-12/meta/content",
      $vocabulary: {
        "https://json-schema.org/draft/2020-12/vocab/content": true
      },
      $dynamicAnchor: "meta",
      title: "Content vocabulary meta-schema",
      type: ["object", "boolean"],
      properties: {
        contentEncoding: { type: "string" },
        contentMediaType: { type: "string" },
        contentSchema: { $dynamicRef: "#meta" }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json
var require_core3 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json"(exports5, module) {
    module.exports = {
      $schema: "https://json-schema.org/draft/2020-12/schema",
      $id: "https://json-schema.org/draft/2020-12/meta/core",
      $vocabulary: {
        "https://json-schema.org/draft/2020-12/vocab/core": true
      },
      $dynamicAnchor: "meta",
      title: "Core vocabulary meta-schema",
      type: ["object", "boolean"],
      properties: {
        $id: {
          $ref: "#/$defs/uriReferenceString",
          $comment: "Non-empty fragments not allowed.",
          pattern: "^[^#]*#?$"
        },
        $schema: { $ref: "#/$defs/uriString" },
        $ref: { $ref: "#/$defs/uriReferenceString" },
        $anchor: { $ref: "#/$defs/anchorString" },
        $dynamicRef: { $ref: "#/$defs/uriReferenceString" },
        $dynamicAnchor: { $ref: "#/$defs/anchorString" },
        $vocabulary: {
          type: "object",
          propertyNames: { $ref: "#/$defs/uriString" },
          additionalProperties: {
            type: "boolean"
          }
        },
        $comment: {
          type: "string"
        },
        $defs: {
          type: "object",
          additionalProperties: { $dynamicRef: "#meta" }
        }
      },
      $defs: {
        anchorString: {
          type: "string",
          pattern: "^[A-Za-z_][-A-Za-z0-9._]*$"
        },
        uriString: {
          type: "string",
          format: "uri"
        },
        uriReferenceString: {
          type: "string",
          format: "uri-reference"
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json
var require_format_annotation = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json"(exports5, module) {
    module.exports = {
      $schema: "https://json-schema.org/draft/2020-12/schema",
      $id: "https://json-schema.org/draft/2020-12/meta/format-annotation",
      $vocabulary: {
        "https://json-schema.org/draft/2020-12/vocab/format-annotation": true
      },
      $dynamicAnchor: "meta",
      title: "Format vocabulary meta-schema for annotation results",
      type: ["object", "boolean"],
      properties: {
        format: { type: "string" }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json
var require_meta_data = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json"(exports5, module) {
    module.exports = {
      $schema: "https://json-schema.org/draft/2020-12/schema",
      $id: "https://json-schema.org/draft/2020-12/meta/meta-data",
      $vocabulary: {
        "https://json-schema.org/draft/2020-12/vocab/meta-data": true
      },
      $dynamicAnchor: "meta",
      title: "Meta-data vocabulary meta-schema",
      type: ["object", "boolean"],
      properties: {
        title: {
          type: "string"
        },
        description: {
          type: "string"
        },
        default: true,
        deprecated: {
          type: "boolean",
          default: false
        },
        readOnly: {
          type: "boolean",
          default: false
        },
        writeOnly: {
          type: "boolean",
          default: false
        },
        examples: {
          type: "array",
          items: true
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json
var require_validation2 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json"(exports5, module) {
    module.exports = {
      $schema: "https://json-schema.org/draft/2020-12/schema",
      $id: "https://json-schema.org/draft/2020-12/meta/validation",
      $vocabulary: {
        "https://json-schema.org/draft/2020-12/vocab/validation": true
      },
      $dynamicAnchor: "meta",
      title: "Validation vocabulary meta-schema",
      type: ["object", "boolean"],
      properties: {
        type: {
          anyOf: [
            { $ref: "#/$defs/simpleTypes" },
            {
              type: "array",
              items: { $ref: "#/$defs/simpleTypes" },
              minItems: 1,
              uniqueItems: true
            }
          ]
        },
        const: true,
        enum: {
          type: "array",
          items: true
        },
        multipleOf: {
          type: "number",
          exclusiveMinimum: 0
        },
        maximum: {
          type: "number"
        },
        exclusiveMaximum: {
          type: "number"
        },
        minimum: {
          type: "number"
        },
        exclusiveMinimum: {
          type: "number"
        },
        maxLength: { $ref: "#/$defs/nonNegativeInteger" },
        minLength: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
        pattern: {
          type: "string",
          format: "regex"
        },
        maxItems: { $ref: "#/$defs/nonNegativeInteger" },
        minItems: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
        uniqueItems: {
          type: "boolean",
          default: false
        },
        maxContains: { $ref: "#/$defs/nonNegativeInteger" },
        minContains: {
          $ref: "#/$defs/nonNegativeInteger",
          default: 1
        },
        maxProperties: { $ref: "#/$defs/nonNegativeInteger" },
        minProperties: { $ref: "#/$defs/nonNegativeIntegerDefault0" },
        required: { $ref: "#/$defs/stringArray" },
        dependentRequired: {
          type: "object",
          additionalProperties: {
            $ref: "#/$defs/stringArray"
          }
        }
      },
      $defs: {
        nonNegativeInteger: {
          type: "integer",
          minimum: 0
        },
        nonNegativeIntegerDefault0: {
          $ref: "#/$defs/nonNegativeInteger",
          default: 0
        },
        simpleTypes: {
          enum: ["array", "boolean", "integer", "null", "number", "object", "string"]
        },
        stringArray: {
          type: "array",
          items: { type: "string" },
          uniqueItems: true,
          default: []
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/index.js
var require_json_schema_2020_12 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/refs/json-schema-2020-12/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var metaSchema = require_schema();
    var applicator = require_applicator2();
    var unevaluated = require_unevaluated2();
    var content = require_content();
    var core = require_core3();
    var format3 = require_format_annotation();
    var metadata = require_meta_data();
    var validation = require_validation2();
    var META_SUPPORT_DATA = ["/properties"];
    function addMetaSchema2020($data) {
      ;
      [
        metaSchema,
        applicator,
        unevaluated,
        content,
        core,
        with$data(this, format3),
        metadata,
        with$data(this, validation)
      ].forEach((sch) => this.addMetaSchema(sch, void 0, false));
      return this;
      function with$data(ajv, sch) {
        return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch;
      }
    }
    exports5.default = addMetaSchema2020;
  }
});

// src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/2020.js
var require__ = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv@8.17.1/node_modules/ajv/dist/2020.js"(exports5, module) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.MissingRefError = exports5.ValidationError = exports5.CodeGen = exports5.Name = exports5.nil = exports5.stringify = exports5.str = exports5._ = exports5.KeywordCxt = exports5.Ajv2020 = void 0;
    var core_1 = require_core();
    var draft2020_1 = require_draft2020();
    var discriminator_1 = require_discriminator();
    var json_schema_2020_12_1 = require_json_schema_2020_12();
    var META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema";
    var Ajv2020 = class extends core_1.default {
      constructor(opts = {}) {
        super({
          ...opts,
          dynamicRef: true,
          next: true,
          unevaluated: true
        });
      }
      _addVocabularies() {
        super._addVocabularies();
        draft2020_1.default.forEach((v) => this.addVocabulary(v));
        if (this.opts.discriminator)
          this.addKeyword(discriminator_1.default);
      }
      _addDefaultMetaSchema() {
        super._addDefaultMetaSchema();
        const { $data, meta } = this.opts;
        if (!meta)
          return;
        json_schema_2020_12_1.default.call(this, $data);
        this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
      }
      defaultMeta() {
        return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0);
      }
    };
    exports5.Ajv2020 = Ajv2020;
    module.exports = exports5 = Ajv2020;
    module.exports.Ajv2020 = Ajv2020;
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.default = Ajv2020;
    var validate_1 = require_validate();
    Object.defineProperty(exports5, "KeywordCxt", { enumerable: true, get: function() {
      return validate_1.KeywordCxt;
    } });
    var codegen_1 = require_codegen();
    Object.defineProperty(exports5, "_", { enumerable: true, get: function() {
      return codegen_1._;
    } });
    Object.defineProperty(exports5, "str", { enumerable: true, get: function() {
      return codegen_1.str;
    } });
    Object.defineProperty(exports5, "stringify", { enumerable: true, get: function() {
      return codegen_1.stringify;
    } });
    Object.defineProperty(exports5, "nil", { enumerable: true, get: function() {
      return codegen_1.nil;
    } });
    Object.defineProperty(exports5, "Name", { enumerable: true, get: function() {
      return codegen_1.Name;
    } });
    Object.defineProperty(exports5, "CodeGen", { enumerable: true, get: function() {
      return codegen_1.CodeGen;
    } });
    var validation_error_1 = require_validation_error();
    Object.defineProperty(exports5, "ValidationError", { enumerable: true, get: function() {
      return validation_error_1.default;
    } });
    var ref_error_1 = require_ref_error();
    Object.defineProperty(exports5, "MissingRefError", { enumerable: true, get: function() {
      return ref_error_1.default;
    } });
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+openapi-schemas@2.1.0/node_modules/@apidevtools/openapi-schemas/schemas/v1.2/apiDeclaration.json
var require_apiDeclaration = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+openapi-schemas@2.1.0/node_modules/@apidevtools/openapi-schemas/schemas/v1.2/apiDeclaration.json"(exports5, module) {
    module.exports = {
      id: "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/schemas/v1.2/apiDeclaration.json#",
      $schema: "http://json-schema.org/draft-04/schema#",
      type: "object",
      required: ["swaggerVersion", "basePath", "apis"],
      properties: {
        swaggerVersion: { enum: ["1.2"] },
        apiVersion: { type: "string" },
        basePath: {
          type: "string",
          format: "uri",
          pattern: "^https?://"
        },
        resourcePath: {
          type: "string",
          format: "uri",
          pattern: "^/"
        },
        apis: {
          type: "array",
          items: { $ref: "#/definitions/apiObject" }
        },
        models: {
          type: "object",
          additionalProperties: {
            $ref: "modelsObject.json#"
          }
        },
        produces: { $ref: "#/definitions/mimeTypeArray" },
        consumes: { $ref: "#/definitions/mimeTypeArray" },
        authorizations: { $ref: "authorizationObject.json#" }
      },
      additionalProperties: false,
      definitions: {
        apiObject: {
          type: "object",
          required: ["path", "operations"],
          properties: {
            path: {
              type: "string",
              format: "uri-template",
              pattern: "^/"
            },
            description: { type: "string" },
            operations: {
              type: "array",
              items: { $ref: "operationObject.json#" }
            }
          },
          additionalProperties: false
        },
        mimeTypeArray: {
          type: "array",
          items: {
            type: "string",
            format: "mime-type"
          },
          uniqueItems: true
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+openapi-schemas@2.1.0/node_modules/@apidevtools/openapi-schemas/schemas/v2.0/schema.json
var require_schema2 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+openapi-schemas@2.1.0/node_modules/@apidevtools/openapi-schemas/schemas/v2.0/schema.json"(exports5, module) {
    module.exports = {
      title: "A JSON Schema for Swagger 2.0 API.",
      id: "http://swagger.io/v2/schema.json#",
      $schema: "http://json-schema.org/draft-04/schema#",
      type: "object",
      required: [
        "swagger",
        "info",
        "paths"
      ],
      additionalProperties: false,
      patternProperties: {
        "^x-": {
          $ref: "#/definitions/vendorExtension"
        }
      },
      properties: {
        swagger: {
          type: "string",
          enum: [
            "2.0"
          ],
          description: "The Swagger version of this document."
        },
        info: {
          $ref: "#/definitions/info"
        },
        host: {
          type: "string",
          pattern: "^[^{}/ :\\\\]+(?::\\d+)?$",
          description: "The host (name or ip) of the API. Example: 'swagger.io'"
        },
        basePath: {
          type: "string",
          pattern: "^/",
          description: "The base path to the API. Example: '/api'."
        },
        schemes: {
          $ref: "#/definitions/schemesList"
        },
        consumes: {
          description: "A list of MIME types accepted by the API.",
          allOf: [
            {
              $ref: "#/definitions/mediaTypeList"
            }
          ]
        },
        produces: {
          description: "A list of MIME types the API can produce.",
          allOf: [
            {
              $ref: "#/definitions/mediaTypeList"
            }
          ]
        },
        paths: {
          $ref: "#/definitions/paths"
        },
        definitions: {
          $ref: "#/definitions/definitions"
        },
        parameters: {
          $ref: "#/definitions/parameterDefinitions"
        },
        responses: {
          $ref: "#/definitions/responseDefinitions"
        },
        security: {
          $ref: "#/definitions/security"
        },
        securityDefinitions: {
          $ref: "#/definitions/securityDefinitions"
        },
        tags: {
          type: "array",
          items: {
            $ref: "#/definitions/tag"
          },
          uniqueItems: true
        },
        externalDocs: {
          $ref: "#/definitions/externalDocs"
        }
      },
      definitions: {
        info: {
          type: "object",
          description: "General information about the API.",
          required: [
            "version",
            "title"
          ],
          additionalProperties: false,
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          },
          properties: {
            title: {
              type: "string",
              description: "A unique and precise title of the API."
            },
            version: {
              type: "string",
              description: "A semantic version number of the API."
            },
            description: {
              type: "string",
              description: "A longer description of the API. Should be different from the title.  GitHub Flavored Markdown is allowed."
            },
            termsOfService: {
              type: "string",
              description: "The terms of service for the API."
            },
            contact: {
              $ref: "#/definitions/contact"
            },
            license: {
              $ref: "#/definitions/license"
            }
          }
        },
        contact: {
          type: "object",
          description: "Contact information for the owners of the API.",
          additionalProperties: false,
          properties: {
            name: {
              type: "string",
              description: "The identifying name of the contact person/organization."
            },
            url: {
              type: "string",
              description: "The URL pointing to the contact information.",
              format: "uri"
            },
            email: {
              type: "string",
              description: "The email address of the contact person/organization.",
              format: "email"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        license: {
          type: "object",
          required: [
            "name"
          ],
          additionalProperties: false,
          properties: {
            name: {
              type: "string",
              description: "The name of the license type. It's encouraged to use an OSI compatible license."
            },
            url: {
              type: "string",
              description: "The URL pointing to the license.",
              format: "uri"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        paths: {
          type: "object",
          description: "Relative paths to the individual endpoints. They must be relative to the 'basePath'.",
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            },
            "^/": {
              $ref: "#/definitions/pathItem"
            }
          },
          additionalProperties: false
        },
        definitions: {
          type: "object",
          additionalProperties: {
            $ref: "#/definitions/schema"
          },
          description: "One or more JSON objects describing the schemas being consumed and produced by the API."
        },
        parameterDefinitions: {
          type: "object",
          additionalProperties: {
            $ref: "#/definitions/parameter"
          },
          description: "One or more JSON representations for parameters"
        },
        responseDefinitions: {
          type: "object",
          additionalProperties: {
            $ref: "#/definitions/response"
          },
          description: "One or more JSON representations for responses"
        },
        externalDocs: {
          type: "object",
          additionalProperties: false,
          description: "information about external documentation",
          required: [
            "url"
          ],
          properties: {
            description: {
              type: "string"
            },
            url: {
              type: "string",
              format: "uri"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        examples: {
          type: "object",
          additionalProperties: true
        },
        mimeType: {
          type: "string",
          description: "The MIME type of the HTTP message."
        },
        operation: {
          type: "object",
          required: [
            "responses"
          ],
          additionalProperties: false,
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          },
          properties: {
            tags: {
              type: "array",
              items: {
                type: "string"
              },
              uniqueItems: true
            },
            summary: {
              type: "string",
              description: "A brief summary of the operation."
            },
            description: {
              type: "string",
              description: "A longer description of the operation, GitHub Flavored Markdown is allowed."
            },
            externalDocs: {
              $ref: "#/definitions/externalDocs"
            },
            operationId: {
              type: "string",
              description: "A unique identifier of the operation."
            },
            produces: {
              description: "A list of MIME types the API can produce.",
              allOf: [
                {
                  $ref: "#/definitions/mediaTypeList"
                }
              ]
            },
            consumes: {
              description: "A list of MIME types the API can consume.",
              allOf: [
                {
                  $ref: "#/definitions/mediaTypeList"
                }
              ]
            },
            parameters: {
              $ref: "#/definitions/parametersList"
            },
            responses: {
              $ref: "#/definitions/responses"
            },
            schemes: {
              $ref: "#/definitions/schemesList"
            },
            deprecated: {
              type: "boolean",
              default: false
            },
            security: {
              $ref: "#/definitions/security"
            }
          }
        },
        pathItem: {
          type: "object",
          additionalProperties: false,
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          },
          properties: {
            $ref: {
              type: "string"
            },
            get: {
              $ref: "#/definitions/operation"
            },
            put: {
              $ref: "#/definitions/operation"
            },
            post: {
              $ref: "#/definitions/operation"
            },
            delete: {
              $ref: "#/definitions/operation"
            },
            options: {
              $ref: "#/definitions/operation"
            },
            head: {
              $ref: "#/definitions/operation"
            },
            patch: {
              $ref: "#/definitions/operation"
            },
            parameters: {
              $ref: "#/definitions/parametersList"
            }
          }
        },
        responses: {
          type: "object",
          description: "Response objects names can either be any valid HTTP status code or 'default'.",
          minProperties: 1,
          additionalProperties: false,
          patternProperties: {
            "^([0-9]{3})$|^(default)$": {
              $ref: "#/definitions/responseValue"
            },
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          },
          not: {
            type: "object",
            additionalProperties: false,
            patternProperties: {
              "^x-": {
                $ref: "#/definitions/vendorExtension"
              }
            }
          }
        },
        responseValue: {
          oneOf: [
            {
              $ref: "#/definitions/response"
            },
            {
              $ref: "#/definitions/jsonReference"
            }
          ]
        },
        response: {
          type: "object",
          required: [
            "description"
          ],
          properties: {
            description: {
              type: "string"
            },
            schema: {
              oneOf: [
                {
                  $ref: "#/definitions/schema"
                },
                {
                  $ref: "#/definitions/fileSchema"
                }
              ]
            },
            headers: {
              $ref: "#/definitions/headers"
            },
            examples: {
              $ref: "#/definitions/examples"
            }
          },
          additionalProperties: false,
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        headers: {
          type: "object",
          additionalProperties: {
            $ref: "#/definitions/header"
          }
        },
        header: {
          type: "object",
          additionalProperties: false,
          required: [
            "type"
          ],
          properties: {
            type: {
              type: "string",
              enum: [
                "string",
                "number",
                "integer",
                "boolean",
                "array"
              ]
            },
            format: {
              type: "string"
            },
            items: {
              $ref: "#/definitions/primitivesItems"
            },
            collectionFormat: {
              $ref: "#/definitions/collectionFormat"
            },
            default: {
              $ref: "#/definitions/default"
            },
            maximum: {
              $ref: "#/definitions/maximum"
            },
            exclusiveMaximum: {
              $ref: "#/definitions/exclusiveMaximum"
            },
            minimum: {
              $ref: "#/definitions/minimum"
            },
            exclusiveMinimum: {
              $ref: "#/definitions/exclusiveMinimum"
            },
            maxLength: {
              $ref: "#/definitions/maxLength"
            },
            minLength: {
              $ref: "#/definitions/minLength"
            },
            pattern: {
              $ref: "#/definitions/pattern"
            },
            maxItems: {
              $ref: "#/definitions/maxItems"
            },
            minItems: {
              $ref: "#/definitions/minItems"
            },
            uniqueItems: {
              $ref: "#/definitions/uniqueItems"
            },
            enum: {
              $ref: "#/definitions/enum"
            },
            multipleOf: {
              $ref: "#/definitions/multipleOf"
            },
            description: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        vendorExtension: {
          description: "Any property starting with x- is valid.",
          additionalProperties: true,
          additionalItems: true
        },
        bodyParameter: {
          type: "object",
          required: [
            "name",
            "in",
            "schema"
          ],
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          },
          properties: {
            description: {
              type: "string",
              description: "A brief description of the parameter. This could contain examples of use.  GitHub Flavored Markdown is allowed."
            },
            name: {
              type: "string",
              description: "The name of the parameter."
            },
            in: {
              type: "string",
              description: "Determines the location of the parameter.",
              enum: [
                "body"
              ]
            },
            required: {
              type: "boolean",
              description: "Determines whether or not this parameter is required or optional.",
              default: false
            },
            schema: {
              $ref: "#/definitions/schema"
            }
          },
          additionalProperties: false
        },
        headerParameterSubSchema: {
          additionalProperties: false,
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          },
          properties: {
            required: {
              type: "boolean",
              description: "Determines whether or not this parameter is required or optional.",
              default: false
            },
            in: {
              type: "string",
              description: "Determines the location of the parameter.",
              enum: [
                "header"
              ]
            },
            description: {
              type: "string",
              description: "A brief description of the parameter. This could contain examples of use.  GitHub Flavored Markdown is allowed."
            },
            name: {
              type: "string",
              description: "The name of the parameter."
            },
            type: {
              type: "string",
              enum: [
                "string",
                "number",
                "boolean",
                "integer",
                "array"
              ]
            },
            format: {
              type: "string"
            },
            items: {
              $ref: "#/definitions/primitivesItems"
            },
            collectionFormat: {
              $ref: "#/definitions/collectionFormat"
            },
            default: {
              $ref: "#/definitions/default"
            },
            maximum: {
              $ref: "#/definitions/maximum"
            },
            exclusiveMaximum: {
              $ref: "#/definitions/exclusiveMaximum"
            },
            minimum: {
              $ref: "#/definitions/minimum"
            },
            exclusiveMinimum: {
              $ref: "#/definitions/exclusiveMinimum"
            },
            maxLength: {
              $ref: "#/definitions/maxLength"
            },
            minLength: {
              $ref: "#/definitions/minLength"
            },
            pattern: {
              $ref: "#/definitions/pattern"
            },
            maxItems: {
              $ref: "#/definitions/maxItems"
            },
            minItems: {
              $ref: "#/definitions/minItems"
            },
            uniqueItems: {
              $ref: "#/definitions/uniqueItems"
            },
            enum: {
              $ref: "#/definitions/enum"
            },
            multipleOf: {
              $ref: "#/definitions/multipleOf"
            }
          }
        },
        queryParameterSubSchema: {
          additionalProperties: false,
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          },
          properties: {
            required: {
              type: "boolean",
              description: "Determines whether or not this parameter is required or optional.",
              default: false
            },
            in: {
              type: "string",
              description: "Determines the location of the parameter.",
              enum: [
                "query"
              ]
            },
            description: {
              type: "string",
              description: "A brief description of the parameter. This could contain examples of use.  GitHub Flavored Markdown is allowed."
            },
            name: {
              type: "string",
              description: "The name of the parameter."
            },
            allowEmptyValue: {
              type: "boolean",
              default: false,
              description: "allows sending a parameter by name only or with an empty value."
            },
            type: {
              type: "string",
              enum: [
                "string",
                "number",
                "boolean",
                "integer",
                "array"
              ]
            },
            format: {
              type: "string"
            },
            items: {
              $ref: "#/definitions/primitivesItems"
            },
            collectionFormat: {
              $ref: "#/definitions/collectionFormatWithMulti"
            },
            default: {
              $ref: "#/definitions/default"
            },
            maximum: {
              $ref: "#/definitions/maximum"
            },
            exclusiveMaximum: {
              $ref: "#/definitions/exclusiveMaximum"
            },
            minimum: {
              $ref: "#/definitions/minimum"
            },
            exclusiveMinimum: {
              $ref: "#/definitions/exclusiveMinimum"
            },
            maxLength: {
              $ref: "#/definitions/maxLength"
            },
            minLength: {
              $ref: "#/definitions/minLength"
            },
            pattern: {
              $ref: "#/definitions/pattern"
            },
            maxItems: {
              $ref: "#/definitions/maxItems"
            },
            minItems: {
              $ref: "#/definitions/minItems"
            },
            uniqueItems: {
              $ref: "#/definitions/uniqueItems"
            },
            enum: {
              $ref: "#/definitions/enum"
            },
            multipleOf: {
              $ref: "#/definitions/multipleOf"
            }
          }
        },
        formDataParameterSubSchema: {
          additionalProperties: false,
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          },
          properties: {
            required: {
              type: "boolean",
              description: "Determines whether or not this parameter is required or optional.",
              default: false
            },
            in: {
              type: "string",
              description: "Determines the location of the parameter.",
              enum: [
                "formData"
              ]
            },
            description: {
              type: "string",
              description: "A brief description of the parameter. This could contain examples of use.  GitHub Flavored Markdown is allowed."
            },
            name: {
              type: "string",
              description: "The name of the parameter."
            },
            allowEmptyValue: {
              type: "boolean",
              default: false,
              description: "allows sending a parameter by name only or with an empty value."
            },
            type: {
              type: "string",
              enum: [
                "string",
                "number",
                "boolean",
                "integer",
                "array",
                "file"
              ]
            },
            format: {
              type: "string"
            },
            items: {
              $ref: "#/definitions/primitivesItems"
            },
            collectionFormat: {
              $ref: "#/definitions/collectionFormatWithMulti"
            },
            default: {
              $ref: "#/definitions/default"
            },
            maximum: {
              $ref: "#/definitions/maximum"
            },
            exclusiveMaximum: {
              $ref: "#/definitions/exclusiveMaximum"
            },
            minimum: {
              $ref: "#/definitions/minimum"
            },
            exclusiveMinimum: {
              $ref: "#/definitions/exclusiveMinimum"
            },
            maxLength: {
              $ref: "#/definitions/maxLength"
            },
            minLength: {
              $ref: "#/definitions/minLength"
            },
            pattern: {
              $ref: "#/definitions/pattern"
            },
            maxItems: {
              $ref: "#/definitions/maxItems"
            },
            minItems: {
              $ref: "#/definitions/minItems"
            },
            uniqueItems: {
              $ref: "#/definitions/uniqueItems"
            },
            enum: {
              $ref: "#/definitions/enum"
            },
            multipleOf: {
              $ref: "#/definitions/multipleOf"
            }
          }
        },
        pathParameterSubSchema: {
          additionalProperties: false,
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          },
          required: [
            "required"
          ],
          properties: {
            required: {
              type: "boolean",
              enum: [
                true
              ],
              description: "Determines whether or not this parameter is required or optional."
            },
            in: {
              type: "string",
              description: "Determines the location of the parameter.",
              enum: [
                "path"
              ]
            },
            description: {
              type: "string",
              description: "A brief description of the parameter. This could contain examples of use.  GitHub Flavored Markdown is allowed."
            },
            name: {
              type: "string",
              description: "The name of the parameter."
            },
            type: {
              type: "string",
              enum: [
                "string",
                "number",
                "boolean",
                "integer",
                "array"
              ]
            },
            format: {
              type: "string"
            },
            items: {
              $ref: "#/definitions/primitivesItems"
            },
            collectionFormat: {
              $ref: "#/definitions/collectionFormat"
            },
            default: {
              $ref: "#/definitions/default"
            },
            maximum: {
              $ref: "#/definitions/maximum"
            },
            exclusiveMaximum: {
              $ref: "#/definitions/exclusiveMaximum"
            },
            minimum: {
              $ref: "#/definitions/minimum"
            },
            exclusiveMinimum: {
              $ref: "#/definitions/exclusiveMinimum"
            },
            maxLength: {
              $ref: "#/definitions/maxLength"
            },
            minLength: {
              $ref: "#/definitions/minLength"
            },
            pattern: {
              $ref: "#/definitions/pattern"
            },
            maxItems: {
              $ref: "#/definitions/maxItems"
            },
            minItems: {
              $ref: "#/definitions/minItems"
            },
            uniqueItems: {
              $ref: "#/definitions/uniqueItems"
            },
            enum: {
              $ref: "#/definitions/enum"
            },
            multipleOf: {
              $ref: "#/definitions/multipleOf"
            }
          }
        },
        nonBodyParameter: {
          type: "object",
          required: [
            "name",
            "in",
            "type"
          ],
          oneOf: [
            {
              $ref: "#/definitions/headerParameterSubSchema"
            },
            {
              $ref: "#/definitions/formDataParameterSubSchema"
            },
            {
              $ref: "#/definitions/queryParameterSubSchema"
            },
            {
              $ref: "#/definitions/pathParameterSubSchema"
            }
          ]
        },
        parameter: {
          oneOf: [
            {
              $ref: "#/definitions/bodyParameter"
            },
            {
              $ref: "#/definitions/nonBodyParameter"
            }
          ]
        },
        schema: {
          type: "object",
          description: "A deterministic version of a JSON Schema object.",
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          },
          properties: {
            $ref: {
              type: "string"
            },
            format: {
              type: "string"
            },
            title: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/title"
            },
            description: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/description"
            },
            default: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/default"
            },
            multipleOf: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/multipleOf"
            },
            maximum: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/maximum"
            },
            exclusiveMaximum: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
            },
            minimum: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/minimum"
            },
            exclusiveMinimum: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
            },
            maxLength: {
              $ref: "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
            },
            minLength: {
              $ref: "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
            },
            pattern: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/pattern"
            },
            maxItems: {
              $ref: "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
            },
            minItems: {
              $ref: "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
            },
            uniqueItems: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
            },
            maxProperties: {
              $ref: "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
            },
            minProperties: {
              $ref: "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
            },
            required: {
              $ref: "http://json-schema.org/draft-04/schema#/definitions/stringArray"
            },
            enum: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/enum"
            },
            additionalProperties: {
              anyOf: [
                {
                  $ref: "#/definitions/schema"
                },
                {
                  type: "boolean"
                }
              ],
              default: {}
            },
            type: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/type"
            },
            items: {
              anyOf: [
                {
                  $ref: "#/definitions/schema"
                },
                {
                  type: "array",
                  minItems: 1,
                  items: {
                    $ref: "#/definitions/schema"
                  }
                }
              ],
              default: {}
            },
            allOf: {
              type: "array",
              minItems: 1,
              items: {
                $ref: "#/definitions/schema"
              }
            },
            properties: {
              type: "object",
              additionalProperties: {
                $ref: "#/definitions/schema"
              },
              default: {}
            },
            discriminator: {
              type: "string"
            },
            readOnly: {
              type: "boolean",
              default: false
            },
            xml: {
              $ref: "#/definitions/xml"
            },
            externalDocs: {
              $ref: "#/definitions/externalDocs"
            },
            example: {}
          },
          additionalProperties: false
        },
        fileSchema: {
          type: "object",
          description: "A deterministic version of a JSON Schema object.",
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          },
          required: [
            "type"
          ],
          properties: {
            format: {
              type: "string"
            },
            title: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/title"
            },
            description: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/description"
            },
            default: {
              $ref: "http://json-schema.org/draft-04/schema#/properties/default"
            },
            required: {
              $ref: "http://json-schema.org/draft-04/schema#/definitions/stringArray"
            },
            type: {
              type: "string",
              enum: [
                "file"
              ]
            },
            readOnly: {
              type: "boolean",
              default: false
            },
            externalDocs: {
              $ref: "#/definitions/externalDocs"
            },
            example: {}
          },
          additionalProperties: false
        },
        primitivesItems: {
          type: "object",
          additionalProperties: false,
          properties: {
            type: {
              type: "string",
              enum: [
                "string",
                "number",
                "integer",
                "boolean",
                "array"
              ]
            },
            format: {
              type: "string"
            },
            items: {
              $ref: "#/definitions/primitivesItems"
            },
            collectionFormat: {
              $ref: "#/definitions/collectionFormat"
            },
            default: {
              $ref: "#/definitions/default"
            },
            maximum: {
              $ref: "#/definitions/maximum"
            },
            exclusiveMaximum: {
              $ref: "#/definitions/exclusiveMaximum"
            },
            minimum: {
              $ref: "#/definitions/minimum"
            },
            exclusiveMinimum: {
              $ref: "#/definitions/exclusiveMinimum"
            },
            maxLength: {
              $ref: "#/definitions/maxLength"
            },
            minLength: {
              $ref: "#/definitions/minLength"
            },
            pattern: {
              $ref: "#/definitions/pattern"
            },
            maxItems: {
              $ref: "#/definitions/maxItems"
            },
            minItems: {
              $ref: "#/definitions/minItems"
            },
            uniqueItems: {
              $ref: "#/definitions/uniqueItems"
            },
            enum: {
              $ref: "#/definitions/enum"
            },
            multipleOf: {
              $ref: "#/definitions/multipleOf"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        security: {
          type: "array",
          items: {
            $ref: "#/definitions/securityRequirement"
          },
          uniqueItems: true
        },
        securityRequirement: {
          type: "object",
          additionalProperties: {
            type: "array",
            items: {
              type: "string"
            },
            uniqueItems: true
          }
        },
        xml: {
          type: "object",
          additionalProperties: false,
          properties: {
            name: {
              type: "string"
            },
            namespace: {
              type: "string"
            },
            prefix: {
              type: "string"
            },
            attribute: {
              type: "boolean",
              default: false
            },
            wrapped: {
              type: "boolean",
              default: false
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        tag: {
          type: "object",
          additionalProperties: false,
          required: [
            "name"
          ],
          properties: {
            name: {
              type: "string"
            },
            description: {
              type: "string"
            },
            externalDocs: {
              $ref: "#/definitions/externalDocs"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        securityDefinitions: {
          type: "object",
          additionalProperties: {
            oneOf: [
              {
                $ref: "#/definitions/basicAuthenticationSecurity"
              },
              {
                $ref: "#/definitions/apiKeySecurity"
              },
              {
                $ref: "#/definitions/oauth2ImplicitSecurity"
              },
              {
                $ref: "#/definitions/oauth2PasswordSecurity"
              },
              {
                $ref: "#/definitions/oauth2ApplicationSecurity"
              },
              {
                $ref: "#/definitions/oauth2AccessCodeSecurity"
              }
            ]
          }
        },
        basicAuthenticationSecurity: {
          type: "object",
          additionalProperties: false,
          required: [
            "type"
          ],
          properties: {
            type: {
              type: "string",
              enum: [
                "basic"
              ]
            },
            description: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        apiKeySecurity: {
          type: "object",
          additionalProperties: false,
          required: [
            "type",
            "name",
            "in"
          ],
          properties: {
            type: {
              type: "string",
              enum: [
                "apiKey"
              ]
            },
            name: {
              type: "string"
            },
            in: {
              type: "string",
              enum: [
                "header",
                "query"
              ]
            },
            description: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        oauth2ImplicitSecurity: {
          type: "object",
          additionalProperties: false,
          required: [
            "type",
            "flow",
            "authorizationUrl"
          ],
          properties: {
            type: {
              type: "string",
              enum: [
                "oauth2"
              ]
            },
            flow: {
              type: "string",
              enum: [
                "implicit"
              ]
            },
            scopes: {
              $ref: "#/definitions/oauth2Scopes"
            },
            authorizationUrl: {
              type: "string",
              format: "uri"
            },
            description: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        oauth2PasswordSecurity: {
          type: "object",
          additionalProperties: false,
          required: [
            "type",
            "flow",
            "tokenUrl"
          ],
          properties: {
            type: {
              type: "string",
              enum: [
                "oauth2"
              ]
            },
            flow: {
              type: "string",
              enum: [
                "password"
              ]
            },
            scopes: {
              $ref: "#/definitions/oauth2Scopes"
            },
            tokenUrl: {
              type: "string",
              format: "uri"
            },
            description: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        oauth2ApplicationSecurity: {
          type: "object",
          additionalProperties: false,
          required: [
            "type",
            "flow",
            "tokenUrl"
          ],
          properties: {
            type: {
              type: "string",
              enum: [
                "oauth2"
              ]
            },
            flow: {
              type: "string",
              enum: [
                "application"
              ]
            },
            scopes: {
              $ref: "#/definitions/oauth2Scopes"
            },
            tokenUrl: {
              type: "string",
              format: "uri"
            },
            description: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        oauth2AccessCodeSecurity: {
          type: "object",
          additionalProperties: false,
          required: [
            "type",
            "flow",
            "authorizationUrl",
            "tokenUrl"
          ],
          properties: {
            type: {
              type: "string",
              enum: [
                "oauth2"
              ]
            },
            flow: {
              type: "string",
              enum: [
                "accessCode"
              ]
            },
            scopes: {
              $ref: "#/definitions/oauth2Scopes"
            },
            authorizationUrl: {
              type: "string",
              format: "uri"
            },
            tokenUrl: {
              type: "string",
              format: "uri"
            },
            description: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {
              $ref: "#/definitions/vendorExtension"
            }
          }
        },
        oauth2Scopes: {
          type: "object",
          additionalProperties: {
            type: "string"
          }
        },
        mediaTypeList: {
          type: "array",
          items: {
            $ref: "#/definitions/mimeType"
          },
          uniqueItems: true
        },
        parametersList: {
          type: "array",
          description: "The parameters needed to send a valid API call.",
          additionalItems: false,
          items: {
            oneOf: [
              {
                $ref: "#/definitions/parameter"
              },
              {
                $ref: "#/definitions/jsonReference"
              }
            ]
          },
          uniqueItems: true
        },
        schemesList: {
          type: "array",
          description: "The transfer protocol of the API.",
          items: {
            type: "string",
            enum: [
              "http",
              "https",
              "ws",
              "wss"
            ]
          },
          uniqueItems: true
        },
        collectionFormat: {
          type: "string",
          enum: [
            "csv",
            "ssv",
            "tsv",
            "pipes"
          ],
          default: "csv"
        },
        collectionFormatWithMulti: {
          type: "string",
          enum: [
            "csv",
            "ssv",
            "tsv",
            "pipes",
            "multi"
          ],
          default: "csv"
        },
        title: {
          $ref: "http://json-schema.org/draft-04/schema#/properties/title"
        },
        description: {
          $ref: "http://json-schema.org/draft-04/schema#/properties/description"
        },
        default: {
          $ref: "http://json-schema.org/draft-04/schema#/properties/default"
        },
        multipleOf: {
          $ref: "http://json-schema.org/draft-04/schema#/properties/multipleOf"
        },
        maximum: {
          $ref: "http://json-schema.org/draft-04/schema#/properties/maximum"
        },
        exclusiveMaximum: {
          $ref: "http://json-schema.org/draft-04/schema#/properties/exclusiveMaximum"
        },
        minimum: {
          $ref: "http://json-schema.org/draft-04/schema#/properties/minimum"
        },
        exclusiveMinimum: {
          $ref: "http://json-schema.org/draft-04/schema#/properties/exclusiveMinimum"
        },
        maxLength: {
          $ref: "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
        },
        minLength: {
          $ref: "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
        },
        pattern: {
          $ref: "http://json-schema.org/draft-04/schema#/properties/pattern"
        },
        maxItems: {
          $ref: "http://json-schema.org/draft-04/schema#/definitions/positiveInteger"
        },
        minItems: {
          $ref: "http://json-schema.org/draft-04/schema#/definitions/positiveIntegerDefault0"
        },
        uniqueItems: {
          $ref: "http://json-schema.org/draft-04/schema#/properties/uniqueItems"
        },
        enum: {
          $ref: "http://json-schema.org/draft-04/schema#/properties/enum"
        },
        jsonReference: {
          type: "object",
          required: [
            "$ref"
          ],
          additionalProperties: false,
          properties: {
            $ref: {
              type: "string"
            }
          }
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+openapi-schemas@2.1.0/node_modules/@apidevtools/openapi-schemas/schemas/v3.0/schema.json
var require_schema3 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+openapi-schemas@2.1.0/node_modules/@apidevtools/openapi-schemas/schemas/v3.0/schema.json"(exports5, module) {
    module.exports = {
      id: "https://spec.openapis.org/oas/3.0/schema/2019-04-02",
      $schema: "http://json-schema.org/draft-04/schema#",
      description: "Validation schema for OpenAPI Specification 3.0.X.",
      type: "object",
      required: [
        "openapi",
        "info",
        "paths"
      ],
      properties: {
        openapi: {
          type: "string",
          pattern: "^3\\.0\\.\\d(-.+)?$"
        },
        info: {
          $ref: "#/definitions/Info"
        },
        externalDocs: {
          $ref: "#/definitions/ExternalDocumentation"
        },
        servers: {
          type: "array",
          items: {
            $ref: "#/definitions/Server"
          }
        },
        security: {
          type: "array",
          items: {
            $ref: "#/definitions/SecurityRequirement"
          }
        },
        tags: {
          type: "array",
          items: {
            $ref: "#/definitions/Tag"
          },
          uniqueItems: true
        },
        paths: {
          $ref: "#/definitions/Paths"
        },
        components: {
          $ref: "#/definitions/Components"
        }
      },
      patternProperties: {
        "^x-": {}
      },
      additionalProperties: false,
      definitions: {
        Reference: {
          type: "object",
          required: [
            "$ref"
          ],
          patternProperties: {
            "^\\$ref$": {
              type: "string",
              format: "uri-reference"
            }
          }
        },
        Info: {
          type: "object",
          required: [
            "title",
            "version"
          ],
          properties: {
            title: {
              type: "string"
            },
            description: {
              type: "string"
            },
            termsOfService: {
              type: "string",
              format: "uri-reference"
            },
            contact: {
              $ref: "#/definitions/Contact"
            },
            license: {
              $ref: "#/definitions/License"
            },
            version: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        Contact: {
          type: "object",
          properties: {
            name: {
              type: "string"
            },
            url: {
              type: "string",
              format: "uri-reference"
            },
            email: {
              type: "string",
              format: "email"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        License: {
          type: "object",
          required: [
            "name"
          ],
          properties: {
            name: {
              type: "string"
            },
            url: {
              type: "string",
              format: "uri-reference"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        Server: {
          type: "object",
          required: [
            "url"
          ],
          properties: {
            url: {
              type: "string"
            },
            description: {
              type: "string"
            },
            variables: {
              type: "object",
              additionalProperties: {
                $ref: "#/definitions/ServerVariable"
              }
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        ServerVariable: {
          type: "object",
          required: [
            "default"
          ],
          properties: {
            enum: {
              type: "array",
              items: {
                type: "string"
              }
            },
            default: {
              type: "string"
            },
            description: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        Components: {
          type: "object",
          properties: {
            schemas: {
              type: "object",
              patternProperties: {
                "^[a-zA-Z0-9\\.\\-_]+$": {
                  oneOf: [
                    {
                      $ref: "#/definitions/Schema"
                    },
                    {
                      $ref: "#/definitions/Reference"
                    }
                  ]
                }
              }
            },
            responses: {
              type: "object",
              patternProperties: {
                "^[a-zA-Z0-9\\.\\-_]+$": {
                  oneOf: [
                    {
                      $ref: "#/definitions/Reference"
                    },
                    {
                      $ref: "#/definitions/Response"
                    }
                  ]
                }
              }
            },
            parameters: {
              type: "object",
              patternProperties: {
                "^[a-zA-Z0-9\\.\\-_]+$": {
                  oneOf: [
                    {
                      $ref: "#/definitions/Reference"
                    },
                    {
                      $ref: "#/definitions/Parameter"
                    }
                  ]
                }
              }
            },
            examples: {
              type: "object",
              patternProperties: {
                "^[a-zA-Z0-9\\.\\-_]+$": {
                  oneOf: [
                    {
                      $ref: "#/definitions/Reference"
                    },
                    {
                      $ref: "#/definitions/Example"
                    }
                  ]
                }
              }
            },
            requestBodies: {
              type: "object",
              patternProperties: {
                "^[a-zA-Z0-9\\.\\-_]+$": {
                  oneOf: [
                    {
                      $ref: "#/definitions/Reference"
                    },
                    {
                      $ref: "#/definitions/RequestBody"
                    }
                  ]
                }
              }
            },
            headers: {
              type: "object",
              patternProperties: {
                "^[a-zA-Z0-9\\.\\-_]+$": {
                  oneOf: [
                    {
                      $ref: "#/definitions/Reference"
                    },
                    {
                      $ref: "#/definitions/Header"
                    }
                  ]
                }
              }
            },
            securitySchemes: {
              type: "object",
              patternProperties: {
                "^[a-zA-Z0-9\\.\\-_]+$": {
                  oneOf: [
                    {
                      $ref: "#/definitions/Reference"
                    },
                    {
                      $ref: "#/definitions/SecurityScheme"
                    }
                  ]
                }
              }
            },
            links: {
              type: "object",
              patternProperties: {
                "^[a-zA-Z0-9\\.\\-_]+$": {
                  oneOf: [
                    {
                      $ref: "#/definitions/Reference"
                    },
                    {
                      $ref: "#/definitions/Link"
                    }
                  ]
                }
              }
            },
            callbacks: {
              type: "object",
              patternProperties: {
                "^[a-zA-Z0-9\\.\\-_]+$": {
                  oneOf: [
                    {
                      $ref: "#/definitions/Reference"
                    },
                    {
                      $ref: "#/definitions/Callback"
                    }
                  ]
                }
              }
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        Schema: {
          type: "object",
          properties: {
            title: {
              type: "string"
            },
            multipleOf: {
              type: "number",
              minimum: 0,
              exclusiveMinimum: true
            },
            maximum: {
              type: "number"
            },
            exclusiveMaximum: {
              type: "boolean",
              default: false
            },
            minimum: {
              type: "number"
            },
            exclusiveMinimum: {
              type: "boolean",
              default: false
            },
            maxLength: {
              type: "integer",
              minimum: 0
            },
            minLength: {
              type: "integer",
              minimum: 0,
              default: 0
            },
            pattern: {
              type: "string",
              format: "regex"
            },
            maxItems: {
              type: "integer",
              minimum: 0
            },
            minItems: {
              type: "integer",
              minimum: 0,
              default: 0
            },
            uniqueItems: {
              type: "boolean",
              default: false
            },
            maxProperties: {
              type: "integer",
              minimum: 0
            },
            minProperties: {
              type: "integer",
              minimum: 0,
              default: 0
            },
            required: {
              type: "array",
              items: {
                type: "string"
              },
              minItems: 1,
              uniqueItems: true
            },
            enum: {
              type: "array",
              items: {},
              minItems: 1,
              uniqueItems: false
            },
            type: {
              type: "string",
              enum: [
                "array",
                "boolean",
                "integer",
                "number",
                "object",
                "string"
              ]
            },
            not: {
              oneOf: [
                {
                  $ref: "#/definitions/Schema"
                },
                {
                  $ref: "#/definitions/Reference"
                }
              ]
            },
            allOf: {
              type: "array",
              items: {
                oneOf: [
                  {
                    $ref: "#/definitions/Schema"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              }
            },
            oneOf: {
              type: "array",
              items: {
                oneOf: [
                  {
                    $ref: "#/definitions/Schema"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              }
            },
            anyOf: {
              type: "array",
              items: {
                oneOf: [
                  {
                    $ref: "#/definitions/Schema"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              }
            },
            items: {
              oneOf: [
                {
                  $ref: "#/definitions/Schema"
                },
                {
                  $ref: "#/definitions/Reference"
                }
              ]
            },
            properties: {
              type: "object",
              additionalProperties: {
                oneOf: [
                  {
                    $ref: "#/definitions/Schema"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              }
            },
            additionalProperties: {
              oneOf: [
                {
                  $ref: "#/definitions/Schema"
                },
                {
                  $ref: "#/definitions/Reference"
                },
                {
                  type: "boolean"
                }
              ],
              default: true
            },
            description: {
              type: "string"
            },
            format: {
              type: "string"
            },
            default: {},
            nullable: {
              type: "boolean",
              default: false
            },
            discriminator: {
              $ref: "#/definitions/Discriminator"
            },
            readOnly: {
              type: "boolean",
              default: false
            },
            writeOnly: {
              type: "boolean",
              default: false
            },
            example: {},
            externalDocs: {
              $ref: "#/definitions/ExternalDocumentation"
            },
            deprecated: {
              type: "boolean",
              default: false
            },
            xml: {
              $ref: "#/definitions/XML"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        Discriminator: {
          type: "object",
          required: [
            "propertyName"
          ],
          properties: {
            propertyName: {
              type: "string"
            },
            mapping: {
              type: "object",
              additionalProperties: {
                type: "string"
              }
            }
          }
        },
        XML: {
          type: "object",
          properties: {
            name: {
              type: "string"
            },
            namespace: {
              type: "string",
              format: "uri"
            },
            prefix: {
              type: "string"
            },
            attribute: {
              type: "boolean",
              default: false
            },
            wrapped: {
              type: "boolean",
              default: false
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        Response: {
          type: "object",
          required: [
            "description"
          ],
          properties: {
            description: {
              type: "string"
            },
            headers: {
              type: "object",
              additionalProperties: {
                oneOf: [
                  {
                    $ref: "#/definitions/Header"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              }
            },
            content: {
              type: "object",
              additionalProperties: {
                $ref: "#/definitions/MediaType"
              }
            },
            links: {
              type: "object",
              additionalProperties: {
                oneOf: [
                  {
                    $ref: "#/definitions/Link"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              }
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        MediaType: {
          type: "object",
          properties: {
            schema: {
              oneOf: [
                {
                  $ref: "#/definitions/Schema"
                },
                {
                  $ref: "#/definitions/Reference"
                }
              ]
            },
            example: {},
            examples: {
              type: "object",
              additionalProperties: {
                oneOf: [
                  {
                    $ref: "#/definitions/Example"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              }
            },
            encoding: {
              type: "object",
              additionalProperties: {
                $ref: "#/definitions/Encoding"
              }
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false,
          allOf: [
            {
              $ref: "#/definitions/ExampleXORExamples"
            }
          ]
        },
        Example: {
          type: "object",
          properties: {
            summary: {
              type: "string"
            },
            description: {
              type: "string"
            },
            value: {},
            externalValue: {
              type: "string",
              format: "uri-reference"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        Header: {
          type: "object",
          properties: {
            description: {
              type: "string"
            },
            required: {
              type: "boolean",
              default: false
            },
            deprecated: {
              type: "boolean",
              default: false
            },
            allowEmptyValue: {
              type: "boolean",
              default: false
            },
            style: {
              type: "string",
              enum: [
                "simple"
              ],
              default: "simple"
            },
            explode: {
              type: "boolean"
            },
            allowReserved: {
              type: "boolean",
              default: false
            },
            schema: {
              oneOf: [
                {
                  $ref: "#/definitions/Schema"
                },
                {
                  $ref: "#/definitions/Reference"
                }
              ]
            },
            content: {
              type: "object",
              additionalProperties: {
                $ref: "#/definitions/MediaType"
              },
              minProperties: 1,
              maxProperties: 1
            },
            example: {},
            examples: {
              type: "object",
              additionalProperties: {
                oneOf: [
                  {
                    $ref: "#/definitions/Example"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              }
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false,
          allOf: [
            {
              $ref: "#/definitions/ExampleXORExamples"
            },
            {
              $ref: "#/definitions/SchemaXORContent"
            }
          ]
        },
        Paths: {
          type: "object",
          patternProperties: {
            "^\\/": {
              $ref: "#/definitions/PathItem"
            },
            "^x-": {}
          },
          additionalProperties: false
        },
        PathItem: {
          type: "object",
          properties: {
            $ref: {
              type: "string"
            },
            summary: {
              type: "string"
            },
            description: {
              type: "string"
            },
            servers: {
              type: "array",
              items: {
                $ref: "#/definitions/Server"
              }
            },
            parameters: {
              type: "array",
              items: {
                oneOf: [
                  {
                    $ref: "#/definitions/Parameter"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              },
              uniqueItems: true
            }
          },
          patternProperties: {
            "^(get|put|post|delete|options|head|patch|trace)$": {
              $ref: "#/definitions/Operation"
            },
            "^x-": {}
          },
          additionalProperties: false
        },
        Operation: {
          type: "object",
          required: [
            "responses"
          ],
          properties: {
            tags: {
              type: "array",
              items: {
                type: "string"
              }
            },
            summary: {
              type: "string"
            },
            description: {
              type: "string"
            },
            externalDocs: {
              $ref: "#/definitions/ExternalDocumentation"
            },
            operationId: {
              type: "string"
            },
            parameters: {
              type: "array",
              items: {
                oneOf: [
                  {
                    $ref: "#/definitions/Parameter"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              },
              uniqueItems: true
            },
            requestBody: {
              oneOf: [
                {
                  $ref: "#/definitions/RequestBody"
                },
                {
                  $ref: "#/definitions/Reference"
                }
              ]
            },
            responses: {
              $ref: "#/definitions/Responses"
            },
            callbacks: {
              type: "object",
              additionalProperties: {
                oneOf: [
                  {
                    $ref: "#/definitions/Callback"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              }
            },
            deprecated: {
              type: "boolean",
              default: false
            },
            security: {
              type: "array",
              items: {
                $ref: "#/definitions/SecurityRequirement"
              }
            },
            servers: {
              type: "array",
              items: {
                $ref: "#/definitions/Server"
              }
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        Responses: {
          type: "object",
          properties: {
            default: {
              oneOf: [
                {
                  $ref: "#/definitions/Response"
                },
                {
                  $ref: "#/definitions/Reference"
                }
              ]
            }
          },
          patternProperties: {
            "^[1-5](?:\\d{2}|XX)$": {
              oneOf: [
                {
                  $ref: "#/definitions/Response"
                },
                {
                  $ref: "#/definitions/Reference"
                }
              ]
            },
            "^x-": {}
          },
          minProperties: 1,
          additionalProperties: false
        },
        SecurityRequirement: {
          type: "object",
          additionalProperties: {
            type: "array",
            items: {
              type: "string"
            }
          }
        },
        Tag: {
          type: "object",
          required: [
            "name"
          ],
          properties: {
            name: {
              type: "string"
            },
            description: {
              type: "string"
            },
            externalDocs: {
              $ref: "#/definitions/ExternalDocumentation"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        ExternalDocumentation: {
          type: "object",
          required: [
            "url"
          ],
          properties: {
            description: {
              type: "string"
            },
            url: {
              type: "string",
              format: "uri-reference"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        ExampleXORExamples: {
          description: "Example and examples are mutually exclusive",
          not: {
            required: [
              "example",
              "examples"
            ]
          }
        },
        SchemaXORContent: {
          description: "Schema and content are mutually exclusive, at least one is required",
          not: {
            required: [
              "schema",
              "content"
            ]
          },
          oneOf: [
            {
              required: [
                "schema"
              ]
            },
            {
              required: [
                "content"
              ],
              description: "Some properties are not allowed if content is present",
              allOf: [
                {
                  not: {
                    required: [
                      "style"
                    ]
                  }
                },
                {
                  not: {
                    required: [
                      "explode"
                    ]
                  }
                },
                {
                  not: {
                    required: [
                      "allowReserved"
                    ]
                  }
                },
                {
                  not: {
                    required: [
                      "example"
                    ]
                  }
                },
                {
                  not: {
                    required: [
                      "examples"
                    ]
                  }
                }
              ]
            }
          ]
        },
        Parameter: {
          type: "object",
          properties: {
            name: {
              type: "string"
            },
            in: {
              type: "string"
            },
            description: {
              type: "string"
            },
            required: {
              type: "boolean",
              default: false
            },
            deprecated: {
              type: "boolean",
              default: false
            },
            allowEmptyValue: {
              type: "boolean",
              default: false
            },
            style: {
              type: "string"
            },
            explode: {
              type: "boolean"
            },
            allowReserved: {
              type: "boolean",
              default: false
            },
            schema: {
              oneOf: [
                {
                  $ref: "#/definitions/Schema"
                },
                {
                  $ref: "#/definitions/Reference"
                }
              ]
            },
            content: {
              type: "object",
              additionalProperties: {
                $ref: "#/definitions/MediaType"
              },
              minProperties: 1,
              maxProperties: 1
            },
            example: {},
            examples: {
              type: "object",
              additionalProperties: {
                oneOf: [
                  {
                    $ref: "#/definitions/Example"
                  },
                  {
                    $ref: "#/definitions/Reference"
                  }
                ]
              }
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false,
          required: [
            "name",
            "in"
          ],
          allOf: [
            {
              $ref: "#/definitions/ExampleXORExamples"
            },
            {
              $ref: "#/definitions/SchemaXORContent"
            },
            {
              $ref: "#/definitions/ParameterLocation"
            }
          ]
        },
        ParameterLocation: {
          description: "Parameter location",
          oneOf: [
            {
              description: "Parameter in path",
              required: [
                "required"
              ],
              properties: {
                in: {
                  enum: [
                    "path"
                  ]
                },
                style: {
                  enum: [
                    "matrix",
                    "label",
                    "simple"
                  ],
                  default: "simple"
                },
                required: {
                  enum: [
                    true
                  ]
                }
              }
            },
            {
              description: "Parameter in query",
              properties: {
                in: {
                  enum: [
                    "query"
                  ]
                },
                style: {
                  enum: [
                    "form",
                    "spaceDelimited",
                    "pipeDelimited",
                    "deepObject"
                  ],
                  default: "form"
                }
              }
            },
            {
              description: "Parameter in header",
              properties: {
                in: {
                  enum: [
                    "header"
                  ]
                },
                style: {
                  enum: [
                    "simple"
                  ],
                  default: "simple"
                }
              }
            },
            {
              description: "Parameter in cookie",
              properties: {
                in: {
                  enum: [
                    "cookie"
                  ]
                },
                style: {
                  enum: [
                    "form"
                  ],
                  default: "form"
                }
              }
            }
          ]
        },
        RequestBody: {
          type: "object",
          required: [
            "content"
          ],
          properties: {
            description: {
              type: "string"
            },
            content: {
              type: "object",
              additionalProperties: {
                $ref: "#/definitions/MediaType"
              }
            },
            required: {
              type: "boolean",
              default: false
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        SecurityScheme: {
          oneOf: [
            {
              $ref: "#/definitions/APIKeySecurityScheme"
            },
            {
              $ref: "#/definitions/HTTPSecurityScheme"
            },
            {
              $ref: "#/definitions/OAuth2SecurityScheme"
            },
            {
              $ref: "#/definitions/OpenIdConnectSecurityScheme"
            }
          ]
        },
        APIKeySecurityScheme: {
          type: "object",
          required: [
            "type",
            "name",
            "in"
          ],
          properties: {
            type: {
              type: "string",
              enum: [
                "apiKey"
              ]
            },
            name: {
              type: "string"
            },
            in: {
              type: "string",
              enum: [
                "header",
                "query",
                "cookie"
              ]
            },
            description: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        HTTPSecurityScheme: {
          type: "object",
          required: [
            "scheme",
            "type"
          ],
          properties: {
            scheme: {
              type: "string"
            },
            bearerFormat: {
              type: "string"
            },
            description: {
              type: "string"
            },
            type: {
              type: "string",
              enum: [
                "http"
              ]
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false,
          oneOf: [
            {
              description: "Bearer",
              properties: {
                scheme: {
                  enum: [
                    "bearer"
                  ]
                }
              }
            },
            {
              description: "Non Bearer",
              not: {
                required: [
                  "bearerFormat"
                ]
              },
              properties: {
                scheme: {
                  not: {
                    enum: [
                      "bearer"
                    ]
                  }
                }
              }
            }
          ]
        },
        OAuth2SecurityScheme: {
          type: "object",
          required: [
            "type",
            "flows"
          ],
          properties: {
            type: {
              type: "string",
              enum: [
                "oauth2"
              ]
            },
            flows: {
              $ref: "#/definitions/OAuthFlows"
            },
            description: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        OpenIdConnectSecurityScheme: {
          type: "object",
          required: [
            "type",
            "openIdConnectUrl"
          ],
          properties: {
            type: {
              type: "string",
              enum: [
                "openIdConnect"
              ]
            },
            openIdConnectUrl: {
              type: "string",
              format: "uri-reference"
            },
            description: {
              type: "string"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        OAuthFlows: {
          type: "object",
          properties: {
            implicit: {
              $ref: "#/definitions/ImplicitOAuthFlow"
            },
            password: {
              $ref: "#/definitions/PasswordOAuthFlow"
            },
            clientCredentials: {
              $ref: "#/definitions/ClientCredentialsFlow"
            },
            authorizationCode: {
              $ref: "#/definitions/AuthorizationCodeOAuthFlow"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        ImplicitOAuthFlow: {
          type: "object",
          required: [
            "authorizationUrl",
            "scopes"
          ],
          properties: {
            authorizationUrl: {
              type: "string",
              format: "uri-reference"
            },
            refreshUrl: {
              type: "string",
              format: "uri-reference"
            },
            scopes: {
              type: "object",
              additionalProperties: {
                type: "string"
              }
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        PasswordOAuthFlow: {
          type: "object",
          required: [
            "tokenUrl"
          ],
          properties: {
            tokenUrl: {
              type: "string",
              format: "uri-reference"
            },
            refreshUrl: {
              type: "string",
              format: "uri-reference"
            },
            scopes: {
              type: "object",
              additionalProperties: {
                type: "string"
              }
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        ClientCredentialsFlow: {
          type: "object",
          required: [
            "tokenUrl"
          ],
          properties: {
            tokenUrl: {
              type: "string",
              format: "uri-reference"
            },
            refreshUrl: {
              type: "string",
              format: "uri-reference"
            },
            scopes: {
              type: "object",
              additionalProperties: {
                type: "string"
              }
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        AuthorizationCodeOAuthFlow: {
          type: "object",
          required: [
            "authorizationUrl",
            "tokenUrl"
          ],
          properties: {
            authorizationUrl: {
              type: "string",
              format: "uri-reference"
            },
            tokenUrl: {
              type: "string",
              format: "uri-reference"
            },
            refreshUrl: {
              type: "string",
              format: "uri-reference"
            },
            scopes: {
              type: "object",
              additionalProperties: {
                type: "string"
              }
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false
        },
        Link: {
          type: "object",
          properties: {
            operationId: {
              type: "string"
            },
            operationRef: {
              type: "string",
              format: "uri-reference"
            },
            parameters: {
              type: "object",
              additionalProperties: {}
            },
            requestBody: {},
            description: {
              type: "string"
            },
            server: {
              $ref: "#/definitions/Server"
            }
          },
          patternProperties: {
            "^x-": {}
          },
          additionalProperties: false,
          not: {
            description: "Operation Id and Operation Ref are mutually exclusive",
            required: [
              "operationId",
              "operationRef"
            ]
          }
        },
        Callback: {
          type: "object",
          additionalProperties: {
            $ref: "#/definitions/PathItem"
          },
          patternProperties: {
            "^x-": {}
          }
        },
        Encoding: {
          type: "object",
          properties: {
            contentType: {
              type: "string"
            },
            headers: {
              type: "object",
              additionalProperties: {
                $ref: "#/definitions/Header"
              }
            },
            style: {
              type: "string",
              enum: [
                "form",
                "spaceDelimited",
                "pipeDelimited",
                "deepObject"
              ]
            },
            explode: {
              type: "boolean"
            },
            allowReserved: {
              type: "boolean",
              default: false
            }
          },
          additionalProperties: false
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+openapi-schemas@2.1.0/node_modules/@apidevtools/openapi-schemas/schemas/v3.1/schema.json
var require_schema4 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+openapi-schemas@2.1.0/node_modules/@apidevtools/openapi-schemas/schemas/v3.1/schema.json"(exports5, module) {
    module.exports = {
      $id: "https://spec.openapis.org/oas/3.1/schema/2021-04-15",
      $schema: "https://json-schema.org/draft/2020-12/schema",
      type: "object",
      properties: {
        openapi: {
          type: "string",
          pattern: "^3\\.1\\.\\d+(-.+)?$"
        },
        info: {
          $ref: "#/$defs/info"
        },
        jsonSchemaDialect: {
          $ref: "#/$defs/uri",
          default: "https://spec.openapis.org/oas/3.1/dialect/base"
        },
        servers: {
          type: "array",
          items: {
            $ref: "#/$defs/server"
          }
        },
        paths: {
          $ref: "#/$defs/paths"
        },
        webhooks: {
          type: "object",
          additionalProperties: {
            $ref: "#/$defs/path-item-or-reference"
          }
        },
        components: {
          $ref: "#/$defs/components"
        },
        security: {
          type: "array",
          items: {
            $ref: "#/$defs/security-requirement"
          }
        },
        tags: {
          type: "array",
          items: {
            $ref: "#/$defs/tag"
          }
        },
        externalDocs: {
          $ref: "#/$defs/external-documentation"
        }
      },
      required: [
        "openapi",
        "info"
      ],
      anyOf: [
        {
          required: [
            "paths"
          ]
        },
        {
          required: [
            "components"
          ]
        },
        {
          required: [
            "webhooks"
          ]
        }
      ],
      $ref: "#/$defs/specification-extensions",
      unevaluatedProperties: false,
      $defs: {
        info: {
          type: "object",
          properties: {
            title: {
              type: "string"
            },
            summary: {
              type: "string"
            },
            description: {
              type: "string"
            },
            termsOfService: {
              type: "string"
            },
            contact: {
              $ref: "#/$defs/contact"
            },
            license: {
              $ref: "#/$defs/license"
            },
            version: {
              type: "string"
            }
          },
          required: [
            "title",
            "version"
          ],
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        contact: {
          type: "object",
          properties: {
            name: {
              type: "string"
            },
            url: {
              type: "string"
            },
            email: {
              type: "string"
            }
          },
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        license: {
          type: "object",
          properties: {
            name: {
              type: "string"
            },
            identifier: {
              type: "string"
            },
            url: {
              $ref: "#/$defs/uri"
            }
          },
          required: [
            "name"
          ],
          oneOf: [
            {
              required: [
                "identifier"
              ]
            },
            {
              required: [
                "url"
              ]
            }
          ],
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        server: {
          type: "object",
          properties: {
            url: {
              $ref: "#/$defs/uri"
            },
            description: {
              type: "string"
            },
            variables: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/server-variable"
              }
            }
          },
          required: [
            "url"
          ],
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        "server-variable": {
          type: "object",
          properties: {
            enum: {
              type: "array",
              items: {
                type: "string"
              },
              minItems: 1
            },
            default: {
              type: "string"
            },
            descriptions: {
              type: "string"
            }
          },
          required: [
            "default"
          ],
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        components: {
          type: "object",
          properties: {
            schemas: {
              type: "object",
              additionalProperties: {
                $dynamicRef: "#meta"
              }
            },
            responses: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/response-or-reference"
              }
            },
            parameters: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/parameter-or-reference"
              }
            },
            examples: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/example-or-reference"
              }
            },
            requestBodies: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/request-body-or-reference"
              }
            },
            headers: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/header-or-reference"
              }
            },
            securitySchemes: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/security-scheme-or-reference"
              }
            },
            links: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/link-or-reference"
              }
            },
            callbacks: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/callbacks-or-reference"
              }
            },
            pathItems: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/path-item-or-reference"
              }
            }
          },
          patternProperties: {
            "^(schemas|responses|parameters|examples|requestBodies|headers|securitySchemes|links|callbacks|pathItems)$": {
              $comment: "Enumerating all of the property names in the regex above is necessary for unevaluatedProperties to work as expected",
              propertyNames: {
                pattern: "^[a-zA-Z0-9._-]+$"
              }
            }
          },
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        paths: {
          type: "object",
          patternProperties: {
            "^/": {
              $ref: "#/$defs/path-item"
            }
          },
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        "path-item": {
          type: "object",
          properties: {
            summary: {
              type: "string"
            },
            description: {
              type: "string"
            },
            servers: {
              type: "array",
              items: {
                $ref: "#/$defs/server"
              }
            },
            parameters: {
              type: "array",
              items: {
                $ref: "#/$defs/parameter-or-reference"
              }
            }
          },
          patternProperties: {
            "^(get|put|post|delete|options|head|patch|trace)$": {
              $ref: "#/$defs/operation"
            }
          },
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        "path-item-or-reference": {
          if: {
            required: [
              "$ref"
            ]
          },
          then: {
            $ref: "#/$defs/reference"
          },
          else: {
            $ref: "#/$defs/path-item"
          }
        },
        operation: {
          type: "object",
          properties: {
            tags: {
              type: "array",
              items: {
                type: "string"
              }
            },
            summary: {
              type: "string"
            },
            description: {
              type: "string"
            },
            externalDocs: {
              $ref: "#/$defs/external-documentation"
            },
            operationId: {
              type: "string"
            },
            parameters: {
              type: "array",
              items: {
                $ref: "#/$defs/parameter-or-reference"
              }
            },
            requestBody: {
              $ref: "#/$defs/request-body-or-reference"
            },
            responses: {
              $ref: "#/$defs/responses"
            },
            callbacks: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/callbacks-or-reference"
              }
            },
            deprecated: {
              default: false,
              type: "boolean"
            },
            security: {
              type: "array",
              items: {
                $ref: "#/$defs/security-requirement"
              }
            },
            servers: {
              type: "array",
              items: {
                $ref: "#/$defs/server"
              }
            }
          },
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        "external-documentation": {
          type: "object",
          properties: {
            description: {
              type: "string"
            },
            url: {
              $ref: "#/$defs/uri"
            }
          },
          required: [
            "url"
          ],
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        parameter: {
          type: "object",
          properties: {
            name: {
              type: "string"
            },
            in: {
              enum: [
                "query",
                "header",
                "path",
                "cookie"
              ]
            },
            description: {
              type: "string"
            },
            required: {
              default: false,
              type: "boolean"
            },
            deprecated: {
              default: false,
              type: "boolean"
            },
            allowEmptyValue: {
              default: false,
              type: "boolean"
            },
            schema: {
              $dynamicRef: "#meta"
            },
            content: {
              $ref: "#/$defs/content"
            }
          },
          required: [
            "in"
          ],
          oneOf: [
            {
              required: [
                "schema"
              ]
            },
            {
              required: [
                "content"
              ]
            }
          ],
          dependentSchemas: {
            schema: {
              properties: {
                style: {
                  type: "string"
                },
                explode: {
                  type: "boolean"
                },
                allowReserved: {
                  default: false,
                  type: "boolean"
                }
              },
              allOf: [
                {
                  $ref: "#/$defs/examples"
                },
                {
                  $ref: "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-path"
                },
                {
                  $ref: "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-header"
                },
                {
                  $ref: "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-query"
                },
                {
                  $ref: "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-cookie"
                },
                {
                  $ref: "#/$defs/parameter/dependentSchemas/schema/$defs/styles-for-form"
                }
              ],
              $defs: {
                "styles-for-path": {
                  if: {
                    properties: {
                      in: {
                        const: "path"
                      }
                    },
                    required: [
                      "in"
                    ]
                  },
                  then: {
                    properties: {
                      style: {
                        default: "simple",
                        enum: [
                          "matrix",
                          "label",
                          "simple"
                        ]
                      },
                      required: {
                        const: true
                      }
                    },
                    required: [
                      "required"
                    ]
                  }
                },
                "styles-for-header": {
                  if: {
                    properties: {
                      in: {
                        const: "header"
                      }
                    },
                    required: [
                      "in"
                    ]
                  },
                  then: {
                    properties: {
                      style: {
                        default: "simple",
                        enum: [
                          "simple"
                        ]
                      }
                    }
                  }
                },
                "styles-for-query": {
                  if: {
                    properties: {
                      in: {
                        const: "query"
                      }
                    },
                    required: [
                      "in"
                    ]
                  },
                  then: {
                    properties: {
                      style: {
                        default: "form",
                        enum: [
                          "form",
                          "spaceDelimited",
                          "pipeDelimited",
                          "deepObject"
                        ]
                      }
                    }
                  }
                },
                "styles-for-cookie": {
                  if: {
                    properties: {
                      in: {
                        const: "cookie"
                      }
                    },
                    required: [
                      "in"
                    ]
                  },
                  then: {
                    properties: {
                      style: {
                        default: "form",
                        enum: [
                          "form"
                        ]
                      }
                    }
                  }
                },
                "styles-for-form": {
                  if: {
                    properties: {
                      style: {
                        const: "form"
                      }
                    },
                    required: [
                      "style"
                    ]
                  },
                  then: {
                    properties: {
                      explode: {
                        default: true
                      }
                    }
                  },
                  else: {
                    properties: {
                      explode: {
                        default: false
                      }
                    }
                  }
                }
              }
            }
          },
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        "parameter-or-reference": {
          if: {
            required: [
              "$ref"
            ]
          },
          then: {
            $ref: "#/$defs/reference"
          },
          else: {
            $ref: "#/$defs/parameter"
          }
        },
        "request-body": {
          type: "object",
          properties: {
            description: {
              type: "string"
            },
            content: {
              $ref: "#/$defs/content"
            },
            required: {
              default: false,
              type: "boolean"
            }
          },
          required: [
            "content"
          ],
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        "request-body-or-reference": {
          if: {
            required: [
              "$ref"
            ]
          },
          then: {
            $ref: "#/$defs/reference"
          },
          else: {
            $ref: "#/$defs/request-body"
          }
        },
        content: {
          type: "object",
          additionalProperties: {
            $ref: "#/$defs/media-type"
          },
          propertyNames: {
            format: "media-range"
          }
        },
        "media-type": {
          type: "object",
          properties: {
            schema: {
              $dynamicRef: "#meta"
            },
            encoding: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/encoding"
              }
            }
          },
          allOf: [
            {
              $ref: "#/$defs/specification-extensions"
            },
            {
              $ref: "#/$defs/examples"
            }
          ],
          unevaluatedProperties: false
        },
        encoding: {
          type: "object",
          properties: {
            contentType: {
              type: "string",
              format: "media-range"
            },
            headers: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/header-or-reference"
              }
            },
            style: {
              default: "form",
              enum: [
                "form",
                "spaceDelimited",
                "pipeDelimited",
                "deepObject"
              ]
            },
            explode: {
              type: "boolean"
            },
            allowReserved: {
              default: false,
              type: "boolean"
            }
          },
          allOf: [
            {
              $ref: "#/$defs/specification-extensions"
            },
            {
              $ref: "#/$defs/encoding/$defs/explode-default"
            }
          ],
          unevaluatedProperties: false,
          $defs: {
            "explode-default": {
              if: {
                properties: {
                  style: {
                    const: "form"
                  }
                },
                required: [
                  "style"
                ]
              },
              then: {
                properties: {
                  explode: {
                    default: true
                  }
                }
              },
              else: {
                properties: {
                  explode: {
                    default: false
                  }
                }
              }
            }
          }
        },
        responses: {
          type: "object",
          properties: {
            default: {
              $ref: "#/$defs/response-or-reference"
            }
          },
          patternProperties: {
            "^[1-5][0-9X]{2}$": {
              $ref: "#/$defs/response-or-reference"
            }
          },
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        response: {
          type: "object",
          properties: {
            description: {
              type: "string"
            },
            headers: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/header-or-reference"
              }
            },
            content: {
              $ref: "#/$defs/content"
            },
            links: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/link-or-reference"
              }
            }
          },
          required: [
            "description"
          ],
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        "response-or-reference": {
          if: {
            required: [
              "$ref"
            ]
          },
          then: {
            $ref: "#/$defs/reference"
          },
          else: {
            $ref: "#/$defs/response"
          }
        },
        callbacks: {
          type: "object",
          $ref: "#/$defs/specification-extensions",
          additionalProperties: {
            $ref: "#/$defs/path-item-or-reference"
          }
        },
        "callbacks-or-reference": {
          if: {
            required: [
              "$ref"
            ]
          },
          then: {
            $ref: "#/$defs/reference"
          },
          else: {
            $ref: "#/$defs/callbacks"
          }
        },
        example: {
          type: "object",
          properties: {
            summary: {
              type: "string"
            },
            description: {
              type: "string"
            },
            value: true,
            externalValue: {
              $ref: "#/$defs/uri"
            }
          },
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        "example-or-reference": {
          if: {
            required: [
              "$ref"
            ]
          },
          then: {
            $ref: "#/$defs/reference"
          },
          else: {
            $ref: "#/$defs/example"
          }
        },
        link: {
          type: "object",
          properties: {
            operationRef: {
              $ref: "#/$defs/uri"
            },
            operationId: true,
            parameters: {
              $ref: "#/$defs/map-of-strings"
            },
            requestBody: true,
            description: {
              type: "string"
            },
            body: {
              $ref: "#/$defs/server"
            }
          },
          oneOf: [
            {
              required: [
                "operationRef"
              ]
            },
            {
              required: [
                "operationId"
              ]
            }
          ],
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        "link-or-reference": {
          if: {
            required: [
              "$ref"
            ]
          },
          then: {
            $ref: "#/$defs/reference"
          },
          else: {
            $ref: "#/$defs/link"
          }
        },
        header: {
          type: "object",
          properties: {
            description: {
              type: "string"
            },
            required: {
              default: false,
              type: "boolean"
            },
            deprecated: {
              default: false,
              type: "boolean"
            },
            allowEmptyValue: {
              default: false,
              type: "boolean"
            }
          },
          dependentSchemas: {
            schema: {
              properties: {
                style: {
                  default: "simple",
                  enum: [
                    "simple"
                  ]
                },
                explode: {
                  default: false,
                  type: "boolean"
                },
                allowReserved: {
                  default: false,
                  type: "boolean"
                },
                schema: {
                  $dynamicRef: "#meta"
                }
              },
              $ref: "#/$defs/examples"
            },
            content: {
              properties: {
                content: {
                  $ref: "#/$defs/content"
                }
              }
            }
          },
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        "header-or-reference": {
          if: {
            required: [
              "$ref"
            ]
          },
          then: {
            $ref: "#/$defs/reference"
          },
          else: {
            $ref: "#/$defs/header"
          }
        },
        tag: {
          type: "object",
          properties: {
            name: {
              type: "string"
            },
            description: {
              type: "string"
            },
            externalDocs: {
              $ref: "#/$defs/external-documentation"
            }
          },
          required: [
            "name"
          ],
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false
        },
        reference: {
          type: "object",
          properties: {
            $ref: {
              $ref: "#/$defs/uri"
            },
            summary: {
              type: "string"
            },
            description: {
              type: "string"
            }
          },
          unevaluatedProperties: false
        },
        schema: {
          $dynamicAnchor: "meta",
          type: [
            "object",
            "boolean"
          ]
        },
        "security-scheme": {
          type: "object",
          properties: {
            type: {
              enum: [
                "apiKey",
                "http",
                "mutualTLS",
                "oauth2",
                "openIdConnect"
              ]
            },
            description: {
              type: "string"
            }
          },
          required: [
            "type"
          ],
          allOf: [
            {
              $ref: "#/$defs/specification-extensions"
            },
            {
              $ref: "#/$defs/security-scheme/$defs/type-apikey"
            },
            {
              $ref: "#/$defs/security-scheme/$defs/type-http"
            },
            {
              $ref: "#/$defs/security-scheme/$defs/type-http-bearer"
            },
            {
              $ref: "#/$defs/security-scheme/$defs/type-oauth2"
            },
            {
              $ref: "#/$defs/security-scheme/$defs/type-oidc"
            }
          ],
          unevaluatedProperties: false,
          $defs: {
            "type-apikey": {
              if: {
                properties: {
                  type: {
                    const: "apiKey"
                  }
                },
                required: [
                  "type"
                ]
              },
              then: {
                properties: {
                  name: {
                    type: "string"
                  },
                  in: {
                    enum: [
                      "query",
                      "header",
                      "cookie"
                    ]
                  }
                },
                required: [
                  "name",
                  "in"
                ]
              }
            },
            "type-http": {
              if: {
                properties: {
                  type: {
                    const: "http"
                  }
                },
                required: [
                  "type"
                ]
              },
              then: {
                properties: {
                  scheme: {
                    type: "string"
                  }
                },
                required: [
                  "scheme"
                ]
              }
            },
            "type-http-bearer": {
              if: {
                properties: {
                  type: {
                    const: "http"
                  },
                  scheme: {
                    const: "bearer"
                  }
                },
                required: [
                  "type",
                  "scheme"
                ]
              },
              then: {
                properties: {
                  bearerFormat: {
                    type: "string"
                  }
                },
                required: [
                  "scheme"
                ]
              }
            },
            "type-oauth2": {
              if: {
                properties: {
                  type: {
                    const: "oauth2"
                  }
                },
                required: [
                  "type"
                ]
              },
              then: {
                properties: {
                  flows: {
                    $ref: "#/$defs/oauth-flows"
                  }
                },
                required: [
                  "flows"
                ]
              }
            },
            "type-oidc": {
              if: {
                properties: {
                  type: {
                    const: "openIdConnect"
                  }
                },
                required: [
                  "type"
                ]
              },
              then: {
                properties: {
                  openIdConnectUrl: {
                    $ref: "#/$defs/uri"
                  }
                },
                required: [
                  "openIdConnectUrl"
                ]
              }
            }
          }
        },
        "security-scheme-or-reference": {
          if: {
            required: [
              "$ref"
            ]
          },
          then: {
            $ref: "#/$defs/reference"
          },
          else: {
            $ref: "#/$defs/security-scheme"
          }
        },
        "oauth-flows": {
          type: "object",
          properties: {
            implicit: {
              $ref: "#/$defs/oauth-flows/$defs/implicit"
            },
            password: {
              $ref: "#/$defs/oauth-flows/$defs/password"
            },
            clientCredentials: {
              $ref: "#/$defs/oauth-flows/$defs/client-credentials"
            },
            authorizationCode: {
              $ref: "#/$defs/oauth-flows/$defs/authorization-code"
            }
          },
          $ref: "#/$defs/specification-extensions",
          unevaluatedProperties: false,
          $defs: {
            implicit: {
              type: "object",
              properties: {
                authorizationUrl: {
                  type: "string"
                },
                refreshUrl: {
                  type: "string"
                },
                scopes: {
                  $ref: "#/$defs/map-of-strings"
                }
              },
              required: [
                "authorizationUrl",
                "scopes"
              ],
              $ref: "#/$defs/specification-extensions",
              unevaluatedProperties: false
            },
            password: {
              type: "object",
              properties: {
                tokenUrl: {
                  type: "string"
                },
                refreshUrl: {
                  type: "string"
                },
                scopes: {
                  $ref: "#/$defs/map-of-strings"
                }
              },
              required: [
                "tokenUrl",
                "scopes"
              ],
              $ref: "#/$defs/specification-extensions",
              unevaluatedProperties: false
            },
            "client-credentials": {
              type: "object",
              properties: {
                tokenUrl: {
                  type: "string"
                },
                refreshUrl: {
                  type: "string"
                },
                scopes: {
                  $ref: "#/$defs/map-of-strings"
                }
              },
              required: [
                "tokenUrl",
                "scopes"
              ],
              $ref: "#/$defs/specification-extensions",
              unevaluatedProperties: false
            },
            "authorization-code": {
              type: "object",
              properties: {
                authorizationUrl: {
                  type: "string"
                },
                tokenUrl: {
                  type: "string"
                },
                refreshUrl: {
                  type: "string"
                },
                scopes: {
                  $ref: "#/$defs/map-of-strings"
                }
              },
              required: [
                "authorizationUrl",
                "tokenUrl",
                "scopes"
              ],
              $ref: "#/$defs/specification-extensions",
              unevaluatedProperties: false
            }
          }
        },
        "security-requirement": {
          type: "object",
          additionalProperties: {
            type: "array",
            items: {
              type: "string"
            }
          }
        },
        "specification-extensions": {
          patternProperties: {
            "^x-": true
          }
        },
        examples: {
          properties: {
            example: true,
            examples: {
              type: "object",
              additionalProperties: {
                $ref: "#/$defs/example-or-reference"
              }
            }
          }
        },
        uri: {
          type: "string",
          format: "uri"
        },
        "map-of-strings": {
          type: "object",
          additionalProperties: {
            type: "string"
          }
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+openapi-schemas@2.1.0/node_modules/@apidevtools/openapi-schemas/lib/index.js
var require_lib = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+openapi-schemas@2.1.0/node_modules/@apidevtools/openapi-schemas/lib/index.js"(exports5, module) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.openapi = exports5.openapiV31 = exports5.openapiV3 = exports5.openapiV2 = exports5.openapiV1 = void 0;
    exports5.openapiV1 = require_apiDeclaration();
    exports5.openapiV2 = require_schema2();
    exports5.openapiV3 = require_schema3();
    exports5.openapiV31 = require_schema4();
    exports5.openapi = {
      v1: exports5.openapiV1,
      v2: exports5.openapiV2,
      v3: exports5.openapiV3,
      v31: exports5.openapiV31
    };
    exports5.default = exports5.openapi;
    if (typeof module === "object" && typeof module.exports === "object") {
      module.exports = Object.assign(module.exports.default, module.exports);
    }
  }
});

// src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/vocabulary/core.js
var require_core4 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/vocabulary/core.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var ref_1 = require_ref();
    var core = [
      "$schema",
      "id",
      "$defs",
      { keyword: "$comment" },
      "definitions",
      ref_1.default
    ];
    exports5.default = core;
  }
});

// src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumber.js
var require_limitNumber2 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumber.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var core_1 = require_core();
    var codegen_1 = require_codegen();
    var ops = codegen_1.operators;
    var KWDs = {
      maximum: {
        exclusive: "exclusiveMaximum",
        ops: [
          { okStr: "<=", ok: ops.LTE, fail: ops.GT },
          { okStr: "<", ok: ops.LT, fail: ops.GTE }
        ]
      },
      minimum: {
        exclusive: "exclusiveMinimum",
        ops: [
          { okStr: ">=", ok: ops.GTE, fail: ops.LT },
          { okStr: ">", ok: ops.GT, fail: ops.LTE }
        ]
      }
    };
    var error = {
      message: (cxt) => core_1.str`must be ${kwdOp(cxt).okStr} ${cxt.schemaCode}`,
      params: (cxt) => core_1._`{comparison: ${kwdOp(cxt).okStr}, limit: ${cxt.schemaCode}}`
    };
    var def = {
      keyword: Object.keys(KWDs),
      type: "number",
      schemaType: "number",
      $data: true,
      error,
      code(cxt) {
        const { data, schemaCode } = cxt;
        cxt.fail$data(core_1._`${data} ${kwdOp(cxt).fail} ${schemaCode} || isNaN(${data})`);
      }
    };
    function kwdOp(cxt) {
      var _a;
      const keyword = cxt.keyword;
      const opsIdx = ((_a = cxt.parentSchema) === null || _a === void 0 ? void 0 : _a[KWDs[keyword].exclusive]) ? 1 : 0;
      return KWDs[keyword].ops[opsIdx];
    }
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumberExclusive.js
var require_limitNumberExclusive = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/vocabulary/validation/limitNumberExclusive.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var KWDs = {
      exclusiveMaximum: "maximum",
      exclusiveMinimum: "minimum"
    };
    var def = {
      keyword: Object.keys(KWDs),
      type: "number",
      schemaType: "boolean",
      code({ keyword, parentSchema }) {
        const limitKwd = KWDs[keyword];
        if (parentSchema[limitKwd] === void 0) {
          throw new Error(`${keyword} can only be used with ${limitKwd}`);
        }
      }
    };
    exports5.default = def;
  }
});

// src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/vocabulary/validation/index.js
var require_validation3 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/vocabulary/validation/index.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var limitNumber_1 = require_limitNumber2();
    var limitNumberExclusive_1 = require_limitNumberExclusive();
    var multipleOf_1 = require_multipleOf();
    var limitLength_1 = require_limitLength();
    var pattern_1 = require_pattern();
    var limitProperties_1 = require_limitProperties();
    var required_1 = require_required();
    var limitItems_1 = require_limitItems();
    var uniqueItems_1 = require_uniqueItems();
    var const_1 = require_const();
    var enum_1 = require_enum();
    var validation = [
      // number
      limitNumber_1.default,
      limitNumberExclusive_1.default,
      multipleOf_1.default,
      // string
      limitLength_1.default,
      pattern_1.default,
      // object
      limitProperties_1.default,
      required_1.default,
      // array
      limitItems_1.default,
      uniqueItems_1.default,
      // any
      { keyword: "type", schemaType: ["string", "array"] },
      { keyword: "nullable", schemaType: "boolean" },
      const_1.default,
      enum_1.default
    ];
    exports5.default = validation;
  }
});

// src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/vocabulary/draft4.js
var require_draft4 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/vocabulary/draft4.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var core_1 = require_core4();
    var validation_1 = require_validation3();
    var applicator_1 = require_applicator();
    var format_1 = require_format2();
    var metadataVocabulary = ["title", "description", "default"];
    var draft4Vocabularies = [
      core_1.default,
      validation_1.default,
      applicator_1.default(),
      format_1.default,
      metadataVocabulary
    ];
    exports5.default = draft4Vocabularies;
  }
});

// src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/refs/json-schema-draft-04.json
var require_json_schema_draft_04 = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/refs/json-schema-draft-04.json"(exports5, module) {
    module.exports = {
      id: "http://json-schema.org/draft-04/schema#",
      $schema: "http://json-schema.org/draft-04/schema#",
      description: "Core schema meta-schema",
      definitions: {
        schemaArray: {
          type: "array",
          minItems: 1,
          items: { $ref: "#" }
        },
        positiveInteger: {
          type: "integer",
          minimum: 0
        },
        positiveIntegerDefault0: {
          allOf: [{ $ref: "#/definitions/positiveInteger" }, { default: 0 }]
        },
        simpleTypes: {
          enum: ["array", "boolean", "integer", "null", "number", "object", "string"]
        },
        stringArray: {
          type: "array",
          items: { type: "string" },
          minItems: 1,
          uniqueItems: true
        }
      },
      type: "object",
      properties: {
        id: {
          type: "string",
          format: "uri"
        },
        $schema: {
          type: "string",
          format: "uri"
        },
        title: {
          type: "string"
        },
        description: {
          type: "string"
        },
        default: {},
        multipleOf: {
          type: "number",
          minimum: 0,
          exclusiveMinimum: true
        },
        maximum: {
          type: "number"
        },
        exclusiveMaximum: {
          type: "boolean",
          default: false
        },
        minimum: {
          type: "number"
        },
        exclusiveMinimum: {
          type: "boolean",
          default: false
        },
        maxLength: { $ref: "#/definitions/positiveInteger" },
        minLength: { $ref: "#/definitions/positiveIntegerDefault0" },
        pattern: {
          type: "string",
          format: "regex"
        },
        additionalItems: {
          anyOf: [{ type: "boolean" }, { $ref: "#" }],
          default: {}
        },
        items: {
          anyOf: [{ $ref: "#" }, { $ref: "#/definitions/schemaArray" }],
          default: {}
        },
        maxItems: { $ref: "#/definitions/positiveInteger" },
        minItems: { $ref: "#/definitions/positiveIntegerDefault0" },
        uniqueItems: {
          type: "boolean",
          default: false
        },
        maxProperties: { $ref: "#/definitions/positiveInteger" },
        minProperties: { $ref: "#/definitions/positiveIntegerDefault0" },
        required: { $ref: "#/definitions/stringArray" },
        additionalProperties: {
          anyOf: [{ type: "boolean" }, { $ref: "#" }],
          default: {}
        },
        definitions: {
          type: "object",
          additionalProperties: { $ref: "#" },
          default: {}
        },
        properties: {
          type: "object",
          additionalProperties: { $ref: "#" },
          default: {}
        },
        patternProperties: {
          type: "object",
          additionalProperties: { $ref: "#" },
          default: {}
        },
        dependencies: {
          type: "object",
          additionalProperties: {
            anyOf: [{ $ref: "#" }, { $ref: "#/definitions/stringArray" }]
          }
        },
        enum: {
          type: "array",
          minItems: 1,
          uniqueItems: true
        },
        type: {
          anyOf: [
            { $ref: "#/definitions/simpleTypes" },
            {
              type: "array",
              items: { $ref: "#/definitions/simpleTypes" },
              minItems: 1,
              uniqueItems: true
            }
          ]
        },
        allOf: { $ref: "#/definitions/schemaArray" },
        anyOf: { $ref: "#/definitions/schemaArray" },
        oneOf: { $ref: "#/definitions/schemaArray" },
        not: { $ref: "#" }
      },
      dependencies: {
        exclusiveMaximum: ["maximum"],
        exclusiveMinimum: ["minimum"]
      },
      default: {}
    };
  }
});

// src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/index.js
var require_dist = __commonJS({
  "src/typespec/node_modules/.pnpm/ajv-draft-04@1.0.0_ajv@8.17.1/node_modules/ajv-draft-04/dist/index.js"(exports5, module) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.CodeGen = exports5.Name = exports5.nil = exports5.stringify = exports5.str = exports5._ = exports5.KeywordCxt = void 0;
    var core_1 = require_core();
    var draft4_1 = require_draft4();
    var discriminator_1 = require_discriminator();
    var draft4MetaSchema = require_json_schema_draft_04();
    var META_SUPPORT_DATA = ["/properties"];
    var META_SCHEMA_ID = "http://json-schema.org/draft-04/schema";
    var Ajv = class extends core_1.default {
      constructor(opts = {}) {
        super({
          ...opts,
          schemaId: "id"
        });
      }
      _addVocabularies() {
        super._addVocabularies();
        draft4_1.default.forEach((v) => this.addVocabulary(v));
        if (this.opts.discriminator)
          this.addKeyword(discriminator_1.default);
      }
      _addDefaultMetaSchema() {
        super._addDefaultMetaSchema();
        if (!this.opts.meta)
          return;
        const metaSchema = this.opts.$data ? this.$dataMetaSchema(draft4MetaSchema, META_SUPPORT_DATA) : draft4MetaSchema;
        this.addMetaSchema(metaSchema, META_SCHEMA_ID, false);
        this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
      }
      defaultMeta() {
        return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : void 0);
      }
    };
    module.exports = exports5 = Ajv;
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.default = Ajv;
    var core_2 = require_core();
    Object.defineProperty(exports5, "KeywordCxt", { enumerable: true, get: function() {
      return core_2.KeywordCxt;
    } });
    var core_3 = require_core();
    Object.defineProperty(exports5, "_", { enumerable: true, get: function() {
      return core_3._;
    } });
    Object.defineProperty(exports5, "str", { enumerable: true, get: function() {
      return core_3.str;
    } });
    Object.defineProperty(exports5, "stringify", { enumerable: true, get: function() {
      return core_3.stringify;
    } });
    Object.defineProperty(exports5, "nil", { enumerable: true, get: function() {
      return core_3.nil;
    } });
    Object.defineProperty(exports5, "Name", { enumerable: true, get: function() {
      return core_3.Name;
    } });
    Object.defineProperty(exports5, "CodeGen", { enumerable: true, get: function() {
      return core_3.CodeGen;
    } });
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+swagger-parser@12.0.0_openapi-types@12.1.3/node_modules/@apidevtools/swagger-parser/lib/validators/schema.js
var require_schema5 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+swagger-parser@12.0.0_openapi-types@12.1.3/node_modules/@apidevtools/swagger-parser/lib/validators/schema.js"(exports5, module) {
    "use strict";
    var util = require_util();
    var Ajv = require__();
    var { openapi } = require_lib();
    module.exports = validateSchema;
    function validateSchema(api) {
      let ajv;
      let schema4;
      if (api.swagger) {
        schema4 = openapi.v2;
        ajv = initializeAjv();
      } else {
        if (api.openapi.startsWith("3.1")) {
          schema4 = openapi.v31;
          const schemaDynamicRef = schema4.$defs.schema;
          delete schemaDynamicRef.$dynamicAnchor;
          schema4.$defs.components.properties.schemas.additionalProperties = schemaDynamicRef;
          schema4.$defs.header.dependentSchemas.schema.properties.schema = schemaDynamicRef;
          schema4.$defs["media-type"].properties.schema = schemaDynamicRef;
          schema4.$defs.parameter.properties.schema = schemaDynamicRef;
          ajv = initializeAjv(false);
        } else {
          schema4 = openapi.v3;
          ajv = initializeAjv();
        }
      }
      let isValid = ajv.validate(schema4, api);
      if (!isValid) {
        let err = ajv.errors;
        let message = "Swagger schema validation failed.\n" + formatAjvError(err);
        const error = new SyntaxError(message);
        error.details = err;
        throw error;
      }
    }
    function initializeAjv(draft04 = true) {
      const opts = {
        allErrors: true,
        strict: false,
        validateFormats: false
      };
      if (draft04) {
        const AjvDraft4 = require_dist();
        return new AjvDraft4(opts);
      }
      return new Ajv(opts);
    }
    function formatAjvError(errors, indent) {
      indent = indent || "  ";
      let message = "";
      for (let error of errors) {
        message += util.format(`${indent}#${error.instancePath.length ? error.instancePath : "/"} ${error.message}
`);
      }
      return message;
    }
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+swagger-methods@3.0.2/node_modules/@apidevtools/swagger-methods/lib/index.js
var require_lib2 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+swagger-methods@3.0.2/node_modules/@apidevtools/swagger-methods/lib/index.js"(exports5, module) {
    "use strict";
    module.exports = [
      "get",
      "put",
      "post",
      "delete",
      "options",
      "head",
      "patch"
    ];
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+swagger-parser@12.0.0_openapi-types@12.1.3/node_modules/@apidevtools/swagger-parser/lib/validators/spec.js
var require_spec = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+swagger-parser@12.0.0_openapi-types@12.1.3/node_modules/@apidevtools/swagger-parser/lib/validators/spec.js"(exports5, module) {
    "use strict";
    var util = require_util();
    var swaggerMethods = require_lib2();
    var primitiveTypes = ["array", "boolean", "integer", "number", "string"];
    var schemaTypes = ["array", "boolean", "integer", "number", "string", "object", "null", void 0];
    module.exports = validateSpec;
    function validateSpec(api) {
      if (api.openapi) {
        return;
      }
      let paths = Object.keys(api.paths || {});
      let operationIds = [];
      for (let pathName of paths) {
        let path = api.paths[pathName];
        let pathId = "/paths" + pathName;
        if (path && pathName.indexOf("/") === 0) {
          validatePath(api, path, pathId, operationIds);
        }
      }
      let definitions = Object.keys(api.definitions || {});
      for (let definitionName of definitions) {
        let definition = api.definitions[definitionName];
        let definitionId = "/definitions/" + definitionName;
        validateRequiredPropertiesExist(definition, definitionId);
      }
    }
    function validatePath(api, path, pathId, operationIds) {
      for (let operationName of swaggerMethods) {
        let operation = path[operationName];
        let operationId = pathId + "/" + operationName;
        if (operation) {
          let declaredOperationId = operation.operationId;
          if (declaredOperationId) {
            if (operationIds.indexOf(declaredOperationId) === -1) {
              operationIds.push(declaredOperationId);
            } else {
              throw new SyntaxError(`Validation failed. Duplicate operation id '${declaredOperationId}'`);
            }
          }
          validateParameters(api, path, pathId, operation, operationId);
          let responses = Object.keys(operation.responses || {});
          for (let responseName of responses) {
            let response = operation.responses[responseName];
            let responseId = operationId + "/responses/" + responseName;
            validateResponse(responseName, response || {}, responseId);
          }
        }
      }
    }
    function validateParameters(api, path, pathId, operation, operationId) {
      let pathParams = path.parameters || [];
      let operationParams = operation.parameters || [];
      try {
        checkForDuplicates(pathParams);
      } catch (e) {
        throw new SyntaxError(e, `Validation failed. ${pathId} has duplicate parameters`);
      }
      try {
        checkForDuplicates(operationParams);
      } catch (e) {
        throw new SyntaxError(e, `Validation failed. ${operationId} has duplicate parameters`);
      }
      let params = pathParams.reduce((combinedParams, value) => {
        let duplicate = combinedParams.some((param) => {
          return param.in === value.in && param.name === value.name;
        });
        if (!duplicate) {
          combinedParams.push(value);
        }
        return combinedParams;
      }, operationParams.slice());
      validateBodyParameters(params, operationId);
      validatePathParameters(params, pathId, operationId);
      validateParameterTypes(params, api, operation, operationId);
    }
    function validateBodyParameters(params, operationId) {
      let bodyParams = params.filter((param) => {
        return param.in === "body";
      });
      let formParams = params.filter((param) => {
        return param.in === "formData";
      });
      if (bodyParams.length > 1) {
        throw new SyntaxError(
          `Validation failed. ${operationId} has ${bodyParams.length} body parameters. Only one is allowed.`
        );
      } else if (bodyParams.length > 0 && formParams.length > 0) {
        throw new SyntaxError(
          `Validation failed. ${operationId} has body parameters and formData parameters. Only one or the other is allowed.`
        );
      }
    }
    function validatePathParameters(params, pathId, operationId) {
      let placeholders = pathId.match(util.swaggerParamRegExp) || [];
      for (let i = 0; i < placeholders.length; i++) {
        for (let j = i + 1; j < placeholders.length; j++) {
          if (placeholders[i] === placeholders[j]) {
            throw new SyntaxError(
              `Validation failed. ${operationId} has multiple path placeholders named ${placeholders[i]}`
            );
          }
        }
      }
      params = params.filter((param) => {
        return param.in === "path";
      });
      for (let param of params) {
        if (param.required !== true) {
          throw new SyntaxError(
            `Validation failed. Path parameters cannot be optional. Set required=true for the "${param.name}" parameter at ${operationId}`
          );
        }
        let match = placeholders.indexOf("{" + param.name + "}");
        if (match === -1) {
          throw new SyntaxError(
            `Validation failed. ${operationId} has a path parameter named "${param.name}", but there is no corresponding {${param.name}} in the path string`
          );
        }
        placeholders.splice(match, 1);
      }
      if (placeholders.length > 0) {
        throw new SyntaxError(`Validation failed. ${operationId} is missing path parameter(s) for ${placeholders}`);
      }
    }
    function validateParameterTypes(params, api, operation, operationId) {
      for (let param of params) {
        let parameterId = operationId + "/parameters/" + param.name;
        let schema4, validTypes;
        switch (param.in) {
          case "body":
            schema4 = param.schema;
            validTypes = schemaTypes;
            break;
          case "formData":
            schema4 = param;
            validTypes = primitiveTypes.concat("file");
            break;
          default:
            schema4 = param;
            validTypes = primitiveTypes;
        }
        validateSchema(schema4, parameterId, validTypes);
        validateRequiredPropertiesExist(schema4, parameterId);
        if (schema4.type === "file") {
          let formData = /multipart\/(.*\+)?form-data/;
          let urlEncoded = /application\/(.*\+)?x-www-form-urlencoded/;
          let consumes = operation.consumes || api.consumes || [];
          let hasValidMimeType = consumes.some((consume) => {
            return formData.test(consume) || urlEncoded.test(consume);
          });
          if (!hasValidMimeType) {
            throw new SyntaxError(
              `Validation failed. ${operationId} has a file parameter, so it must consume multipart/form-data or application/x-www-form-urlencoded`
            );
          }
        }
      }
    }
    function checkForDuplicates(params) {
      for (let i = 0; i < params.length - 1; i++) {
        let outer = params[i];
        for (let j = i + 1; j < params.length; j++) {
          let inner = params[j];
          if (outer.name === inner.name && outer.in === inner.in) {
            throw new SyntaxError(`Validation failed. Found multiple ${outer.in} parameters named "${outer.name}"`);
          }
        }
      }
    }
    function validateResponse(code2, response, responseId) {
      if (code2 !== "default" && (code2 < 100 || code2 > 599)) {
        throw new SyntaxError(`Validation failed. ${responseId} has an invalid response code (${code2})`);
      }
      let headers = Object.keys(response.headers || {});
      for (let headerName of headers) {
        let header = response.headers[headerName];
        let headerId = responseId + "/headers/" + headerName;
        validateSchema(header, headerId, primitiveTypes);
      }
      if (response.schema) {
        let validTypes = schemaTypes.concat("file");
        if (validTypes.indexOf(response.schema.type) === -1) {
          throw new SyntaxError(
            `Validation failed. ${responseId} has an invalid response schema type (${response.schema.type})`
          );
        } else {
          validateSchema(response.schema, responseId + "/schema", validTypes);
        }
      }
    }
    function validateSchema(schema4, schemaId, validTypes) {
      if (validTypes.indexOf(schema4.type) === -1) {
        throw new SyntaxError(`Validation failed. ${schemaId} has an invalid type (${schema4.type})`);
      }
      if (schema4.type === "array" && !schema4.items) {
        throw new SyntaxError(`Validation failed. ${schemaId} is an array, so it must include an "items" schema`);
      }
    }
    function validateRequiredPropertiesExist(schema4, schemaId) {
      function collectProperties(schemaObj, props) {
        if (schemaObj.properties) {
          for (let property in schemaObj.properties) {
            if (schemaObj.properties.hasOwnProperty(property)) {
              props[property] = schemaObj.properties[property];
            }
          }
        }
        if (schemaObj.allOf) {
          for (let parent of schemaObj.allOf) {
            collectProperties(parent, props);
          }
        }
      }
      if (Array.isArray(schema4.type) && !schema4.type.includes("object")) {
        return;
      } else if (!Array.isArray(schema4.type) && schema4.type !== "object") {
        return;
      }
      if (schema4.required && Array.isArray(schema4.required)) {
        let props = {};
        collectProperties(schema4, props);
        for (let requiredProperty of schema4.required) {
          if (!props[requiredProperty]) {
            throw new SyntaxError(
              `Validation failed. Property '${requiredProperty}' listed as required but does not exist in '${schemaId}'`
            );
          }
        }
      }
    }
  }
});

// node-modules-polyfills:path
function unimplemented2(name) {
  throw new Error("Node.js process " + name + " is not supported by JSPM core outside of Node.js");
}
function cleanUpNextTick2() {
  if (!draining2 || !currentQueue2)
    return;
  draining2 = false;
  if (currentQueue2.length) {
    queue2 = currentQueue2.concat(queue2);
  } else {
    queueIndex2 = -1;
  }
  if (queue2.length)
    drainQueue2();
}
function drainQueue2() {
  if (draining2)
    return;
  var timeout = setTimeout(cleanUpNextTick2, 0);
  draining2 = true;
  var len = queue2.length;
  while (len) {
    currentQueue2 = queue2;
    queue2 = [];
    while (++queueIndex2 < len) {
      if (currentQueue2)
        currentQueue2[queueIndex2].run();
    }
    queueIndex2 = -1;
    len = queue2.length;
  }
  currentQueue2 = null;
  draining2 = false;
  clearTimeout(timeout);
}
function nextTick2(fun) {
  var args = new Array(arguments.length - 1);
  if (arguments.length > 1) {
    for (var i = 1; i < arguments.length; i++)
      args[i - 1] = arguments[i];
  }
  queue2.push(new Item2(fun, args));
  if (queue2.length === 1 && !draining2)
    setTimeout(drainQueue2, 0);
}
function Item2(fun, array) {
  this.fun = fun;
  this.array = array;
}
function noop2() {
}
function _linkedBinding2(name) {
  unimplemented2("_linkedBinding");
}
function dlopen2(name) {
  unimplemented2("dlopen");
}
function _getActiveRequests2() {
  return [];
}
function _getActiveHandles2() {
  return [];
}
function assert2(condition, message) {
  if (!condition) throw new Error(message || "assertion error");
}
function hasUncaughtExceptionCaptureCallback2() {
  return false;
}
function uptime2() {
  return _performance2.now() / 1e3;
}
function hrtime2(previousTimestamp) {
  var baseNow = Math.floor((Date.now() - _performance2.now()) * 1e-3);
  var clocktime = _performance2.now() * 1e-3;
  var seconds = Math.floor(clocktime) + baseNow;
  var nanoseconds = Math.floor(clocktime % 1 * 1e9);
  if (previousTimestamp) {
    seconds = seconds - previousTimestamp[0];
    nanoseconds = nanoseconds - previousTimestamp[1];
    if (nanoseconds < 0) {
      seconds--;
      nanoseconds += nanoPerSec2;
    }
  }
  return [seconds, nanoseconds];
}
function on2() {
  return process3;
}
function listeners2(name) {
  return [];
}
function dew4() {
  if (_dewExec4) return exports$13;
  _dewExec4 = true;
  var process$1 = process3;
  function assertPath(path) {
    if (typeof path !== "string") {
      throw new TypeError("Path must be a string. Received " + JSON.stringify(path));
    }
  }
  function normalizeStringPosix(path, allowAboveRoot) {
    var res = "";
    var lastSegmentLength = 0;
    var lastSlash = -1;
    var dots = 0;
    var code2;
    for (var i = 0; i <= path.length; ++i) {
      if (i < path.length) code2 = path.charCodeAt(i);
      else if (code2 === 47) break;
      else code2 = 47;
      if (code2 === 47) {
        if (lastSlash === i - 1 || dots === 1) ;
        else if (lastSlash !== i - 1 && dots === 2) {
          if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
            if (res.length > 2) {
              var lastSlashIndex = res.lastIndexOf("/");
              if (lastSlashIndex !== res.length - 1) {
                if (lastSlashIndex === -1) {
                  res = "";
                  lastSegmentLength = 0;
                } else {
                  res = res.slice(0, lastSlashIndex);
                  lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
                }
                lastSlash = i;
                dots = 0;
                continue;
              }
            } else if (res.length === 2 || res.length === 1) {
              res = "";
              lastSegmentLength = 0;
              lastSlash = i;
              dots = 0;
              continue;
            }
          }
          if (allowAboveRoot) {
            if (res.length > 0) res += "/..";
            else res = "..";
            lastSegmentLength = 2;
          }
        } else {
          if (res.length > 0) res += "/" + path.slice(lastSlash + 1, i);
          else res = path.slice(lastSlash + 1, i);
          lastSegmentLength = i - lastSlash - 1;
        }
        lastSlash = i;
        dots = 0;
      } else if (code2 === 46 && dots !== -1) {
        ++dots;
      } else {
        dots = -1;
      }
    }
    return res;
  }
  function _format(sep2, pathObject) {
    var dir = pathObject.dir || pathObject.root;
    var base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
    if (!dir) {
      return base;
    }
    if (dir === pathObject.root) {
      return dir + base;
    }
    return dir + sep2 + base;
  }
  var posix2 = {
    // path.resolve([from ...], to)
    resolve: function resolve2() {
      var resolvedPath = "";
      var resolvedAbsolute = false;
      var cwd22;
      for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
        var path;
        if (i >= 0) path = arguments[i];
        else {
          if (cwd22 === void 0) cwd22 = process$1.cwd();
          path = cwd22;
        }
        assertPath(path);
        if (path.length === 0) {
          continue;
        }
        resolvedPath = path + "/" + resolvedPath;
        resolvedAbsolute = path.charCodeAt(0) === 47;
      }
      resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
      if (resolvedAbsolute) {
        if (resolvedPath.length > 0) return "/" + resolvedPath;
        else return "/";
      } else if (resolvedPath.length > 0) {
        return resolvedPath;
      } else {
        return ".";
      }
    },
    normalize: function normalize2(path) {
      assertPath(path);
      if (path.length === 0) return ".";
      var isAbsolute2 = path.charCodeAt(0) === 47;
      var trailingSeparator = path.charCodeAt(path.length - 1) === 47;
      path = normalizeStringPosix(path, !isAbsolute2);
      if (path.length === 0 && !isAbsolute2) path = ".";
      if (path.length > 0 && trailingSeparator) path += "/";
      if (isAbsolute2) return "/" + path;
      return path;
    },
    isAbsolute: function isAbsolute2(path) {
      assertPath(path);
      return path.length > 0 && path.charCodeAt(0) === 47;
    },
    join: function join2() {
      if (arguments.length === 0) return ".";
      var joined;
      for (var i = 0; i < arguments.length; ++i) {
        var arg = arguments[i];
        assertPath(arg);
        if (arg.length > 0) {
          if (joined === void 0) joined = arg;
          else joined += "/" + arg;
        }
      }
      if (joined === void 0) return ".";
      return posix2.normalize(joined);
    },
    relative: function relative2(from, to) {
      assertPath(from);
      assertPath(to);
      if (from === to) return "";
      from = posix2.resolve(from);
      to = posix2.resolve(to);
      if (from === to) return "";
      var fromStart = 1;
      for (; fromStart < from.length; ++fromStart) {
        if (from.charCodeAt(fromStart) !== 47) break;
      }
      var fromEnd = from.length;
      var fromLen = fromEnd - fromStart;
      var toStart = 1;
      for (; toStart < to.length; ++toStart) {
        if (to.charCodeAt(toStart) !== 47) break;
      }
      var toEnd = to.length;
      var toLen = toEnd - toStart;
      var length = fromLen < toLen ? fromLen : toLen;
      var lastCommonSep = -1;
      var i = 0;
      for (; i <= length; ++i) {
        if (i === length) {
          if (toLen > length) {
            if (to.charCodeAt(toStart + i) === 47) {
              return to.slice(toStart + i + 1);
            } else if (i === 0) {
              return to.slice(toStart + i);
            }
          } else if (fromLen > length) {
            if (from.charCodeAt(fromStart + i) === 47) {
              lastCommonSep = i;
            } else if (i === 0) {
              lastCommonSep = 0;
            }
          }
          break;
        }
        var fromCode = from.charCodeAt(fromStart + i);
        var toCode = to.charCodeAt(toStart + i);
        if (fromCode !== toCode) break;
        else if (fromCode === 47) lastCommonSep = i;
      }
      var out = "";
      for (i = fromStart + lastCommonSep + 1; i <= fromEnd; ++i) {
        if (i === fromEnd || from.charCodeAt(i) === 47) {
          if (out.length === 0) out += "..";
          else out += "/..";
        }
      }
      if (out.length > 0) return out + to.slice(toStart + lastCommonSep);
      else {
        toStart += lastCommonSep;
        if (to.charCodeAt(toStart) === 47) ++toStart;
        return to.slice(toStart);
      }
    },
    _makeLong: function _makeLong2(path) {
      return path;
    },
    dirname: function dirname2(path) {
      assertPath(path);
      if (path.length === 0) return ".";
      var code2 = path.charCodeAt(0);
      var hasRoot = code2 === 47;
      var end = -1;
      var matchedSlash = true;
      for (var i = path.length - 1; i >= 1; --i) {
        code2 = path.charCodeAt(i);
        if (code2 === 47) {
          if (!matchedSlash) {
            end = i;
            break;
          }
        } else {
          matchedSlash = false;
        }
      }
      if (end === -1) return hasRoot ? "/" : ".";
      if (hasRoot && end === 1) return "//";
      return path.slice(0, end);
    },
    basename: function basename2(path, ext) {
      if (ext !== void 0 && typeof ext !== "string") throw new TypeError('"ext" argument must be a string');
      assertPath(path);
      var start = 0;
      var end = -1;
      var matchedSlash = true;
      var i;
      if (ext !== void 0 && ext.length > 0 && ext.length <= path.length) {
        if (ext.length === path.length && ext === path) return "";
        var extIdx = ext.length - 1;
        var firstNonSlashEnd = -1;
        for (i = path.length - 1; i >= 0; --i) {
          var code2 = path.charCodeAt(i);
          if (code2 === 47) {
            if (!matchedSlash) {
              start = i + 1;
              break;
            }
          } else {
            if (firstNonSlashEnd === -1) {
              matchedSlash = false;
              firstNonSlashEnd = i + 1;
            }
            if (extIdx >= 0) {
              if (code2 === ext.charCodeAt(extIdx)) {
                if (--extIdx === -1) {
                  end = i;
                }
              } else {
                extIdx = -1;
                end = firstNonSlashEnd;
              }
            }
          }
        }
        if (start === end) end = firstNonSlashEnd;
        else if (end === -1) end = path.length;
        return path.slice(start, end);
      } else {
        for (i = path.length - 1; i >= 0; --i) {
          if (path.charCodeAt(i) === 47) {
            if (!matchedSlash) {
              start = i + 1;
              break;
            }
          } else if (end === -1) {
            matchedSlash = false;
            end = i + 1;
          }
        }
        if (end === -1) return "";
        return path.slice(start, end);
      }
    },
    extname: function extname2(path) {
      assertPath(path);
      var startDot = -1;
      var startPart = 0;
      var end = -1;
      var matchedSlash = true;
      var preDotState = 0;
      for (var i = path.length - 1; i >= 0; --i) {
        var code2 = path.charCodeAt(i);
        if (code2 === 47) {
          if (!matchedSlash) {
            startPart = i + 1;
            break;
          }
          continue;
        }
        if (end === -1) {
          matchedSlash = false;
          end = i + 1;
        }
        if (code2 === 46) {
          if (startDot === -1) startDot = i;
          else if (preDotState !== 1) preDotState = 1;
        } else if (startDot !== -1) {
          preDotState = -1;
        }
      }
      if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
      preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
      preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
        return "";
      }
      return path.slice(startDot, end);
    },
    format: function format22(pathObject) {
      if (pathObject === null || typeof pathObject !== "object") {
        throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
      }
      return _format("/", pathObject);
    },
    parse: function parse22(path) {
      assertPath(path);
      var ret = {
        root: "",
        dir: "",
        base: "",
        ext: "",
        name: ""
      };
      if (path.length === 0) return ret;
      var code2 = path.charCodeAt(0);
      var isAbsolute2 = code2 === 47;
      var start;
      if (isAbsolute2) {
        ret.root = "/";
        start = 1;
      } else {
        start = 0;
      }
      var startDot = -1;
      var startPart = 0;
      var end = -1;
      var matchedSlash = true;
      var i = path.length - 1;
      var preDotState = 0;
      for (; i >= start; --i) {
        code2 = path.charCodeAt(i);
        if (code2 === 47) {
          if (!matchedSlash) {
            startPart = i + 1;
            break;
          }
          continue;
        }
        if (end === -1) {
          matchedSlash = false;
          end = i + 1;
        }
        if (code2 === 46) {
          if (startDot === -1) startDot = i;
          else if (preDotState !== 1) preDotState = 1;
        } else if (startDot !== -1) {
          preDotState = -1;
        }
      }
      if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
      preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
      preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
        if (end !== -1) {
          if (startPart === 0 && isAbsolute2) ret.base = ret.name = path.slice(1, end);
          else ret.base = ret.name = path.slice(startPart, end);
        }
      } else {
        if (startPart === 0 && isAbsolute2) {
          ret.name = path.slice(1, startDot);
          ret.base = path.slice(1, end);
        } else {
          ret.name = path.slice(startPart, startDot);
          ret.base = path.slice(startPart, end);
        }
        ret.ext = path.slice(startDot, end);
      }
      if (startPart > 0) ret.dir = path.slice(0, startPart - 1);
      else if (isAbsolute2) ret.dir = "/";
      return ret;
    },
    sep: "/",
    delimiter: ":",
    win32: null,
    posix: null
  };
  posix2.posix = posix2;
  exports$13 = posix2;
  return exports$13;
}
var queue2, draining2, currentQueue2, queueIndex2, title2, arch2, platform2, env2, argv2, execArgv2, version2, versions2, emitWarning2, binding2, umask2, cwd2, chdir2, release2, _rawDebug2, moduleLoadList2, domain2, _exiting2, config2, reallyExit2, _kill2, cpuUsage2, resourceUsage2, memoryUsage2, kill2, exit2, openStdin2, allowedNodeEnvironmentFlags2, features2, _fatalExceptions2, setUncaughtExceptionCaptureCallback2, _tickCallback2, _debugProcess2, _debugEnd2, _startProfilerIdleNotifier2, _stopProfilerIdleNotifier2, stdout2, stderr2, stdin2, abort2, pid2, ppid2, execPath2, debugPort2, argv02, _preload_modules2, setSourceMapsEnabled2, _performance2, nowOffset2, nanoPerSec2, _maxListeners2, _events2, _eventsCount2, addListener2, once2, off2, removeListener2, removeAllListeners2, emit2, prependListener2, prependOnceListener2, process3, exports$13, _dewExec4, exports4, _makeLong, basename, delimiter, dirname, extname, format2, isAbsolute, join, normalize, parse, posix, relative, resolve, sep, win32;
var init_path = __esm({
  "node-modules-polyfills:path"() {
    queue2 = [];
    draining2 = false;
    queueIndex2 = -1;
    Item2.prototype.run = function() {
      this.fun.apply(null, this.array);
    };
    title2 = "browser";
    arch2 = "x64";
    platform2 = "browser";
    env2 = {
      PATH: "/usr/bin",
      LANG: navigator.language + ".UTF-8",
      PWD: "/",
      HOME: "/home",
      TMP: "/tmp"
    };
    argv2 = ["/usr/bin/node"];
    execArgv2 = [];
    version2 = "v16.8.0";
    versions2 = {};
    emitWarning2 = function(message, type) {
      console.warn((type ? type + ": " : "") + message);
    };
    binding2 = function(name) {
      unimplemented2("binding");
    };
    umask2 = function(mask) {
      return 0;
    };
    cwd2 = function() {
      return "/";
    };
    chdir2 = function(dir) {
    };
    release2 = {
      name: "node",
      sourceUrl: "",
      headersUrl: "",
      libUrl: ""
    };
    _rawDebug2 = noop2;
    moduleLoadList2 = [];
    domain2 = {};
    _exiting2 = false;
    config2 = {};
    reallyExit2 = noop2;
    _kill2 = noop2;
    cpuUsage2 = function() {
      return {};
    };
    resourceUsage2 = cpuUsage2;
    memoryUsage2 = cpuUsage2;
    kill2 = noop2;
    exit2 = noop2;
    openStdin2 = noop2;
    allowedNodeEnvironmentFlags2 = {};
    features2 = {
      inspector: false,
      debug: false,
      uv: false,
      ipv6: false,
      tls_alpn: false,
      tls_sni: false,
      tls_ocsp: false,
      tls: false,
      cached_builtins: true
    };
    _fatalExceptions2 = noop2;
    setUncaughtExceptionCaptureCallback2 = noop2;
    _tickCallback2 = noop2;
    _debugProcess2 = noop2;
    _debugEnd2 = noop2;
    _startProfilerIdleNotifier2 = noop2;
    _stopProfilerIdleNotifier2 = noop2;
    stdout2 = void 0;
    stderr2 = void 0;
    stdin2 = void 0;
    abort2 = noop2;
    pid2 = 2;
    ppid2 = 1;
    execPath2 = "/bin/usr/node";
    debugPort2 = 9229;
    argv02 = "node";
    _preload_modules2 = [];
    setSourceMapsEnabled2 = noop2;
    _performance2 = {
      now: typeof performance !== "undefined" ? performance.now.bind(performance) : void 0,
      timing: typeof performance !== "undefined" ? performance.timing : void 0
    };
    if (_performance2.now === void 0) {
      nowOffset2 = Date.now();
      if (_performance2.timing && _performance2.timing.navigationStart) {
        nowOffset2 = _performance2.timing.navigationStart;
      }
      _performance2.now = () => Date.now() - nowOffset2;
    }
    nanoPerSec2 = 1e9;
    hrtime2.bigint = function(time) {
      var diff = hrtime2(time);
      if (typeof BigInt === "undefined") {
        return diff[0] * nanoPerSec2 + diff[1];
      }
      return BigInt(diff[0] * nanoPerSec2) + BigInt(diff[1]);
    };
    _maxListeners2 = 10;
    _events2 = {};
    _eventsCount2 = 0;
    addListener2 = on2;
    once2 = on2;
    off2 = on2;
    removeListener2 = on2;
    removeAllListeners2 = on2;
    emit2 = noop2;
    prependListener2 = on2;
    prependOnceListener2 = on2;
    process3 = {
      version: version2,
      versions: versions2,
      arch: arch2,
      platform: platform2,
      release: release2,
      _rawDebug: _rawDebug2,
      moduleLoadList: moduleLoadList2,
      binding: binding2,
      _linkedBinding: _linkedBinding2,
      _events: _events2,
      _eventsCount: _eventsCount2,
      _maxListeners: _maxListeners2,
      on: on2,
      addListener: addListener2,
      once: once2,
      off: off2,
      removeListener: removeListener2,
      removeAllListeners: removeAllListeners2,
      emit: emit2,
      prependListener: prependListener2,
      prependOnceListener: prependOnceListener2,
      listeners: listeners2,
      domain: domain2,
      _exiting: _exiting2,
      config: config2,
      dlopen: dlopen2,
      uptime: uptime2,
      _getActiveRequests: _getActiveRequests2,
      _getActiveHandles: _getActiveHandles2,
      reallyExit: reallyExit2,
      _kill: _kill2,
      cpuUsage: cpuUsage2,
      resourceUsage: resourceUsage2,
      memoryUsage: memoryUsage2,
      kill: kill2,
      exit: exit2,
      openStdin: openStdin2,
      allowedNodeEnvironmentFlags: allowedNodeEnvironmentFlags2,
      assert: assert2,
      features: features2,
      _fatalExceptions: _fatalExceptions2,
      setUncaughtExceptionCaptureCallback: setUncaughtExceptionCaptureCallback2,
      hasUncaughtExceptionCaptureCallback: hasUncaughtExceptionCaptureCallback2,
      emitWarning: emitWarning2,
      nextTick: nextTick2,
      _tickCallback: _tickCallback2,
      _debugProcess: _debugProcess2,
      _debugEnd: _debugEnd2,
      _startProfilerIdleNotifier: _startProfilerIdleNotifier2,
      _stopProfilerIdleNotifier: _stopProfilerIdleNotifier2,
      stdout: stdout2,
      stdin: stdin2,
      stderr: stderr2,
      abort: abort2,
      umask: umask2,
      chdir: chdir2,
      cwd: cwd2,
      env: env2,
      title: title2,
      argv: argv2,
      execArgv: execArgv2,
      pid: pid2,
      ppid: ppid2,
      execPath: execPath2,
      debugPort: debugPort2,
      hrtime: hrtime2,
      argv0: argv02,
      _preload_modules: _preload_modules2,
      setSourceMapsEnabled: setSourceMapsEnabled2
    };
    exports$13 = {};
    _dewExec4 = false;
    exports4 = dew4();
    _makeLong = exports4._makeLong;
    basename = exports4.basename;
    delimiter = exports4.delimiter;
    dirname = exports4.dirname;
    extname = exports4.extname;
    format2 = exports4.format;
    isAbsolute = exports4.isAbsolute;
    join = exports4.join;
    normalize = exports4.normalize;
    parse = exports4.parse;
    posix = exports4.posix;
    relative = exports4.relative;
    resolve = exports4.resolve;
    sep = exports4.sep;
    win32 = exports4.win32;
  }
});

// node-modules-polyfills-commonjs:path
var path_exports = {};
__export(path_exports, {
  _makeLong: () => _makeLong,
  basename: () => basename,
  delimiter: () => delimiter,
  dirname: () => dirname,
  extname: () => extname,
  format: () => format2,
  isAbsolute: () => isAbsolute,
  join: () => join,
  normalize: () => normalize,
  parse: () => parse,
  posix: () => posix,
  relative: () => relative,
  resolve: () => resolve,
  sep: () => sep,
  win32: () => win32
});
var init_path2 = __esm({
  "node-modules-polyfills-commonjs:path"() {
    init_path();
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js
var require_convert_path_to_posix = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/convert-path-to-posix.js"(exports5) {
    "use strict";
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.default = convertPathToPosix;
    var path_1 = __importDefault((init_path2(), __toCommonJS(path_exports)));
    function convertPathToPosix(filePath) {
      const isExtendedLengthPath = filePath.startsWith("\\\\?\\");
      if (isExtendedLengthPath) {
        return filePath;
      }
      return filePath.split(path_1.default?.win32?.sep).join(path_1.default?.posix?.sep ?? "/");
    }
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js
var require_is_windows = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/is-windows.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.isWindows = void 0;
    var isWindowsConst = /^win/.test(globalThis.process ? globalThis.process.platform : "");
    var isWindows = () => isWindowsConst;
    exports5.isWindows = isWindows;
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js
var require_url = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/url.js"(exports5) {
    "use strict";
    var __createBinding = exports5 && exports5.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports5 && exports5.__importStar || /* @__PURE__ */ (function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    })();
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.parse = void 0;
    exports5.resolve = resolve2;
    exports5.cwd = cwd3;
    exports5.getProtocol = getProtocol;
    exports5.getExtension = getExtension;
    exports5.stripQuery = stripQuery;
    exports5.getHash = getHash;
    exports5.stripHash = stripHash;
    exports5.isHttp = isHttp;
    exports5.isUnsafeUrl = isUnsafeUrl;
    exports5.isFileSystemPath = isFileSystemPath;
    exports5.fromFileSystemPath = fromFileSystemPath;
    exports5.toFileSystemPath = toFileSystemPath;
    exports5.safePointerToPath = safePointerToPath;
    exports5.relative = relative2;
    var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
    var path_1 = __importStar((init_path2(), __toCommonJS(path_exports)));
    var forwardSlashPattern = /\//g;
    var protocolPattern = /^(\w{2,}):\/\//i;
    var jsonPointerSlash = /~1/g;
    var jsonPointerTilde = /~0/g;
    var path_2 = (init_path2(), __toCommonJS(path_exports));
    var is_windows_1 = require_is_windows();
    var urlEncodePatterns = [
      [/\?/g, "%3F"],
      [/#/g, "%23"]
    ];
    var urlDecodePatterns = [/%23/g, "#", /%24/g, "$", /%26/g, "&", /%2C/g, ",", /%40/g, "@"];
    var parse3 = (u) => new URL(u);
    exports5.parse = parse3;
    function resolve2(from, to) {
      const fromUrl = new URL((0, convert_path_to_posix_1.default)(from), "https://aaa.nonexistanturl.com");
      const resolvedUrl = new URL((0, convert_path_to_posix_1.default)(to), fromUrl);
      const endSpaces = to.match(/(\s*)$/)?.[1] || "";
      if (resolvedUrl.hostname === "aaa.nonexistanturl.com") {
        const { pathname, search, hash } = resolvedUrl;
        return pathname + search + hash + endSpaces;
      }
      return resolvedUrl.toString() + endSpaces;
    }
    function cwd3() {
      if (typeof window !== "undefined" && window.location && window.location.href) {
        const href = window.location.href;
        if (!href || !href.startsWith("http")) {
          try {
            new URL(href);
            return href;
          } catch {
            return "/";
          }
        }
        return href;
      }
      if (typeof process !== "undefined" && process.cwd) {
        const path = process.cwd();
        const lastChar = path.slice(-1);
        if (lastChar === "/" || lastChar === "\\") {
          return path;
        } else {
          return path + "/";
        }
      }
      return "/";
    }
    function getProtocol(path) {
      const match = protocolPattern.exec(path || "");
      if (match) {
        return match[1].toLowerCase();
      }
      return void 0;
    }
    function getExtension(path) {
      const lastDot = path.lastIndexOf(".");
      if (lastDot >= 0) {
        return stripQuery(path.substr(lastDot).toLowerCase());
      }
      return "";
    }
    function stripQuery(path) {
      const queryIndex = path.indexOf("?");
      if (queryIndex >= 0) {
        path = path.substr(0, queryIndex);
      }
      return path;
    }
    function getHash(path) {
      if (!path) {
        return "#";
      }
      const hashIndex = path.indexOf("#");
      if (hashIndex >= 0) {
        return path.substring(hashIndex);
      }
      return "#";
    }
    function stripHash(path) {
      if (!path) {
        return "";
      }
      const hashIndex = path.indexOf("#");
      if (hashIndex >= 0) {
        path = path.substring(0, hashIndex);
      }
      return path;
    }
    function isHttp(path) {
      const protocol = getProtocol(path);
      if (protocol === "http" || protocol === "https") {
        return true;
      } else if (protocol === void 0) {
        return typeof window !== "undefined";
      } else {
        return false;
      }
    }
    function isUnsafeUrl(path) {
      if (!path || typeof path !== "string") {
        return true;
      }
      const normalizedPath = path.trim().toLowerCase();
      if (!normalizedPath) {
        return true;
      }
      if (normalizedPath.startsWith("javascript:") || normalizedPath.startsWith("vbscript:") || normalizedPath.startsWith("data:")) {
        return true;
      }
      if (normalizedPath.startsWith("file:")) {
        return true;
      }
      if (typeof window !== "undefined" && window.location && window.location.href) {
        return false;
      }
      const localPatterns = [
        // Localhost variations
        "localhost",
        "127.0.0.1",
        "::1",
        // Private IP ranges (RFC 1918)
        "10.",
        "172.16.",
        "172.17.",
        "172.18.",
        "172.19.",
        "172.20.",
        "172.21.",
        "172.22.",
        "172.23.",
        "172.24.",
        "172.25.",
        "172.26.",
        "172.27.",
        "172.28.",
        "172.29.",
        "172.30.",
        "172.31.",
        "192.168.",
        // Link-local addresses
        "169.254.",
        // Internal domains
        ".local",
        ".internal",
        ".intranet",
        ".corp",
        ".home",
        ".lan"
      ];
      try {
        const url = new URL(normalizedPath.startsWith("//") ? "http:" + normalizedPath : normalizedPath);
        const hostname = url.hostname.toLowerCase();
        for (const pattern of localPatterns) {
          if (hostname === pattern || hostname.startsWith(pattern) || hostname.endsWith(pattern)) {
            return true;
          }
        }
        if (isPrivateIP(hostname)) {
          return true;
        }
        const port = url.port;
        if (port && isInternalPort(parseInt(port))) {
          return true;
        }
      } catch (e) {
        if (normalizedPath.startsWith("/") && !normalizedPath.startsWith("//")) {
          return false;
        }
        for (const pattern of localPatterns) {
          if (normalizedPath.includes(pattern)) {
            return true;
          }
        }
      }
      return false;
    }
    function isPrivateIP(ip) {
      const ipRegex = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;
      const match = ip.match(ipRegex);
      if (!match) {
        return false;
      }
      const [, a, b, c, d] = match.map(Number);
      if (a > 255 || b > 255 || c > 255 || d > 255) {
        return false;
      }
      return a === 10 || a === 127 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168 || a === 169 && b === 254;
    }
    function isInternalPort(port) {
      const internalPorts = [
        22,
        // SSH
        23,
        // Telnet
        25,
        // SMTP
        53,
        // DNS
        135,
        // RPC
        139,
        // NetBIOS
        445,
        // SMB
        993,
        // IMAPS
        995,
        // POP3S
        1433,
        // SQL Server
        1521,
        // Oracle
        3306,
        // MySQL
        3389,
        // RDP
        5432,
        // PostgreSQL
        5900,
        // VNC
        6379,
        // Redis
        8080,
        // Common internal web
        8443,
        // Common internal HTTPS
        9200,
        // Elasticsearch
        27017
        // MongoDB
      ];
      return internalPorts.includes(port);
    }
    function isFileSystemPath(path) {
      if (typeof window !== "undefined" || typeof process !== "undefined" && process.browser) {
        return false;
      }
      const protocol = getProtocol(path);
      return protocol === void 0 || protocol === "file";
    }
    function fromFileSystemPath(path) {
      if ((0, is_windows_1.isWindows)()) {
        const projectDir = cwd3();
        const upperPath = path.toUpperCase();
        const projectDirPosixPath = (0, convert_path_to_posix_1.default)(projectDir);
        const posixUpper = projectDirPosixPath.toUpperCase();
        const hasProjectDir = upperPath.includes(posixUpper);
        const hasProjectUri = upperPath.includes(posixUpper);
        const isAbsolutePath = path_1.win32?.isAbsolute(path) || path.startsWith("http://") || path.startsWith("https://") || path.startsWith("file://");
        if (!(hasProjectDir || hasProjectUri || isAbsolutePath) && !projectDir.startsWith("http")) {
          path = (0, path_2.join)(projectDir, path);
        }
        path = (0, convert_path_to_posix_1.default)(path);
      }
      path = encodeURI(path);
      for (const pattern of urlEncodePatterns) {
        path = path.replace(pattern[0], pattern[1]);
      }
      return path;
    }
    function toFileSystemPath(path, keepFileProtocol) {
      path = decodeURI(path);
      for (let i = 0; i < urlDecodePatterns.length; i += 2) {
        path = path.replace(urlDecodePatterns[i], urlDecodePatterns[i + 1]);
      }
      let isFileUrl = path.substr(0, 7).toLowerCase() === "file://";
      if (isFileUrl) {
        path = path[7] === "/" ? path.substr(8) : path.substr(7);
        if ((0, is_windows_1.isWindows)() && path[1] === "/") {
          path = path[0] + ":" + path.substr(1);
        }
        if (keepFileProtocol) {
          path = "file:///" + path;
        } else {
          isFileUrl = false;
          path = (0, is_windows_1.isWindows)() ? path : "/" + path;
        }
      }
      if ((0, is_windows_1.isWindows)() && !isFileUrl) {
        path = path.replace(forwardSlashPattern, "\\");
        if (path.substr(1, 2) === ":\\") {
          path = path[0].toUpperCase() + path.substr(1);
        }
      }
      return path;
    }
    function safePointerToPath(pointer) {
      if (pointer.length <= 1 || pointer[0] !== "#" || pointer[1] !== "/") {
        return [];
      }
      return pointer.slice(2).split("/").map((value) => {
        return decodeURIComponent(value).replace(jsonPointerSlash, "/").replace(jsonPointerTilde, "~");
      });
    }
    function relative2(from, to) {
      if (!isFileSystemPath(from) || !isFileSystemPath(to)) {
        return resolve2(from, to);
      }
      const fromDir = path_1.default.dirname(stripHash(from));
      const toPath = stripHash(to);
      const result = path_1.default.relative(fromDir, toPath);
      return result + getHash(to);
    }
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.js
var require_errors2 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/errors.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.InvalidPointerError = exports5.TimeoutError = exports5.MissingPointerError = exports5.UnmatchedResolverError = exports5.ResolverError = exports5.UnmatchedParserError = exports5.ParserError = exports5.JSONParserErrorGroup = exports5.JSONParserError = void 0;
    exports5.toJSON = toJSON;
    exports5.getDeepKeys = getDeepKeys;
    exports5.isHandledError = isHandledError;
    exports5.normalizeError = normalizeError;
    var url_js_1 = require_url();
    var nonJsonTypes = ["function", "symbol", "undefined"];
    var protectedProps = ["constructor", "prototype", "__proto__"];
    var objectPrototype = Object.getPrototypeOf({});
    function toJSON() {
      const pojo = {};
      const error = this;
      for (const key of getDeepKeys(error)) {
        if (typeof key === "string") {
          const value = error[key];
          const type = typeof value;
          if (!nonJsonTypes.includes(type)) {
            pojo[key] = value;
          }
        }
      }
      return pojo;
    }
    function getDeepKeys(obj, omit = []) {
      let keys = [];
      while (obj && obj !== objectPrototype) {
        keys = keys.concat(Object.getOwnPropertyNames(obj), Object.getOwnPropertySymbols(obj));
        obj = Object.getPrototypeOf(obj);
      }
      const uniqueKeys = new Set(keys);
      for (const key of omit.concat(protectedProps)) {
        uniqueKeys.delete(key);
      }
      return uniqueKeys;
    }
    var JSONParserError = class extends Error {
      constructor(message, source) {
        super();
        this.toJSON = toJSON.bind(this);
        this.code = "EUNKNOWN";
        this.name = "JSONParserError";
        this.message = message;
        this.source = source;
        this.path = null;
      }
      get footprint() {
        return `${this.path}+${this.source}+${this.code}+${this.message}`;
      }
    };
    exports5.JSONParserError = JSONParserError;
    var JSONParserErrorGroup = class _JSONParserErrorGroup extends Error {
      constructor(parser) {
        super();
        this.toJSON = toJSON.bind(this);
        this.files = parser;
        this.name = "JSONParserErrorGroup";
        this.message = `${this.errors.length} error${this.errors.length > 1 ? "s" : ""} occurred while reading '${(0, url_js_1.toFileSystemPath)(parser.$refs._root$Ref.path)}'`;
      }
      static getParserErrors(parser) {
        const errors = [];
        for (const $ref of Object.values(parser.$refs._$refs)) {
          if ($ref.errors) {
            errors.push(...$ref.errors);
          }
        }
        return errors;
      }
      get errors() {
        return _JSONParserErrorGroup.getParserErrors(this.files);
      }
    };
    exports5.JSONParserErrorGroup = JSONParserErrorGroup;
    var ParserError = class extends JSONParserError {
      constructor(message, source) {
        super(`Error parsing ${source}: ${message}`, source);
        this.code = "EPARSER";
        this.name = "ParserError";
      }
    };
    exports5.ParserError = ParserError;
    var UnmatchedParserError = class extends JSONParserError {
      constructor(source) {
        super(`Could not find parser for "${source}"`, source);
        this.code = "EUNMATCHEDPARSER";
        this.name = "UnmatchedParserError";
      }
    };
    exports5.UnmatchedParserError = UnmatchedParserError;
    var ResolverError = class extends JSONParserError {
      constructor(ex, source) {
        super(ex.message || `Error reading file "${source}"`, source);
        this.code = "ERESOLVER";
        this.name = "ResolverError";
        if ("code" in ex) {
          this.ioErrorCode = String(ex.code);
        }
      }
    };
    exports5.ResolverError = ResolverError;
    var UnmatchedResolverError = class extends JSONParserError {
      constructor(source) {
        super(`Could not find resolver for "${source}"`, source);
        this.code = "EUNMATCHEDRESOLVER";
        this.name = "UnmatchedResolverError";
      }
    };
    exports5.UnmatchedResolverError = UnmatchedResolverError;
    var MissingPointerError = class extends JSONParserError {
      constructor(token, path, targetRef, targetFound, parentPath) {
        super(`Missing $ref pointer "${(0, url_js_1.getHash)(path)}". Token "${token}" does not exist.`, (0, url_js_1.stripHash)(path));
        this.code = "EMISSINGPOINTER";
        this.name = "MissingPointerError";
        this.targetToken = token;
        this.targetRef = targetRef;
        this.targetFound = targetFound;
        this.parentPath = parentPath;
      }
    };
    exports5.MissingPointerError = MissingPointerError;
    var TimeoutError = class extends JSONParserError {
      constructor(timeout) {
        super(`Dereferencing timeout reached: ${timeout}ms`);
        this.code = "ETIMEOUT";
        this.name = "TimeoutError";
      }
    };
    exports5.TimeoutError = TimeoutError;
    var InvalidPointerError = class extends JSONParserError {
      constructor(pointer, path) {
        super(`Invalid $ref pointer "${pointer}". Pointers must begin with "#/"`, (0, url_js_1.stripHash)(path));
        this.code = "EUNMATCHEDRESOLVER";
        this.name = "InvalidPointerError";
      }
    };
    exports5.InvalidPointerError = InvalidPointerError;
    function isHandledError(err) {
      return err instanceof JSONParserError || err instanceof JSONParserErrorGroup;
    }
    function normalizeError(err) {
      if (err.path === null) {
        err.path = [];
      }
      return err;
    }
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.js
var require_pointer = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/pointer.js"(exports5) {
    "use strict";
    var __createBinding = exports5 && exports5.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports5 && exports5.__importStar || /* @__PURE__ */ (function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    })();
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.nullSymbol = void 0;
    var ref_js_1 = __importDefault(require_ref2());
    var url = __importStar(require_url());
    var errors_js_1 = require_errors2();
    exports5.nullSymbol = Symbol("null");
    var slashes = /\//g;
    var tildes = /~/g;
    var escapedSlash = /~1/g;
    var escapedTilde = /~0/g;
    var safeDecodeURIComponent = (encodedURIComponent) => {
      try {
        return decodeURIComponent(encodedURIComponent);
      } catch {
        return encodedURIComponent;
      }
    };
    var Pointer = class _Pointer {
      constructor($ref, path, friendlyPath) {
        this.$ref = $ref;
        this.path = path;
        this.originalPath = friendlyPath || path;
        this.value = void 0;
        this.circular = false;
        this.indirections = 0;
      }
      /**
       * Resolves the value of a nested property within the given object.
       *
       * @param obj - The object that will be crawled
       * @param options
       * @param pathFromRoot - the path of place that initiated resolving
       *
       * @returns
       * Returns a JSON pointer whose {@link Pointer#value} is the resolved value.
       * If resolving this value required resolving other JSON references, then
       * the {@link Pointer#$ref} and {@link Pointer#path} will reflect the resolution path
       * of the resolved value.
       */
      resolve(obj, options, pathFromRoot) {
        const tokens = _Pointer.parse(this.path, this.originalPath);
        const found = [];
        this.value = unwrapOrThrow(obj);
        for (let i = 0; i < tokens.length; i++) {
          if (resolveIf$Ref(this, options, pathFromRoot)) {
            this.path = _Pointer.join(this.path, tokens.slice(i));
          }
          const token = tokens[i];
          if (this.value[token] === void 0 || this.value[token] === null && i === tokens.length - 1) {
            let didFindSubstringSlashMatch = false;
            for (let j = tokens.length - 1; j > i; j--) {
              const joinedToken = tokens.slice(i, j + 1).join("/");
              if (this.value[joinedToken] !== void 0) {
                this.value = this.value[joinedToken];
                i = j;
                didFindSubstringSlashMatch = true;
                break;
              }
            }
            if (didFindSubstringSlashMatch) {
              continue;
            }
            if (token in this.value && this.value[token] === null) {
              this.value = exports5.nullSymbol;
              continue;
            }
            this.value = null;
            const path = this.$ref.path || "";
            const targetRef = this.path.replace(path, "");
            const targetFound = _Pointer.join("", found);
            const parentPath = pathFromRoot?.replace(path, "");
            throw new errors_js_1.MissingPointerError(token, decodeURI(this.originalPath), targetRef, targetFound, parentPath);
          } else {
            this.value = this.value[token];
          }
          found.push(token);
        }
        if (!this.value || this.value.$ref && url.resolve(this.path, this.value.$ref) !== pathFromRoot) {
          resolveIf$Ref(this, options, pathFromRoot);
        }
        return this;
      }
      /**
       * Sets the value of a nested property within the given object.
       *
       * @param obj - The object that will be crawled
       * @param value - the value to assign
       * @param options
       *
       * @returns
       * Returns the modified object, or an entirely new object if the entire object is overwritten.
       */
      set(obj, value, options) {
        const tokens = _Pointer.parse(this.path);
        let token;
        if (tokens.length === 0) {
          this.value = value;
          return value;
        }
        this.value = unwrapOrThrow(obj);
        for (let i = 0; i < tokens.length - 1; i++) {
          resolveIf$Ref(this, options);
          token = tokens[i];
          if (this.value && this.value[token] !== void 0) {
            this.value = this.value[token];
          } else {
            this.value = setValue(this, token, {});
          }
        }
        resolveIf$Ref(this, options);
        token = tokens[tokens.length - 1];
        setValue(this, token, value);
        return obj;
      }
      /**
       * Parses a JSON pointer (or a path containing a JSON pointer in the hash)
       * and returns an array of the pointer's tokens.
       * (e.g. "schema.json#/definitions/person/name" => ["definitions", "person", "name"])
       *
       * The pointer is parsed according to RFC 6901
       * {@link https://tools.ietf.org/html/rfc6901#section-3}
       *
       * @param path
       * @param [originalPath]
       * @returns
       */
      static parse(path, originalPath) {
        const pointer = url.getHash(path).substring(1);
        if (!pointer) {
          return [];
        }
        const split = pointer.split("/");
        for (let i = 0; i < split.length; i++) {
          split[i] = safeDecodeURIComponent(split[i].replace(escapedSlash, "/").replace(escapedTilde, "~"));
        }
        if (split[0] !== "") {
          throw new errors_js_1.InvalidPointerError(pointer, originalPath === void 0 ? path : originalPath);
        }
        return split.slice(1);
      }
      /**
       * Creates a JSON pointer path, by joining one or more tokens to a base path.
       *
       * @param base - The base path (e.g. "schema.json#/definitions/person")
       * @param tokens - The token(s) to append (e.g. ["name", "first"])
       * @returns
       */
      static join(base, tokens) {
        if (base.indexOf("#") === -1) {
          base += "#";
        }
        tokens = Array.isArray(tokens) ? tokens : [tokens];
        for (let i = 0; i < tokens.length; i++) {
          const token = tokens[i];
          base += "/" + encodeURIComponent(token.replace(tildes, "~0").replace(slashes, "~1"));
        }
        return base;
      }
    };
    function resolveIf$Ref(pointer, options, pathFromRoot) {
      if (ref_js_1.default.isAllowed$Ref(pointer.value, options)) {
        const $refPath = url.resolve(pointer.path, pointer.value.$ref);
        if ($refPath === pointer.path && !isRootPath(pathFromRoot)) {
          pointer.circular = true;
        } else {
          const resolved = pointer.$ref.$refs._resolve($refPath, pointer.path, options);
          if (resolved === null) {
            return false;
          }
          pointer.indirections += resolved.indirections + 1;
          if (ref_js_1.default.isExtended$Ref(pointer.value)) {
            pointer.value = ref_js_1.default.dereference(pointer.value, resolved.value);
            return false;
          } else {
            pointer.$ref = resolved.$ref;
            pointer.path = resolved.path;
            pointer.value = resolved.value;
          }
          return true;
        }
      }
      return void 0;
    }
    exports5.default = Pointer;
    function setValue(pointer, token, value) {
      if (pointer.value && typeof pointer.value === "object") {
        if (token === "-" && Array.isArray(pointer.value)) {
          pointer.value.push(value);
        } else {
          pointer.value[token] = value;
        }
      } else {
        throw new errors_js_1.JSONParserError(`Error assigning $ref pointer "${pointer.path}". 
Cannot set "${token}" of a non-object.`);
      }
      return value;
    }
    function unwrapOrThrow(value) {
      if ((0, errors_js_1.isHandledError)(value)) {
        throw value;
      }
      return value;
    }
    function isRootPath(pathFromRoot) {
      return typeof pathFromRoot == "string" && Pointer.parse(pathFromRoot).length == 0;
    }
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.js
var require_ref2 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/ref.js"(exports5) {
    "use strict";
    var __createBinding = exports5 && exports5.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports5 && exports5.__importStar || /* @__PURE__ */ (function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    })();
    Object.defineProperty(exports5, "__esModule", { value: true });
    var pointer_js_1 = __importStar(require_pointer());
    var errors_js_1 = require_errors2();
    var url_js_1 = require_url();
    var $Ref = class _$Ref {
      constructor($refs) {
        this.errors = [];
        this.$refs = $refs;
      }
      /**
       * Pushes an error to errors array.
       *
       * @param err - The error to be pushed
       * @returns
       */
      addError(err) {
        if (this.errors === void 0) {
          this.errors = [];
        }
        const existingErrors = this.errors.map(({ footprint }) => footprint);
        if ("errors" in err && Array.isArray(err.errors)) {
          this.errors.push(...err.errors.map(errors_js_1.normalizeError).filter(({ footprint }) => !existingErrors.includes(footprint)));
        } else if (!("footprint" in err) || !existingErrors.includes(err.footprint)) {
          this.errors.push((0, errors_js_1.normalizeError)(err));
        }
      }
      /**
       * Determines whether the given JSON reference exists within this {@link $Ref#value}.
       *
       * @param path - The full path being resolved, optionally with a JSON pointer in the hash
       * @param options
       * @returns
       */
      exists(path, options) {
        try {
          this.resolve(path, options);
          return true;
        } catch {
          return false;
        }
      }
      /**
       * Resolves the given JSON reference within this {@link $Ref#value} and returns the resolved value.
       *
       * @param path - The full path being resolved, optionally with a JSON pointer in the hash
       * @param options
       * @returns - Returns the resolved value
       */
      get(path, options) {
        return this.resolve(path, options)?.value;
      }
      /**
       * Resolves the given JSON reference within this {@link $Ref#value}.
       *
       * @param path - The full path being resolved, optionally with a JSON pointer in the hash
       * @param options
       * @param friendlyPath - The original user-specified path (used for error messages)
       * @param pathFromRoot - The path of `obj` from the schema root
       * @returns
       */
      resolve(path, options, friendlyPath, pathFromRoot) {
        const pointer = new pointer_js_1.default(this, path, friendlyPath);
        try {
          const resolved = pointer.resolve(this.value, options, pathFromRoot);
          if (resolved.value === pointer_js_1.nullSymbol) {
            resolved.value = null;
          }
          return resolved;
        } catch (err) {
          if (!options || !options.continueOnError || !(0, errors_js_1.isHandledError)(err)) {
            throw err;
          }
          if (err.path === null) {
            err.path = (0, url_js_1.safePointerToPath)((0, url_js_1.getHash)(pathFromRoot));
          }
          if (err instanceof errors_js_1.InvalidPointerError) {
            err.source = decodeURI((0, url_js_1.stripHash)(pathFromRoot));
          }
          this.addError(err);
          return null;
        }
      }
      /**
       * Sets the value of a nested property within this {@link $Ref#value}.
       * If the property, or any of its parents don't exist, they will be created.
       *
       * @param path - The full path of the property to set, optionally with a JSON pointer in the hash
       * @param value - The value to assign
       */
      set(path, value) {
        const pointer = new pointer_js_1.default(this, path);
        this.value = pointer.set(this.value, value);
        if (this.value === pointer_js_1.nullSymbol) {
          this.value = null;
        }
      }
      /**
       * Determines whether the given value is a JSON reference.
       *
       * @param value - The value to inspect
       * @returns
       */
      static is$Ref(value) {
        return Boolean(value) && typeof value === "object" && value !== null && "$ref" in value && typeof value.$ref === "string" && value.$ref.length > 0;
      }
      /**
       * Determines whether the given value is an external JSON reference.
       *
       * @param value - The value to inspect
       * @returns
       */
      static isExternal$Ref(value) {
        return _$Ref.is$Ref(value) && value.$ref[0] !== "#";
      }
      /**
       * Determines whether the given value is a JSON reference, and whether it is allowed by the options.
       * For example, if it references an external file, then options.resolve.external must be true.
       *
       * @param value - The value to inspect
       * @param options
       * @returns
       */
      static isAllowed$Ref(value, options) {
        if (this.is$Ref(value)) {
          if (value.$ref.substring(0, 2) === "#/" || value.$ref === "#") {
            return true;
          } else if (value.$ref[0] !== "#" && (!options || options.resolve?.external)) {
            return true;
          }
        }
        return void 0;
      }
      /**
       * Determines whether the given value is a JSON reference that "extends" its resolved value.
       * That is, it has extra properties (in addition to "$ref"), so rather than simply pointing to
       * an existing value, this $ref actually creates a NEW value that is a shallow copy of the resolved
       * value, plus the extra properties.
       *
       * @example: {
         person: {
           properties: {
             firstName: { type: string }
             lastName: { type: string }
           }
         }
         employee: {
           properties: {
             $ref: #/person/properties
             salary: { type: number }
           }
         }
       }
       *  In this example, "employee" is an extended $ref, since it extends "person" with an additional
       *  property (salary).  The result is a NEW value that looks like this:
       *
       *  {
       *    properties: {
       *      firstName: { type: string }
       *      lastName: { type: string }
       *      salary: { type: number }
       *    }
       *  }
       *
       * @param value - The value to inspect
       * @returns
       */
      static isExtended$Ref(value) {
        return _$Ref.is$Ref(value) && Object.keys(value).length > 1;
      }
      /**
       * Returns the resolved value of a JSON Reference.
       * If necessary, the resolved value is merged with the JSON Reference to create a new object
       *
       * @example: {
      person: {
        properties: {
          firstName: { type: string }
          lastName: { type: string }
        }
      }
      employee: {
        properties: {
          $ref: #/person/properties
          salary: { type: number }
        }
      }
      } When "person" and "employee" are merged, you end up with the following object:
       *
       *  {
       *    properties: {
       *      firstName: { type: string }
       *      lastName: { type: string }
       *      salary: { type: number }
       *    }
       *  }
       *
       * @param $ref - The JSON reference object (the one with the "$ref" property)
       * @param resolvedValue - The resolved value, which can be any type
       * @returns - Returns the dereferenced value
       */
      static dereference($ref, resolvedValue) {
        if (resolvedValue && typeof resolvedValue === "object" && _$Ref.isExtended$Ref($ref)) {
          const merged = {};
          for (const key of Object.keys($ref)) {
            if (key !== "$ref") {
              merged[key] = $ref[key];
            }
          }
          for (const key of Object.keys(resolvedValue)) {
            if (!(key in merged)) {
              merged[key] = resolvedValue[key];
            }
          }
          return merged;
        } else {
          return resolvedValue;
        }
      }
    };
    exports5.default = $Ref;
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.js
var require_refs = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/refs.js"(exports5) {
    "use strict";
    var __createBinding = exports5 && exports5.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports5 && exports5.__importStar || /* @__PURE__ */ (function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    })();
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    var ref_js_1 = __importDefault(require_ref2());
    var url = __importStar(require_url());
    var convert_path_to_posix_1 = __importDefault(require_convert_path_to_posix());
    var $Refs = class {
      /**
       * Returns the paths/URLs of all the files in your schema (including the main schema file).
       *
       * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#pathstypes
       *
       * @param types (optional) Optionally only return certain types of paths ("file", "http", etc.)
       */
      paths(...types2) {
        const paths = getPaths(this._$refs, types2.flat());
        return paths.map((path) => {
          return (0, convert_path_to_posix_1.default)(path.decoded);
        });
      }
      /**
       * Returns a map of paths/URLs and their correspond values.
       *
       * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#valuestypes
       *
       * @param types (optional) Optionally only return values from certain locations ("file", "http", etc.)
       */
      values(...types2) {
        const $refs = this._$refs;
        const paths = getPaths($refs, types2.flat());
        return paths.reduce((obj, path) => {
          obj[(0, convert_path_to_posix_1.default)(path.decoded)] = $refs[path.encoded].value;
          return obj;
        }, {});
      }
      /**
       * Returns `true` if the given path exists in the schema; otherwise, returns `false`
       *
       * See https://apidevtools.com/json-schema-ref-parser/docs/refs.html#existsref
       *
       * @param $ref The JSON Reference path, optionally with a JSON Pointer in the hash
       */
      /**
       * Determines whether the given JSON reference exists.
       *
       * @param path - The path being resolved, optionally with a JSON pointer in the hash
       * @param [options]
       * @returns
       */
      exists(path, options) {
        try {
          this._resolve(path, "", options);
          return true;
        } catch {
          return false;
        }
      }
      /**
       * Resolves the given JSON reference and returns the resolved value.
       *
       * @param path - The path being resolved, with a JSON pointer in the hash
       * @param [options]
       * @returns - Returns the resolved value
       */
      get(path, options) {
        return this._resolve(path, "", options).value;
      }
      /**
       * Sets the value at the given path in the schema. If the property, or any of its parents, don't exist, they will be created.
       *
       * @param path The JSON Reference path, optionally with a JSON Pointer in the hash
       * @param value The value to assign. Can be anything (object, string, number, etc.)
       */
      set(path, value) {
        const absPath = url.resolve(this._root$Ref.path, path);
        const withoutHash = url.stripHash(absPath);
        const $ref = this._$refs[withoutHash];
        if (!$ref) {
          throw new Error(`Error resolving $ref pointer "${path}". 
"${withoutHash}" not found.`);
        }
        $ref.set(absPath, value);
      }
      /**
       * Returns the specified {@link $Ref} object, or undefined.
       *
       * @param path - The path being resolved, optionally with a JSON pointer in the hash
       * @returns
       * @protected
       */
      _get$Ref(path) {
        path = url.resolve(this._root$Ref.path, path);
        const withoutHash = url.stripHash(path);
        return this._$refs[withoutHash];
      }
      /**
       * Creates a new {@link $Ref} object and adds it to this {@link $Refs} object.
       *
       * @param path  - The file path or URL of the referenced file
       */
      _add(path) {
        const withoutHash = url.stripHash(path);
        const $ref = new ref_js_1.default(this);
        $ref.path = withoutHash;
        this._$refs[withoutHash] = $ref;
        this._root$Ref = this._root$Ref || $ref;
        return $ref;
      }
      /**
       * Resolves the given JSON reference.
       *
       * @param path - The path being resolved, optionally with a JSON pointer in the hash
       * @param pathFromRoot - The path of `obj` from the schema root
       * @param [options]
       * @returns
       * @protected
       */
      _resolve(path, pathFromRoot, options) {
        const absPath = url.resolve(this._root$Ref.path, path);
        const withoutHash = url.stripHash(absPath);
        const $ref = this._$refs[withoutHash];
        if (!$ref) {
          throw new Error(`Error resolving $ref pointer "${path}". 
"${withoutHash}" not found.`);
        }
        return $ref.resolve(absPath, options, path, pathFromRoot);
      }
      constructor() {
        this._$refs = {};
        this.toJSON = this.values;
        this.circular = false;
        this._$refs = {};
        this._root$Ref = null;
      }
    };
    exports5.default = $Refs;
    function getPaths($refs, types2) {
      let paths = Object.keys($refs);
      types2 = Array.isArray(types2[0]) ? types2[0] : Array.prototype.slice.call(types2);
      if (types2.length > 0 && types2[0]) {
        paths = paths.filter((key) => {
          return types2.includes($refs[key].pathType);
        });
      }
      return paths.map((path) => {
        return {
          encoded: path,
          decoded: $refs[path].pathType === "file" ? url.toFileSystemPath(path, true) : path
        };
      });
    }
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/plugins.js
var require_plugins = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/plugins.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.all = all;
    exports5.filter = filter;
    exports5.sort = sort;
    exports5.run = run;
    function all(plugins) {
      return Object.keys(plugins || {}).filter((key) => {
        return typeof plugins[key] === "object";
      }).map((key) => {
        plugins[key].name = key;
        return plugins[key];
      });
    }
    function filter(plugins, method, file) {
      return plugins.filter((plugin) => {
        return !!getResult(plugin, method, file);
      });
    }
    function sort(plugins) {
      for (const plugin of plugins) {
        plugin.order = plugin.order || Number.MAX_SAFE_INTEGER;
      }
      return plugins.sort((a, b) => {
        return a.order - b.order;
      });
    }
    async function run(plugins, method, file, $refs) {
      let plugin;
      let lastError;
      let index = 0;
      return new Promise((resolve2, reject) => {
        runNextPlugin();
        function runNextPlugin() {
          plugin = plugins[index++];
          if (!plugin) {
            return reject(lastError);
          }
          try {
            const result = getResult(plugin, method, file, callback, $refs);
            if (result && typeof result.then === "function") {
              result.then(onSuccess, onError);
            } else if (result !== void 0) {
              onSuccess(result);
            } else if (index === plugins.length) {
              throw new Error("No promise has been returned or callback has been called.");
            }
          } catch (e) {
            onError(e);
          }
        }
        function callback(err, result) {
          if (err) {
            onError(err);
          } else {
            onSuccess(result);
          }
        }
        function onSuccess(result) {
          resolve2({
            plugin,
            result
          });
        }
        function onError(error) {
          lastError = {
            plugin,
            error
          };
          runNextPlugin();
        }
      });
    }
    function getResult(obj, prop, file, callback, $refs) {
      const value = obj[prop];
      if (typeof value === "function") {
        return value.apply(obj, [file, callback, $refs]);
      }
      if (!callback) {
        if (value instanceof RegExp) {
          return value.test(file.url);
        } else if (typeof value === "string") {
          return value === file.extension;
        } else if (Array.isArray(value)) {
          return value.indexOf(file.extension) !== -1;
        }
      }
      return value;
    }
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parse.js
var require_parse = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parse.js"(exports5) {
    "use strict";
    var __createBinding = exports5 && exports5.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports5 && exports5.__importStar || /* @__PURE__ */ (function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    })();
    Object.defineProperty(exports5, "__esModule", { value: true });
    var url = __importStar(require_url());
    var plugins = __importStar(require_plugins());
    var errors_js_1 = require_errors2();
    async function parse3(path, $refs, options) {
      const hashIndex = path.indexOf("#");
      let hash = "";
      if (hashIndex >= 0) {
        hash = path.substring(hashIndex);
        path = path.substring(0, hashIndex);
      }
      const $ref = $refs._add(path);
      const file = {
        url: path,
        hash,
        extension: url.getExtension(path)
      };
      try {
        const resolver = await readFile(file, options, $refs);
        $ref.pathType = resolver.plugin.name;
        file.data = resolver.result;
        const parser = await parseFile(file, options, $refs);
        $ref.value = parser.result;
        return parser.result;
      } catch (err) {
        if ((0, errors_js_1.isHandledError)(err)) {
          $ref.value = err;
        }
        throw err;
      }
    }
    async function readFile(file, options, $refs) {
      let resolvers = plugins.all(options.resolve);
      resolvers = plugins.filter(resolvers, "canRead", file);
      plugins.sort(resolvers);
      try {
        const data = await plugins.run(resolvers, "read", file, $refs);
        return data;
      } catch (err) {
        if (!err && options.continueOnError) {
          throw new errors_js_1.UnmatchedResolverError(file.url);
        } else if (!err || !("error" in err)) {
          throw new SyntaxError(`Unable to resolve $ref pointer "${file.url}"`);
        } else if (err.error instanceof errors_js_1.ResolverError) {
          throw err.error;
        } else {
          throw new errors_js_1.ResolverError(err, file.url);
        }
      }
    }
    async function parseFile(file, options, $refs) {
      const allParsers = plugins.all(options.parse);
      const filteredParsers = plugins.filter(allParsers, "canParse", file);
      const parsers = filteredParsers.length > 0 ? filteredParsers : allParsers;
      plugins.sort(parsers);
      try {
        const parser = await plugins.run(parsers, "parse", file, $refs);
        if (!parser.plugin.allowEmpty && isEmpty(parser.result)) {
          throw new SyntaxError(`Error parsing "${file.url}" as ${parser.plugin.name}. 
Parsed value is empty`);
        } else {
          return parser;
        }
      } catch (err) {
        if (!err && options.continueOnError) {
          throw new errors_js_1.UnmatchedParserError(file.url);
        } else if (err && err.message && err.message.startsWith("Error parsing")) {
          throw err;
        } else if (!err || !("error" in err)) {
          throw new SyntaxError(`Unable to parse ${file.url}`);
        } else if (err.error instanceof errors_js_1.ParserError) {
          throw err.error;
        } else {
          throw new errors_js_1.ParserError(err.error.message, file.url);
        }
      }
    }
    function isEmpty(value) {
      return value === void 0 || typeof value === "object" && Object.keys(value).length === 0 || typeof value === "string" && value.trim().length === 0 || Buffer.isBuffer(value) && value.length === 0;
    }
    exports5.default = parse3;
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/json.js
var require_json = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/json.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var errors_js_1 = require_errors2();
    exports5.default = {
      /**
       * The order that this parser will run, in relation to other parsers.
       */
      order: 100,
      /**
       * Whether to allow "empty" files. This includes zero-byte files, as well as empty JSON objects.
       */
      allowEmpty: true,
      /**
       * Determines whether this parser can parse a given file reference.
       * Parsers that match will be tried, in order, until one successfully parses the file.
       * Parsers that don't match will be skipped, UNLESS none of the parsers match, in which case
       * every parser will be tried.
       */
      canParse: ".json",
      /**
       * Allow JSON files with byte order marks (BOM)
       */
      allowBOM: true,
      /**
       * Parses the given file as JSON
       */
      async parse(file) {
        let data = file.data;
        if (Buffer.isBuffer(data)) {
          data = data.toString();
        }
        if (typeof data === "string") {
          if (data.trim().length === 0) {
            return;
          } else {
            try {
              return JSON.parse(data);
            } catch (e) {
              if (this.allowBOM) {
                try {
                  const firstCurlyBrace = data.indexOf("{");
                  data = data.slice(firstCurlyBrace);
                  return JSON.parse(data);
                } catch (e2) {
                  throw new errors_js_1.ParserError(e2.message, file.url);
                }
              }
              throw new errors_js_1.ParserError(e.message, file.url);
            }
          }
        } else {
          return data;
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/common.js
var require_common = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/common.js"(exports5, module) {
    "use strict";
    function isNothing(subject) {
      return typeof subject === "undefined" || subject === null;
    }
    function isObject2(subject) {
      return typeof subject === "object" && subject !== null;
    }
    function toArray(sequence) {
      if (Array.isArray(sequence)) return sequence;
      else if (isNothing(sequence)) return [];
      return [sequence];
    }
    function extend(target, source) {
      var index, length, key, sourceKeys;
      if (source) {
        sourceKeys = Object.keys(source);
        for (index = 0, length = sourceKeys.length; index < length; index += 1) {
          key = sourceKeys[index];
          target[key] = source[key];
        }
      }
      return target;
    }
    function repeat(string2, count) {
      var result = "", cycle;
      for (cycle = 0; cycle < count; cycle += 1) {
        result += string2;
      }
      return result;
    }
    function isNegativeZero(number) {
      return number === 0 && Number.NEGATIVE_INFINITY === 1 / number;
    }
    module.exports.isNothing = isNothing;
    module.exports.isObject = isObject2;
    module.exports.toArray = toArray;
    module.exports.repeat = repeat;
    module.exports.isNegativeZero = isNegativeZero;
    module.exports.extend = extend;
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/exception.js
var require_exception = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/exception.js"(exports5, module) {
    "use strict";
    function formatError(exception, compact) {
      var where = "", message = exception.reason || "(unknown reason)";
      if (!exception.mark) return message;
      if (exception.mark.name) {
        where += 'in "' + exception.mark.name + '" ';
      }
      where += "(" + (exception.mark.line + 1) + ":" + (exception.mark.column + 1) + ")";
      if (!compact && exception.mark.snippet) {
        where += "\n\n" + exception.mark.snippet;
      }
      return message + " " + where;
    }
    function YAMLException(reason, mark) {
      Error.call(this);
      this.name = "YAMLException";
      this.reason = reason;
      this.mark = mark;
      this.message = formatError(this, false);
      if (Error.captureStackTrace) {
        Error.captureStackTrace(this, this.constructor);
      } else {
        this.stack = new Error().stack || "";
      }
    }
    YAMLException.prototype = Object.create(Error.prototype);
    YAMLException.prototype.constructor = YAMLException;
    YAMLException.prototype.toString = function toString(compact) {
      return this.name + ": " + formatError(this, compact);
    };
    module.exports = YAMLException;
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/snippet.js
var require_snippet = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/snippet.js"(exports5, module) {
    "use strict";
    var common = require_common();
    function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
      var head = "";
      var tail = "";
      var maxHalfLength = Math.floor(maxLineLength / 2) - 1;
      if (position - lineStart > maxHalfLength) {
        head = " ... ";
        lineStart = position - maxHalfLength + head.length;
      }
      if (lineEnd - position > maxHalfLength) {
        tail = " ...";
        lineEnd = position + maxHalfLength - tail.length;
      }
      return {
        str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
        pos: position - lineStart + head.length
        // relative position
      };
    }
    function padStart(string2, max) {
      return common.repeat(" ", max - string2.length) + string2;
    }
    function makeSnippet(mark, options) {
      options = Object.create(options || null);
      if (!mark.buffer) return null;
      if (!options.maxLength) options.maxLength = 79;
      if (typeof options.indent !== "number") options.indent = 1;
      if (typeof options.linesBefore !== "number") options.linesBefore = 3;
      if (typeof options.linesAfter !== "number") options.linesAfter = 2;
      var re = /\r?\n|\r|\0/g;
      var lineStarts = [0];
      var lineEnds = [];
      var match;
      var foundLineNo = -1;
      while (match = re.exec(mark.buffer)) {
        lineEnds.push(match.index);
        lineStarts.push(match.index + match[0].length);
        if (mark.position <= match.index && foundLineNo < 0) {
          foundLineNo = lineStarts.length - 2;
        }
      }
      if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
      var result = "", i, line;
      var lineNoLength = Math.min(mark.line + options.linesAfter, lineEnds.length).toString().length;
      var maxLineLength = options.maxLength - (options.indent + lineNoLength + 3);
      for (i = 1; i <= options.linesBefore; i++) {
        if (foundLineNo - i < 0) break;
        line = getLine(
          mark.buffer,
          lineStarts[foundLineNo - i],
          lineEnds[foundLineNo - i],
          mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]),
          maxLineLength
        );
        result = common.repeat(" ", options.indent) + padStart((mark.line - i + 1).toString(), lineNoLength) + " | " + line.str + "\n" + result;
      }
      line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
      result += common.repeat(" ", options.indent) + padStart((mark.line + 1).toString(), lineNoLength) + " | " + line.str + "\n";
      result += common.repeat("-", options.indent + lineNoLength + 3 + line.pos) + "^\n";
      for (i = 1; i <= options.linesAfter; i++) {
        if (foundLineNo + i >= lineEnds.length) break;
        line = getLine(
          mark.buffer,
          lineStarts[foundLineNo + i],
          lineEnds[foundLineNo + i],
          mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]),
          maxLineLength
        );
        result += common.repeat(" ", options.indent) + padStart((mark.line + i + 1).toString(), lineNoLength) + " | " + line.str + "\n";
      }
      return result.replace(/\n$/, "");
    }
    module.exports = makeSnippet;
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type.js
var require_type = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type.js"(exports5, module) {
    "use strict";
    var YAMLException = require_exception();
    var TYPE_CONSTRUCTOR_OPTIONS = [
      "kind",
      "multi",
      "resolve",
      "construct",
      "instanceOf",
      "predicate",
      "represent",
      "representName",
      "defaultStyle",
      "styleAliases"
    ];
    var YAML_NODE_KINDS = [
      "scalar",
      "sequence",
      "mapping"
    ];
    function compileStyleAliases(map2) {
      var result = {};
      if (map2 !== null) {
        Object.keys(map2).forEach(function(style) {
          map2[style].forEach(function(alias) {
            result[String(alias)] = style;
          });
        });
      }
      return result;
    }
    function Type(tag, options) {
      options = options || {};
      Object.keys(options).forEach(function(name) {
        if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
          throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
        }
      });
      this.options = options;
      this.tag = tag;
      this.kind = options["kind"] || null;
      this.resolve = options["resolve"] || function() {
        return true;
      };
      this.construct = options["construct"] || function(data) {
        return data;
      };
      this.instanceOf = options["instanceOf"] || null;
      this.predicate = options["predicate"] || null;
      this.represent = options["represent"] || null;
      this.representName = options["representName"] || null;
      this.defaultStyle = options["defaultStyle"] || null;
      this.multi = options["multi"] || false;
      this.styleAliases = compileStyleAliases(options["styleAliases"] || null);
      if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
        throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
      }
    }
    module.exports = Type;
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/schema.js
var require_schema6 = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/schema.js"(exports5, module) {
    "use strict";
    var YAMLException = require_exception();
    var Type = require_type();
    function compileList(schema4, name) {
      var result = [];
      schema4[name].forEach(function(currentType) {
        var newIndex = result.length;
        result.forEach(function(previousType, previousIndex) {
          if (previousType.tag === currentType.tag && previousType.kind === currentType.kind && previousType.multi === currentType.multi) {
            newIndex = previousIndex;
          }
        });
        result[newIndex] = currentType;
      });
      return result;
    }
    function compileMap() {
      var result = {
        scalar: {},
        sequence: {},
        mapping: {},
        fallback: {},
        multi: {
          scalar: [],
          sequence: [],
          mapping: [],
          fallback: []
        }
      }, index, length;
      function collectType(type) {
        if (type.multi) {
          result.multi[type.kind].push(type);
          result.multi["fallback"].push(type);
        } else {
          result[type.kind][type.tag] = result["fallback"][type.tag] = type;
        }
      }
      for (index = 0, length = arguments.length; index < length; index += 1) {
        arguments[index].forEach(collectType);
      }
      return result;
    }
    function Schema2(definition) {
      return this.extend(definition);
    }
    Schema2.prototype.extend = function extend(definition) {
      var implicit = [];
      var explicit = [];
      if (definition instanceof Type) {
        explicit.push(definition);
      } else if (Array.isArray(definition)) {
        explicit = explicit.concat(definition);
      } else if (definition && (Array.isArray(definition.implicit) || Array.isArray(definition.explicit))) {
        if (definition.implicit) implicit = implicit.concat(definition.implicit);
        if (definition.explicit) explicit = explicit.concat(definition.explicit);
      } else {
        throw new YAMLException("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");
      }
      implicit.forEach(function(type) {
        if (!(type instanceof Type)) {
          throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
        }
        if (type.loadKind && type.loadKind !== "scalar") {
          throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
        }
        if (type.multi) {
          throw new YAMLException("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.");
        }
      });
      explicit.forEach(function(type) {
        if (!(type instanceof Type)) {
          throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
        }
      });
      var result = Object.create(Schema2.prototype);
      result.implicit = (this.implicit || []).concat(implicit);
      result.explicit = (this.explicit || []).concat(explicit);
      result.compiledImplicit = compileList(result, "implicit");
      result.compiledExplicit = compileList(result, "explicit");
      result.compiledTypeMap = compileMap(result.compiledImplicit, result.compiledExplicit);
      return result;
    };
    module.exports = Schema2;
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/str.js
var require_str = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/str.js"(exports5, module) {
    "use strict";
    var Type = require_type();
    module.exports = new Type("tag:yaml.org,2002:str", {
      kind: "scalar",
      construct: function(data) {
        return data !== null ? data : "";
      }
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/seq.js
var require_seq = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/seq.js"(exports5, module) {
    "use strict";
    var Type = require_type();
    module.exports = new Type("tag:yaml.org,2002:seq", {
      kind: "sequence",
      construct: function(data) {
        return data !== null ? data : [];
      }
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/map.js
var require_map = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/map.js"(exports5, module) {
    "use strict";
    var Type = require_type();
    module.exports = new Type("tag:yaml.org,2002:map", {
      kind: "mapping",
      construct: function(data) {
        return data !== null ? data : {};
      }
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/schema/failsafe.js
var require_failsafe = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/schema/failsafe.js"(exports5, module) {
    "use strict";
    var Schema2 = require_schema6();
    module.exports = new Schema2({
      explicit: [
        require_str(),
        require_seq(),
        require_map()
      ]
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/null.js
var require_null = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/null.js"(exports5, module) {
    "use strict";
    var Type = require_type();
    function resolveYamlNull(data) {
      if (data === null) return true;
      var max = data.length;
      return max === 1 && data === "~" || max === 4 && (data === "null" || data === "Null" || data === "NULL");
    }
    function constructYamlNull() {
      return null;
    }
    function isNull2(object) {
      return object === null;
    }
    module.exports = new Type("tag:yaml.org,2002:null", {
      kind: "scalar",
      resolve: resolveYamlNull,
      construct: constructYamlNull,
      predicate: isNull2,
      represent: {
        canonical: function() {
          return "~";
        },
        lowercase: function() {
          return "null";
        },
        uppercase: function() {
          return "NULL";
        },
        camelcase: function() {
          return "Null";
        },
        empty: function() {
          return "";
        }
      },
      defaultStyle: "lowercase"
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/bool.js
var require_bool = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/bool.js"(exports5, module) {
    "use strict";
    var Type = require_type();
    function resolveYamlBoolean(data) {
      if (data === null) return false;
      var max = data.length;
      return max === 4 && (data === "true" || data === "True" || data === "TRUE") || max === 5 && (data === "false" || data === "False" || data === "FALSE");
    }
    function constructYamlBoolean(data) {
      return data === "true" || data === "True" || data === "TRUE";
    }
    function isBoolean2(object) {
      return Object.prototype.toString.call(object) === "[object Boolean]";
    }
    module.exports = new Type("tag:yaml.org,2002:bool", {
      kind: "scalar",
      resolve: resolveYamlBoolean,
      construct: constructYamlBoolean,
      predicate: isBoolean2,
      represent: {
        lowercase: function(object) {
          return object ? "true" : "false";
        },
        uppercase: function(object) {
          return object ? "TRUE" : "FALSE";
        },
        camelcase: function(object) {
          return object ? "True" : "False";
        }
      },
      defaultStyle: "lowercase"
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/int.js
var require_int = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/int.js"(exports5, module) {
    "use strict";
    var common = require_common();
    var Type = require_type();
    function isHexCode(c) {
      return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
    }
    function isOctCode(c) {
      return 48 <= c && c <= 55;
    }
    function isDecCode(c) {
      return 48 <= c && c <= 57;
    }
    function resolveYamlInteger(data) {
      if (data === null) return false;
      var max = data.length, index = 0, hasDigits = false, ch;
      if (!max) return false;
      ch = data[index];
      if (ch === "-" || ch === "+") {
        ch = data[++index];
      }
      if (ch === "0") {
        if (index + 1 === max) return true;
        ch = data[++index];
        if (ch === "b") {
          index++;
          for (; index < max; index++) {
            ch = data[index];
            if (ch === "_") continue;
            if (ch !== "0" && ch !== "1") return false;
            hasDigits = true;
          }
          return hasDigits && ch !== "_";
        }
        if (ch === "x") {
          index++;
          for (; index < max; index++) {
            ch = data[index];
            if (ch === "_") continue;
            if (!isHexCode(data.charCodeAt(index))) return false;
            hasDigits = true;
          }
          return hasDigits && ch !== "_";
        }
        if (ch === "o") {
          index++;
          for (; index < max; index++) {
            ch = data[index];
            if (ch === "_") continue;
            if (!isOctCode(data.charCodeAt(index))) return false;
            hasDigits = true;
          }
          return hasDigits && ch !== "_";
        }
      }
      if (ch === "_") return false;
      for (; index < max; index++) {
        ch = data[index];
        if (ch === "_") continue;
        if (!isDecCode(data.charCodeAt(index))) {
          return false;
        }
        hasDigits = true;
      }
      if (!hasDigits || ch === "_") return false;
      return true;
    }
    function constructYamlInteger(data) {
      var value = data, sign = 1, ch;
      if (value.indexOf("_") !== -1) {
        value = value.replace(/_/g, "");
      }
      ch = value[0];
      if (ch === "-" || ch === "+") {
        if (ch === "-") sign = -1;
        value = value.slice(1);
        ch = value[0];
      }
      if (value === "0") return 0;
      if (ch === "0") {
        if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
        if (value[1] === "x") return sign * parseInt(value.slice(2), 16);
        if (value[1] === "o") return sign * parseInt(value.slice(2), 8);
      }
      return sign * parseInt(value, 10);
    }
    function isInteger(object) {
      return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
    }
    module.exports = new Type("tag:yaml.org,2002:int", {
      kind: "scalar",
      resolve: resolveYamlInteger,
      construct: constructYamlInteger,
      predicate: isInteger,
      represent: {
        binary: function(obj) {
          return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
        },
        octal: function(obj) {
          return obj >= 0 ? "0o" + obj.toString(8) : "-0o" + obj.toString(8).slice(1);
        },
        decimal: function(obj) {
          return obj.toString(10);
        },
        /* eslint-disable max-len */
        hexadecimal: function(obj) {
          return obj >= 0 ? "0x" + obj.toString(16).toUpperCase() : "-0x" + obj.toString(16).toUpperCase().slice(1);
        }
      },
      defaultStyle: "decimal",
      styleAliases: {
        binary: [2, "bin"],
        octal: [8, "oct"],
        decimal: [10, "dec"],
        hexadecimal: [16, "hex"]
      }
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/float.js
var require_float = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/float.js"(exports5, module) {
    "use strict";
    var common = require_common();
    var Type = require_type();
    var YAML_FLOAT_PATTERN = new RegExp(
      // 2.5e4, 2.5 and integers
      "^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
    );
    function resolveYamlFloat(data) {
      if (data === null) return false;
      if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
      // Probably should update regexp & check speed
      data[data.length - 1] === "_") {
        return false;
      }
      return true;
    }
    function constructYamlFloat(data) {
      var value, sign;
      value = data.replace(/_/g, "").toLowerCase();
      sign = value[0] === "-" ? -1 : 1;
      if ("+-".indexOf(value[0]) >= 0) {
        value = value.slice(1);
      }
      if (value === ".inf") {
        return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
      } else if (value === ".nan") {
        return NaN;
      }
      return sign * parseFloat(value, 10);
    }
    var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
    function representYamlFloat(object, style) {
      var res;
      if (isNaN(object)) {
        switch (style) {
          case "lowercase":
            return ".nan";
          case "uppercase":
            return ".NAN";
          case "camelcase":
            return ".NaN";
        }
      } else if (Number.POSITIVE_INFINITY === object) {
        switch (style) {
          case "lowercase":
            return ".inf";
          case "uppercase":
            return ".INF";
          case "camelcase":
            return ".Inf";
        }
      } else if (Number.NEGATIVE_INFINITY === object) {
        switch (style) {
          case "lowercase":
            return "-.inf";
          case "uppercase":
            return "-.INF";
          case "camelcase":
            return "-.Inf";
        }
      } else if (common.isNegativeZero(object)) {
        return "-0.0";
      }
      res = object.toString(10);
      return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
    }
    function isFloat(object) {
      return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
    }
    module.exports = new Type("tag:yaml.org,2002:float", {
      kind: "scalar",
      resolve: resolveYamlFloat,
      construct: constructYamlFloat,
      predicate: isFloat,
      represent: representYamlFloat,
      defaultStyle: "lowercase"
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/schema/json.js
var require_json2 = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/schema/json.js"(exports5, module) {
    "use strict";
    module.exports = require_failsafe().extend({
      implicit: [
        require_null(),
        require_bool(),
        require_int(),
        require_float()
      ]
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/schema/core.js
var require_core5 = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/schema/core.js"(exports5, module) {
    "use strict";
    module.exports = require_json2();
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/timestamp.js
var require_timestamp = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/timestamp.js"(exports5, module) {
    "use strict";
    var Type = require_type();
    var YAML_DATE_REGEXP = new RegExp(
      "^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"
    );
    var YAML_TIMESTAMP_REGEXP = new RegExp(
      "^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"
    );
    function resolveYamlTimestamp(data) {
      if (data === null) return false;
      if (YAML_DATE_REGEXP.exec(data) !== null) return true;
      if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
      return false;
    }
    function constructYamlTimestamp(data) {
      var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
      match = YAML_DATE_REGEXP.exec(data);
      if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
      if (match === null) throw new Error("Date resolve error");
      year = +match[1];
      month = +match[2] - 1;
      day = +match[3];
      if (!match[4]) {
        return new Date(Date.UTC(year, month, day));
      }
      hour = +match[4];
      minute = +match[5];
      second = +match[6];
      if (match[7]) {
        fraction = match[7].slice(0, 3);
        while (fraction.length < 3) {
          fraction += "0";
        }
        fraction = +fraction;
      }
      if (match[9]) {
        tz_hour = +match[10];
        tz_minute = +(match[11] || 0);
        delta = (tz_hour * 60 + tz_minute) * 6e4;
        if (match[9] === "-") delta = -delta;
      }
      date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
      if (delta) date.setTime(date.getTime() - delta);
      return date;
    }
    function representYamlTimestamp(object) {
      return object.toISOString();
    }
    module.exports = new Type("tag:yaml.org,2002:timestamp", {
      kind: "scalar",
      resolve: resolveYamlTimestamp,
      construct: constructYamlTimestamp,
      instanceOf: Date,
      represent: representYamlTimestamp
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/merge.js
var require_merge = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/merge.js"(exports5, module) {
    "use strict";
    var Type = require_type();
    function resolveYamlMerge(data) {
      return data === "<<" || data === null;
    }
    module.exports = new Type("tag:yaml.org,2002:merge", {
      kind: "scalar",
      resolve: resolveYamlMerge
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/binary.js
var require_binary = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/binary.js"(exports5, module) {
    "use strict";
    var Type = require_type();
    var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
    function resolveYamlBinary(data) {
      if (data === null) return false;
      var code2, idx, bitlen = 0, max = data.length, map2 = BASE64_MAP;
      for (idx = 0; idx < max; idx++) {
        code2 = map2.indexOf(data.charAt(idx));
        if (code2 > 64) continue;
        if (code2 < 0) return false;
        bitlen += 6;
      }
      return bitlen % 8 === 0;
    }
    function constructYamlBinary(data) {
      var idx, tailbits, input = data.replace(/[\r\n=]/g, ""), max = input.length, map2 = BASE64_MAP, bits = 0, result = [];
      for (idx = 0; idx < max; idx++) {
        if (idx % 4 === 0 && idx) {
          result.push(bits >> 16 & 255);
          result.push(bits >> 8 & 255);
          result.push(bits & 255);
        }
        bits = bits << 6 | map2.indexOf(input.charAt(idx));
      }
      tailbits = max % 4 * 6;
      if (tailbits === 0) {
        result.push(bits >> 16 & 255);
        result.push(bits >> 8 & 255);
        result.push(bits & 255);
      } else if (tailbits === 18) {
        result.push(bits >> 10 & 255);
        result.push(bits >> 2 & 255);
      } else if (tailbits === 12) {
        result.push(bits >> 4 & 255);
      }
      return new Uint8Array(result);
    }
    function representYamlBinary(object) {
      var result = "", bits = 0, idx, tail, max = object.length, map2 = BASE64_MAP;
      for (idx = 0; idx < max; idx++) {
        if (idx % 3 === 0 && idx) {
          result += map2[bits >> 18 & 63];
          result += map2[bits >> 12 & 63];
          result += map2[bits >> 6 & 63];
          result += map2[bits & 63];
        }
        bits = (bits << 8) + object[idx];
      }
      tail = max % 3;
      if (tail === 0) {
        result += map2[bits >> 18 & 63];
        result += map2[bits >> 12 & 63];
        result += map2[bits >> 6 & 63];
        result += map2[bits & 63];
      } else if (tail === 2) {
        result += map2[bits >> 10 & 63];
        result += map2[bits >> 4 & 63];
        result += map2[bits << 2 & 63];
        result += map2[64];
      } else if (tail === 1) {
        result += map2[bits >> 2 & 63];
        result += map2[bits << 4 & 63];
        result += map2[64];
        result += map2[64];
      }
      return result;
    }
    function isBinary(obj) {
      return Object.prototype.toString.call(obj) === "[object Uint8Array]";
    }
    module.exports = new Type("tag:yaml.org,2002:binary", {
      kind: "scalar",
      resolve: resolveYamlBinary,
      construct: constructYamlBinary,
      predicate: isBinary,
      represent: representYamlBinary
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/omap.js
var require_omap = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/omap.js"(exports5, module) {
    "use strict";
    var Type = require_type();
    var _hasOwnProperty = Object.prototype.hasOwnProperty;
    var _toString = Object.prototype.toString;
    function resolveYamlOmap(data) {
      if (data === null) return true;
      var objectKeys = [], index, length, pair, pairKey, pairHasKey, object = data;
      for (index = 0, length = object.length; index < length; index += 1) {
        pair = object[index];
        pairHasKey = false;
        if (_toString.call(pair) !== "[object Object]") return false;
        for (pairKey in pair) {
          if (_hasOwnProperty.call(pair, pairKey)) {
            if (!pairHasKey) pairHasKey = true;
            else return false;
          }
        }
        if (!pairHasKey) return false;
        if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
        else return false;
      }
      return true;
    }
    function constructYamlOmap(data) {
      return data !== null ? data : [];
    }
    module.exports = new Type("tag:yaml.org,2002:omap", {
      kind: "sequence",
      resolve: resolveYamlOmap,
      construct: constructYamlOmap
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/pairs.js
var require_pairs = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/pairs.js"(exports5, module) {
    "use strict";
    var Type = require_type();
    var _toString = Object.prototype.toString;
    function resolveYamlPairs(data) {
      if (data === null) return true;
      var index, length, pair, keys, result, object = data;
      result = new Array(object.length);
      for (index = 0, length = object.length; index < length; index += 1) {
        pair = object[index];
        if (_toString.call(pair) !== "[object Object]") return false;
        keys = Object.keys(pair);
        if (keys.length !== 1) return false;
        result[index] = [keys[0], pair[keys[0]]];
      }
      return true;
    }
    function constructYamlPairs(data) {
      if (data === null) return [];
      var index, length, pair, keys, result, object = data;
      result = new Array(object.length);
      for (index = 0, length = object.length; index < length; index += 1) {
        pair = object[index];
        keys = Object.keys(pair);
        result[index] = [keys[0], pair[keys[0]]];
      }
      return result;
    }
    module.exports = new Type("tag:yaml.org,2002:pairs", {
      kind: "sequence",
      resolve: resolveYamlPairs,
      construct: constructYamlPairs
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/set.js
var require_set = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/type/set.js"(exports5, module) {
    "use strict";
    var Type = require_type();
    var _hasOwnProperty = Object.prototype.hasOwnProperty;
    function resolveYamlSet(data) {
      if (data === null) return true;
      var key, object = data;
      for (key in object) {
        if (_hasOwnProperty.call(object, key)) {
          if (object[key] !== null) return false;
        }
      }
      return true;
    }
    function constructYamlSet(data) {
      return data !== null ? data : {};
    }
    module.exports = new Type("tag:yaml.org,2002:set", {
      kind: "mapping",
      resolve: resolveYamlSet,
      construct: constructYamlSet
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/schema/default.js
var require_default = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/schema/default.js"(exports5, module) {
    "use strict";
    module.exports = require_core5().extend({
      implicit: [
        require_timestamp(),
        require_merge()
      ],
      explicit: [
        require_binary(),
        require_omap(),
        require_pairs(),
        require_set()
      ]
    });
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/loader.js
var require_loader = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/loader.js"(exports5, module) {
    "use strict";
    var common = require_common();
    var YAMLException = require_exception();
    var makeSnippet = require_snippet();
    var DEFAULT_SCHEMA = require_default();
    var _hasOwnProperty = Object.prototype.hasOwnProperty;
    var CONTEXT_FLOW_IN = 1;
    var CONTEXT_FLOW_OUT = 2;
    var CONTEXT_BLOCK_IN = 3;
    var CONTEXT_BLOCK_OUT = 4;
    var CHOMPING_CLIP = 1;
    var CHOMPING_STRIP = 2;
    var CHOMPING_KEEP = 3;
    var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
    var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
    var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
    var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
    var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
    function _class(obj) {
      return Object.prototype.toString.call(obj);
    }
    function is_EOL(c) {
      return c === 10 || c === 13;
    }
    function is_WHITE_SPACE(c) {
      return c === 9 || c === 32;
    }
    function is_WS_OR_EOL(c) {
      return c === 9 || c === 32 || c === 10 || c === 13;
    }
    function is_FLOW_INDICATOR(c) {
      return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
    }
    function fromHexCode(c) {
      var lc;
      if (48 <= c && c <= 57) {
        return c - 48;
      }
      lc = c | 32;
      if (97 <= lc && lc <= 102) {
        return lc - 97 + 10;
      }
      return -1;
    }
    function escapedHexLen(c) {
      if (c === 120) {
        return 2;
      }
      if (c === 117) {
        return 4;
      }
      if (c === 85) {
        return 8;
      }
      return 0;
    }
    function fromDecimalCode(c) {
      if (48 <= c && c <= 57) {
        return c - 48;
      }
      return -1;
    }
    function simpleEscapeSequence(c) {
      return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? "	" : c === 9 ? "	" : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
    }
    function charFromCodepoint(c) {
      if (c <= 65535) {
        return String.fromCharCode(c);
      }
      return String.fromCharCode(
        (c - 65536 >> 10) + 55296,
        (c - 65536 & 1023) + 56320
      );
    }
    var simpleEscapeCheck = new Array(256);
    var simpleEscapeMap = new Array(256);
    for (i = 0; i < 256; i++) {
      simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
      simpleEscapeMap[i] = simpleEscapeSequence(i);
    }
    var i;
    function State(input, options) {
      this.input = input;
      this.filename = options["filename"] || null;
      this.schema = options["schema"] || DEFAULT_SCHEMA;
      this.onWarning = options["onWarning"] || null;
      this.legacy = options["legacy"] || false;
      this.json = options["json"] || false;
      this.listener = options["listener"] || null;
      this.implicitTypes = this.schema.compiledImplicit;
      this.typeMap = this.schema.compiledTypeMap;
      this.length = input.length;
      this.position = 0;
      this.line = 0;
      this.lineStart = 0;
      this.lineIndent = 0;
      this.firstTabInLine = -1;
      this.documents = [];
    }
    function generateError(state, message) {
      var mark = {
        name: state.filename,
        buffer: state.input.slice(0, -1),
        // omit trailing \0
        position: state.position,
        line: state.line,
        column: state.position - state.lineStart
      };
      mark.snippet = makeSnippet(mark);
      return new YAMLException(message, mark);
    }
    function throwError(state, message) {
      throw generateError(state, message);
    }
    function throwWarning(state, message) {
      if (state.onWarning) {
        state.onWarning.call(null, generateError(state, message));
      }
    }
    var directiveHandlers = {
      YAML: function handleYamlDirective(state, name, args) {
        var match, major, minor;
        if (state.version !== null) {
          throwError(state, "duplication of %YAML directive");
        }
        if (args.length !== 1) {
          throwError(state, "YAML directive accepts exactly one argument");
        }
        match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
        if (match === null) {
          throwError(state, "ill-formed argument of the YAML directive");
        }
        major = parseInt(match[1], 10);
        minor = parseInt(match[2], 10);
        if (major !== 1) {
          throwError(state, "unacceptable YAML version of the document");
        }
        state.version = args[0];
        state.checkLineBreaks = minor < 2;
        if (minor !== 1 && minor !== 2) {
          throwWarning(state, "unsupported YAML version of the document");
        }
      },
      TAG: function handleTagDirective(state, name, args) {
        var handle, prefix;
        if (args.length !== 2) {
          throwError(state, "TAG directive accepts exactly two arguments");
        }
        handle = args[0];
        prefix = args[1];
        if (!PATTERN_TAG_HANDLE.test(handle)) {
          throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
        }
        if (_hasOwnProperty.call(state.tagMap, handle)) {
          throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
        }
        if (!PATTERN_TAG_URI.test(prefix)) {
          throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
        }
        try {
          prefix = decodeURIComponent(prefix);
        } catch (err) {
          throwError(state, "tag prefix is malformed: " + prefix);
        }
        state.tagMap[handle] = prefix;
      }
    };
    function captureSegment(state, start, end, checkJson) {
      var _position, _length, _character, _result;
      if (start < end) {
        _result = state.input.slice(start, end);
        if (checkJson) {
          for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
            _character = _result.charCodeAt(_position);
            if (!(_character === 9 || 32 <= _character && _character <= 1114111)) {
              throwError(state, "expected valid JSON character");
            }
          }
        } else if (PATTERN_NON_PRINTABLE.test(_result)) {
          throwError(state, "the stream contains non-printable characters");
        }
        state.result += _result;
      }
    }
    function mergeMappings(state, destination, source, overridableKeys) {
      var sourceKeys, key, index, quantity;
      if (!common.isObject(source)) {
        throwError(state, "cannot merge mappings; the provided source object is unacceptable");
      }
      sourceKeys = Object.keys(source);
      for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
        key = sourceKeys[index];
        if (!_hasOwnProperty.call(destination, key)) {
          destination[key] = source[key];
          overridableKeys[key] = true;
        }
      }
    }
    function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startLineStart, startPos) {
      var index, quantity;
      if (Array.isArray(keyNode)) {
        keyNode = Array.prototype.slice.call(keyNode);
        for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
          if (Array.isArray(keyNode[index])) {
            throwError(state, "nested arrays are not supported inside keys");
          }
          if (typeof keyNode === "object" && _class(keyNode[index]) === "[object Object]") {
            keyNode[index] = "[object Object]";
          }
        }
      }
      if (typeof keyNode === "object" && _class(keyNode) === "[object Object]") {
        keyNode = "[object Object]";
      }
      keyNode = String(keyNode);
      if (_result === null) {
        _result = {};
      }
      if (keyTag === "tag:yaml.org,2002:merge") {
        if (Array.isArray(valueNode)) {
          for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
            mergeMappings(state, _result, valueNode[index], overridableKeys);
          }
        } else {
          mergeMappings(state, _result, valueNode, overridableKeys);
        }
      } else {
        if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) {
          state.line = startLine || state.line;
          state.lineStart = startLineStart || state.lineStart;
          state.position = startPos || state.position;
          throwError(state, "duplicated mapping key");
        }
        if (keyNode === "__proto__") {
          Object.defineProperty(_result, keyNode, {
            configurable: true,
            enumerable: true,
            writable: true,
            value: valueNode
          });
        } else {
          _result[keyNode] = valueNode;
        }
        delete overridableKeys[keyNode];
      }
      return _result;
    }
    function readLineBreak(state) {
      var ch;
      ch = state.input.charCodeAt(state.position);
      if (ch === 10) {
        state.position++;
      } else if (ch === 13) {
        state.position++;
        if (state.input.charCodeAt(state.position) === 10) {
          state.position++;
        }
      } else {
        throwError(state, "a line break is expected");
      }
      state.line += 1;
      state.lineStart = state.position;
      state.firstTabInLine = -1;
    }
    function skipSeparationSpace(state, allowComments, checkIndent) {
      var lineBreaks = 0, ch = state.input.charCodeAt(state.position);
      while (ch !== 0) {
        while (is_WHITE_SPACE(ch)) {
          if (ch === 9 && state.firstTabInLine === -1) {
            state.firstTabInLine = state.position;
          }
          ch = state.input.charCodeAt(++state.position);
        }
        if (allowComments && ch === 35) {
          do {
            ch = state.input.charCodeAt(++state.position);
          } while (ch !== 10 && ch !== 13 && ch !== 0);
        }
        if (is_EOL(ch)) {
          readLineBreak(state);
          ch = state.input.charCodeAt(state.position);
          lineBreaks++;
          state.lineIndent = 0;
          while (ch === 32) {
            state.lineIndent++;
            ch = state.input.charCodeAt(++state.position);
          }
        } else {
          break;
        }
      }
      if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
        throwWarning(state, "deficient indentation");
      }
      return lineBreaks;
    }
    function testDocumentSeparator(state) {
      var _position = state.position, ch;
      ch = state.input.charCodeAt(_position);
      if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) {
        _position += 3;
        ch = state.input.charCodeAt(_position);
        if (ch === 0 || is_WS_OR_EOL(ch)) {
          return true;
        }
      }
      return false;
    }
    function writeFoldedLines(state, count) {
      if (count === 1) {
        state.result += " ";
      } else if (count > 1) {
        state.result += common.repeat("\n", count - 1);
      }
    }
    function readPlainScalar(state, nodeIndent, withinFlowCollection) {
      var preceding, following, captureStart, captureEnd, hasPendingContent, _line, _lineStart, _lineIndent, _kind = state.kind, _result = state.result, ch;
      ch = state.input.charCodeAt(state.position);
      if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96) {
        return false;
      }
      if (ch === 63 || ch === 45) {
        following = state.input.charCodeAt(state.position + 1);
        if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
          return false;
        }
      }
      state.kind = "scalar";
      state.result = "";
      captureStart = captureEnd = state.position;
      hasPendingContent = false;
      while (ch !== 0) {
        if (ch === 58) {
          following = state.input.charCodeAt(state.position + 1);
          if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) {
            break;
          }
        } else if (ch === 35) {
          preceding = state.input.charCodeAt(state.position - 1);
          if (is_WS_OR_EOL(preceding)) {
            break;
          }
        } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) {
          break;
        } else if (is_EOL(ch)) {
          _line = state.line;
          _lineStart = state.lineStart;
          _lineIndent = state.lineIndent;
          skipSeparationSpace(state, false, -1);
          if (state.lineIndent >= nodeIndent) {
            hasPendingContent = true;
            ch = state.input.charCodeAt(state.position);
            continue;
          } else {
            state.position = captureEnd;
            state.line = _line;
            state.lineStart = _lineStart;
            state.lineIndent = _lineIndent;
            break;
          }
        }
        if (hasPendingContent) {
          captureSegment(state, captureStart, captureEnd, false);
          writeFoldedLines(state, state.line - _line);
          captureStart = captureEnd = state.position;
          hasPendingContent = false;
        }
        if (!is_WHITE_SPACE(ch)) {
          captureEnd = state.position + 1;
        }
        ch = state.input.charCodeAt(++state.position);
      }
      captureSegment(state, captureStart, captureEnd, false);
      if (state.result) {
        return true;
      }
      state.kind = _kind;
      state.result = _result;
      return false;
    }
    function readSingleQuotedScalar(state, nodeIndent) {
      var ch, captureStart, captureEnd;
      ch = state.input.charCodeAt(state.position);
      if (ch !== 39) {
        return false;
      }
      state.kind = "scalar";
      state.result = "";
      state.position++;
      captureStart = captureEnd = state.position;
      while ((ch = state.input.charCodeAt(state.position)) !== 0) {
        if (ch === 39) {
          captureSegment(state, captureStart, state.position, true);
          ch = state.input.charCodeAt(++state.position);
          if (ch === 39) {
            captureStart = state.position;
            state.position++;
            captureEnd = state.position;
          } else {
            return true;
          }
        } else if (is_EOL(ch)) {
          captureSegment(state, captureStart, captureEnd, true);
          writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
          captureStart = captureEnd = state.position;
        } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
          throwError(state, "unexpected end of the document within a single quoted scalar");
        } else {
          state.position++;
          captureEnd = state.position;
        }
      }
      throwError(state, "unexpected end of the stream within a single quoted scalar");
    }
    function readDoubleQuotedScalar(state, nodeIndent) {
      var captureStart, captureEnd, hexLength, hexResult, tmp, ch;
      ch = state.input.charCodeAt(state.position);
      if (ch !== 34) {
        return false;
      }
      state.kind = "scalar";
      state.result = "";
      state.position++;
      captureStart = captureEnd = state.position;
      while ((ch = state.input.charCodeAt(state.position)) !== 0) {
        if (ch === 34) {
          captureSegment(state, captureStart, state.position, true);
          state.position++;
          return true;
        } else if (ch === 92) {
          captureSegment(state, captureStart, state.position, true);
          ch = state.input.charCodeAt(++state.position);
          if (is_EOL(ch)) {
            skipSeparationSpace(state, false, nodeIndent);
          } else if (ch < 256 && simpleEscapeCheck[ch]) {
            state.result += simpleEscapeMap[ch];
            state.position++;
          } else if ((tmp = escapedHexLen(ch)) > 0) {
            hexLength = tmp;
            hexResult = 0;
            for (; hexLength > 0; hexLength--) {
              ch = state.input.charCodeAt(++state.position);
              if ((tmp = fromHexCode(ch)) >= 0) {
                hexResult = (hexResult << 4) + tmp;
              } else {
                throwError(state, "expected hexadecimal character");
              }
            }
            state.result += charFromCodepoint(hexResult);
            state.position++;
          } else {
            throwError(state, "unknown escape sequence");
          }
          captureStart = captureEnd = state.position;
        } else if (is_EOL(ch)) {
          captureSegment(state, captureStart, captureEnd, true);
          writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
          captureStart = captureEnd = state.position;
        } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
          throwError(state, "unexpected end of the document within a double quoted scalar");
        } else {
          state.position++;
          captureEnd = state.position;
        }
      }
      throwError(state, "unexpected end of the stream within a double quoted scalar");
    }
    function readFlowCollection(state, nodeIndent) {
      var readNext = true, _line, _lineStart, _pos, _tag = state.tag, _result, _anchor = state.anchor, following, terminator, isPair2, isExplicitPair, isMapping, overridableKeys = /* @__PURE__ */ Object.create(null), keyNode, keyTag, valueNode, ch;
      ch = state.input.charCodeAt(state.position);
      if (ch === 91) {
        terminator = 93;
        isMapping = false;
        _result = [];
      } else if (ch === 123) {
        terminator = 125;
        isMapping = true;
        _result = {};
      } else {
        return false;
      }
      if (state.anchor !== null) {
        state.anchorMap[state.anchor] = _result;
      }
      ch = state.input.charCodeAt(++state.position);
      while (ch !== 0) {
        skipSeparationSpace(state, true, nodeIndent);
        ch = state.input.charCodeAt(state.position);
        if (ch === terminator) {
          state.position++;
          state.tag = _tag;
          state.anchor = _anchor;
          state.kind = isMapping ? "mapping" : "sequence";
          state.result = _result;
          return true;
        } else if (!readNext) {
          throwError(state, "missed comma between flow collection entries");
        } else if (ch === 44) {
          throwError(state, "expected the node content, but found ','");
        }
        keyTag = keyNode = valueNode = null;
        isPair2 = isExplicitPair = false;
        if (ch === 63) {
          following = state.input.charCodeAt(state.position + 1);
          if (is_WS_OR_EOL(following)) {
            isPair2 = isExplicitPair = true;
            state.position++;
            skipSeparationSpace(state, true, nodeIndent);
          }
        }
        _line = state.line;
        _lineStart = state.lineStart;
        _pos = state.position;
        composeNode2(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
        keyTag = state.tag;
        keyNode = state.result;
        skipSeparationSpace(state, true, nodeIndent);
        ch = state.input.charCodeAt(state.position);
        if ((isExplicitPair || state.line === _line) && ch === 58) {
          isPair2 = true;
          ch = state.input.charCodeAt(++state.position);
          skipSeparationSpace(state, true, nodeIndent);
          composeNode2(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
          valueNode = state.result;
        }
        if (isMapping) {
          storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos);
        } else if (isPair2) {
          _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode, _line, _lineStart, _pos));
        } else {
          _result.push(keyNode);
        }
        skipSeparationSpace(state, true, nodeIndent);
        ch = state.input.charCodeAt(state.position);
        if (ch === 44) {
          readNext = true;
          ch = state.input.charCodeAt(++state.position);
        } else {
          readNext = false;
        }
      }
      throwError(state, "unexpected end of the stream within a flow collection");
    }
    function readBlockScalar(state, nodeIndent) {
      var captureStart, folding, chomping = CHOMPING_CLIP, didReadContent = false, detectedIndent = false, textIndent = nodeIndent, emptyLines = 0, atMoreIndented = false, tmp, ch;
      ch = state.input.charCodeAt(state.position);
      if (ch === 124) {
        folding = false;
      } else if (ch === 62) {
        folding = true;
      } else {
        return false;
      }
      state.kind = "scalar";
      state.result = "";
      while (ch !== 0) {
        ch = state.input.charCodeAt(++state.position);
        if (ch === 43 || ch === 45) {
          if (CHOMPING_CLIP === chomping) {
            chomping = ch === 43 ? CHOMPING_KEEP : CHOMPING_STRIP;
          } else {
            throwError(state, "repeat of a chomping mode identifier");
          }
        } else if ((tmp = fromDecimalCode(ch)) >= 0) {
          if (tmp === 0) {
            throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
          } else if (!detectedIndent) {
            textIndent = nodeIndent + tmp - 1;
            detectedIndent = true;
          } else {
            throwError(state, "repeat of an indentation width identifier");
          }
        } else {
          break;
        }
      }
      if (is_WHITE_SPACE(ch)) {
        do {
          ch = state.input.charCodeAt(++state.position);
        } while (is_WHITE_SPACE(ch));
        if (ch === 35) {
          do {
            ch = state.input.charCodeAt(++state.position);
          } while (!is_EOL(ch) && ch !== 0);
        }
      }
      while (ch !== 0) {
        readLineBreak(state);
        state.lineIndent = 0;
        ch = state.input.charCodeAt(state.position);
        while ((!detectedIndent || state.lineIndent < textIndent) && ch === 32) {
          state.lineIndent++;
          ch = state.input.charCodeAt(++state.position);
        }
        if (!detectedIndent && state.lineIndent > textIndent) {
          textIndent = state.lineIndent;
        }
        if (is_EOL(ch)) {
          emptyLines++;
          continue;
        }
        if (state.lineIndent < textIndent) {
          if (chomping === CHOMPING_KEEP) {
            state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
          } else if (chomping === CHOMPING_CLIP) {
            if (didReadContent) {
              state.result += "\n";
            }
          }
          break;
        }
        if (folding) {
          if (is_WHITE_SPACE(ch)) {
            atMoreIndented = true;
            state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
          } else if (atMoreIndented) {
            atMoreIndented = false;
            state.result += common.repeat("\n", emptyLines + 1);
          } else if (emptyLines === 0) {
            if (didReadContent) {
              state.result += " ";
            }
          } else {
            state.result += common.repeat("\n", emptyLines);
          }
        } else {
          state.result += common.repeat("\n", didReadContent ? 1 + emptyLines : emptyLines);
        }
        didReadContent = true;
        detectedIndent = true;
        emptyLines = 0;
        captureStart = state.position;
        while (!is_EOL(ch) && ch !== 0) {
          ch = state.input.charCodeAt(++state.position);
        }
        captureSegment(state, captureStart, state.position, false);
      }
      return true;
    }
    function readBlockSequence(state, nodeIndent) {
      var _line, _tag = state.tag, _anchor = state.anchor, _result = [], following, detected = false, ch;
      if (state.firstTabInLine !== -1) return false;
      if (state.anchor !== null) {
        state.anchorMap[state.anchor] = _result;
      }
      ch = state.input.charCodeAt(state.position);
      while (ch !== 0) {
        if (state.firstTabInLine !== -1) {
          state.position = state.firstTabInLine;
          throwError(state, "tab characters must not be used in indentation");
        }
        if (ch !== 45) {
          break;
        }
        following = state.input.charCodeAt(state.position + 1);
        if (!is_WS_OR_EOL(following)) {
          break;
        }
        detected = true;
        state.position++;
        if (skipSeparationSpace(state, true, -1)) {
          if (state.lineIndent <= nodeIndent) {
            _result.push(null);
            ch = state.input.charCodeAt(state.position);
            continue;
          }
        }
        _line = state.line;
        composeNode2(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
        _result.push(state.result);
        skipSeparationSpace(state, true, -1);
        ch = state.input.charCodeAt(state.position);
        if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
          throwError(state, "bad indentation of a sequence entry");
        } else if (state.lineIndent < nodeIndent) {
          break;
        }
      }
      if (detected) {
        state.tag = _tag;
        state.anchor = _anchor;
        state.kind = "sequence";
        state.result = _result;
        return true;
      }
      return false;
    }
    function readBlockMapping(state, nodeIndent, flowIndent) {
      var following, allowCompact, _line, _keyLine, _keyLineStart, _keyPos, _tag = state.tag, _anchor = state.anchor, _result = {}, overridableKeys = /* @__PURE__ */ Object.create(null), keyTag = null, keyNode = null, valueNode = null, atExplicitKey = false, detected = false, ch;
      if (state.firstTabInLine !== -1) return false;
      if (state.anchor !== null) {
        state.anchorMap[state.anchor] = _result;
      }
      ch = state.input.charCodeAt(state.position);
      while (ch !== 0) {
        if (!atExplicitKey && state.firstTabInLine !== -1) {
          state.position = state.firstTabInLine;
          throwError(state, "tab characters must not be used in indentation");
        }
        following = state.input.charCodeAt(state.position + 1);
        _line = state.line;
        if ((ch === 63 || ch === 58) && is_WS_OR_EOL(following)) {
          if (ch === 63) {
            if (atExplicitKey) {
              storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
              keyTag = keyNode = valueNode = null;
            }
            detected = true;
            atExplicitKey = true;
            allowCompact = true;
          } else if (atExplicitKey) {
            atExplicitKey = false;
            allowCompact = true;
          } else {
            throwError(state, "incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line");
          }
          state.position += 1;
          ch = following;
        } else {
          _keyLine = state.line;
          _keyLineStart = state.lineStart;
          _keyPos = state.position;
          if (!composeNode2(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
            break;
          }
          if (state.line === _line) {
            ch = state.input.charCodeAt(state.position);
            while (is_WHITE_SPACE(ch)) {
              ch = state.input.charCodeAt(++state.position);
            }
            if (ch === 58) {
              ch = state.input.charCodeAt(++state.position);
              if (!is_WS_OR_EOL(ch)) {
                throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
              }
              if (atExplicitKey) {
                storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
                keyTag = keyNode = valueNode = null;
              }
              detected = true;
              atExplicitKey = false;
              allowCompact = false;
              keyTag = state.tag;
              keyNode = state.result;
            } else if (detected) {
              throwError(state, "can not read an implicit mapping pair; a colon is missed");
            } else {
              state.tag = _tag;
              state.anchor = _anchor;
              return true;
            }
          } else if (detected) {
            throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
          } else {
            state.tag = _tag;
            state.anchor = _anchor;
            return true;
          }
        }
        if (state.line === _line || state.lineIndent > nodeIndent) {
          if (atExplicitKey) {
            _keyLine = state.line;
            _keyLineStart = state.lineStart;
            _keyPos = state.position;
          }
          if (composeNode2(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
            if (atExplicitKey) {
              keyNode = state.result;
            } else {
              valueNode = state.result;
            }
          }
          if (!atExplicitKey) {
            storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _keyLine, _keyLineStart, _keyPos);
            keyTag = keyNode = valueNode = null;
          }
          skipSeparationSpace(state, true, -1);
          ch = state.input.charCodeAt(state.position);
        }
        if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) {
          throwError(state, "bad indentation of a mapping entry");
        } else if (state.lineIndent < nodeIndent) {
          break;
        }
      }
      if (atExplicitKey) {
        storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null, _keyLine, _keyLineStart, _keyPos);
      }
      if (detected) {
        state.tag = _tag;
        state.anchor = _anchor;
        state.kind = "mapping";
        state.result = _result;
      }
      return detected;
    }
    function readTagProperty(state) {
      var _position, isVerbatim = false, isNamed = false, tagHandle, tagName, ch;
      ch = state.input.charCodeAt(state.position);
      if (ch !== 33) return false;
      if (state.tag !== null) {
        throwError(state, "duplication of a tag property");
      }
      ch = state.input.charCodeAt(++state.position);
      if (ch === 60) {
        isVerbatim = true;
        ch = state.input.charCodeAt(++state.position);
      } else if (ch === 33) {
        isNamed = true;
        tagHandle = "!!";
        ch = state.input.charCodeAt(++state.position);
      } else {
        tagHandle = "!";
      }
      _position = state.position;
      if (isVerbatim) {
        do {
          ch = state.input.charCodeAt(++state.position);
        } while (ch !== 0 && ch !== 62);
        if (state.position < state.length) {
          tagName = state.input.slice(_position, state.position);
          ch = state.input.charCodeAt(++state.position);
        } else {
          throwError(state, "unexpected end of the stream within a verbatim tag");
        }
      } else {
        while (ch !== 0 && !is_WS_OR_EOL(ch)) {
          if (ch === 33) {
            if (!isNamed) {
              tagHandle = state.input.slice(_position - 1, state.position + 1);
              if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
                throwError(state, "named tag handle cannot contain such characters");
              }
              isNamed = true;
              _position = state.position + 1;
            } else {
              throwError(state, "tag suffix cannot contain exclamation marks");
            }
          }
          ch = state.input.charCodeAt(++state.position);
        }
        tagName = state.input.slice(_position, state.position);
        if (PATTERN_FLOW_INDICATORS.test(tagName)) {
          throwError(state, "tag suffix cannot contain flow indicator characters");
        }
      }
      if (tagName && !PATTERN_TAG_URI.test(tagName)) {
        throwError(state, "tag name cannot contain such characters: " + tagName);
      }
      try {
        tagName = decodeURIComponent(tagName);
      } catch (err) {
        throwError(state, "tag name is malformed: " + tagName);
      }
      if (isVerbatim) {
        state.tag = tagName;
      } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
        state.tag = state.tagMap[tagHandle] + tagName;
      } else if (tagHandle === "!") {
        state.tag = "!" + tagName;
      } else if (tagHandle === "!!") {
        state.tag = "tag:yaml.org,2002:" + tagName;
      } else {
        throwError(state, 'undeclared tag handle "' + tagHandle + '"');
      }
      return true;
    }
    function readAnchorProperty(state) {
      var _position, ch;
      ch = state.input.charCodeAt(state.position);
      if (ch !== 38) return false;
      if (state.anchor !== null) {
        throwError(state, "duplication of an anchor property");
      }
      ch = state.input.charCodeAt(++state.position);
      _position = state.position;
      while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
        ch = state.input.charCodeAt(++state.position);
      }
      if (state.position === _position) {
        throwError(state, "name of an anchor node must contain at least one character");
      }
      state.anchor = state.input.slice(_position, state.position);
      return true;
    }
    function readAlias(state) {
      var _position, alias, ch;
      ch = state.input.charCodeAt(state.position);
      if (ch !== 42) return false;
      ch = state.input.charCodeAt(++state.position);
      _position = state.position;
      while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
        ch = state.input.charCodeAt(++state.position);
      }
      if (state.position === _position) {
        throwError(state, "name of an alias node must contain at least one character");
      }
      alias = state.input.slice(_position, state.position);
      if (!_hasOwnProperty.call(state.anchorMap, alias)) {
        throwError(state, 'unidentified alias "' + alias + '"');
      }
      state.result = state.anchorMap[alias];
      skipSeparationSpace(state, true, -1);
      return true;
    }
    function composeNode2(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
      var allowBlockStyles, allowBlockScalars, allowBlockCollections, indentStatus = 1, atNewLine = false, hasContent = false, typeIndex, typeQuantity, typeList, type, flowIndent, blockIndent;
      if (state.listener !== null) {
        state.listener("open", state);
      }
      state.tag = null;
      state.anchor = null;
      state.kind = null;
      state.result = null;
      allowBlockStyles = allowBlockScalars = allowBlockCollections = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
      if (allowToSeek) {
        if (skipSeparationSpace(state, true, -1)) {
          atNewLine = true;
          if (state.lineIndent > parentIndent) {
            indentStatus = 1;
          } else if (state.lineIndent === parentIndent) {
            indentStatus = 0;
          } else if (state.lineIndent < parentIndent) {
            indentStatus = -1;
          }
        }
      }
      if (indentStatus === 1) {
        while (readTagProperty(state) || readAnchorProperty(state)) {
          if (skipSeparationSpace(state, true, -1)) {
            atNewLine = true;
            allowBlockCollections = allowBlockStyles;
            if (state.lineIndent > parentIndent) {
              indentStatus = 1;
            } else if (state.lineIndent === parentIndent) {
              indentStatus = 0;
            } else if (state.lineIndent < parentIndent) {
              indentStatus = -1;
            }
          } else {
            allowBlockCollections = false;
          }
        }
      }
      if (allowBlockCollections) {
        allowBlockCollections = atNewLine || allowCompact;
      }
      if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
        if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
          flowIndent = parentIndent;
        } else {
          flowIndent = parentIndent + 1;
        }
        blockIndent = state.position - state.lineStart;
        if (indentStatus === 1) {
          if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) {
            hasContent = true;
          } else {
            if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) {
              hasContent = true;
            } else if (readAlias(state)) {
              hasContent = true;
              if (state.tag !== null || state.anchor !== null) {
                throwError(state, "alias node should not have any properties");
              }
            } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
              hasContent = true;
              if (state.tag === null) {
                state.tag = "?";
              }
            }
            if (state.anchor !== null) {
              state.anchorMap[state.anchor] = state.result;
            }
          }
        } else if (indentStatus === 0) {
          hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
        }
      }
      if (state.tag === null) {
        if (state.anchor !== null) {
          state.anchorMap[state.anchor] = state.result;
        }
      } else if (state.tag === "?") {
        if (state.result !== null && state.kind !== "scalar") {
          throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
        }
        for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
          type = state.implicitTypes[typeIndex];
          if (type.resolve(state.result)) {
            state.result = type.construct(state.result);
            state.tag = type.tag;
            if (state.anchor !== null) {
              state.anchorMap[state.anchor] = state.result;
            }
            break;
          }
        }
      } else if (state.tag !== "!") {
        if (_hasOwnProperty.call(state.typeMap[state.kind || "fallback"], state.tag)) {
          type = state.typeMap[state.kind || "fallback"][state.tag];
        } else {
          type = null;
          typeList = state.typeMap.multi[state.kind || "fallback"];
          for (typeIndex = 0, typeQuantity = typeList.length; typeIndex < typeQuantity; typeIndex += 1) {
            if (state.tag.slice(0, typeList[typeIndex].tag.length) === typeList[typeIndex].tag) {
              type = typeList[typeIndex];
              break;
            }
          }
        }
        if (!type) {
          throwError(state, "unknown tag !<" + state.tag + ">");
        }
        if (state.result !== null && type.kind !== state.kind) {
          throwError(state, "unacceptable node kind for !<" + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
        }
        if (!type.resolve(state.result, state.tag)) {
          throwError(state, "cannot resolve a node with !<" + state.tag + "> explicit tag");
        } else {
          state.result = type.construct(state.result, state.tag);
          if (state.anchor !== null) {
            state.anchorMap[state.anchor] = state.result;
          }
        }
      }
      if (state.listener !== null) {
        state.listener("close", state);
      }
      return state.tag !== null || state.anchor !== null || hasContent;
    }
    function readDocument(state) {
      var documentStart = state.position, _position, directiveName, directiveArgs, hasDirectives = false, ch;
      state.version = null;
      state.checkLineBreaks = state.legacy;
      state.tagMap = /* @__PURE__ */ Object.create(null);
      state.anchorMap = /* @__PURE__ */ Object.create(null);
      while ((ch = state.input.charCodeAt(state.position)) !== 0) {
        skipSeparationSpace(state, true, -1);
        ch = state.input.charCodeAt(state.position);
        if (state.lineIndent > 0 || ch !== 37) {
          break;
        }
        hasDirectives = true;
        ch = state.input.charCodeAt(++state.position);
        _position = state.position;
        while (ch !== 0 && !is_WS_OR_EOL(ch)) {
          ch = state.input.charCodeAt(++state.position);
        }
        directiveName = state.input.slice(_position, state.position);
        directiveArgs = [];
        if (directiveName.length < 1) {
          throwError(state, "directive name must not be less than one character in length");
        }
        while (ch !== 0) {
          while (is_WHITE_SPACE(ch)) {
            ch = state.input.charCodeAt(++state.position);
          }
          if (ch === 35) {
            do {
              ch = state.input.charCodeAt(++state.position);
            } while (ch !== 0 && !is_EOL(ch));
            break;
          }
          if (is_EOL(ch)) break;
          _position = state.position;
          while (ch !== 0 && !is_WS_OR_EOL(ch)) {
            ch = state.input.charCodeAt(++state.position);
          }
          directiveArgs.push(state.input.slice(_position, state.position));
        }
        if (ch !== 0) readLineBreak(state);
        if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
          directiveHandlers[directiveName](state, directiveName, directiveArgs);
        } else {
          throwWarning(state, 'unknown document directive "' + directiveName + '"');
        }
      }
      skipSeparationSpace(state, true, -1);
      if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45) {
        state.position += 3;
        skipSeparationSpace(state, true, -1);
      } else if (hasDirectives) {
        throwError(state, "directives end mark is expected");
      }
      composeNode2(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
      skipSeparationSpace(state, true, -1);
      if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
        throwWarning(state, "non-ASCII line breaks are interpreted as content");
      }
      state.documents.push(state.result);
      if (state.position === state.lineStart && testDocumentSeparator(state)) {
        if (state.input.charCodeAt(state.position) === 46) {
          state.position += 3;
          skipSeparationSpace(state, true, -1);
        }
        return;
      }
      if (state.position < state.length - 1) {
        throwError(state, "end of the stream or a document separator is expected");
      } else {
        return;
      }
    }
    function loadDocuments(input, options) {
      input = String(input);
      options = options || {};
      if (input.length !== 0) {
        if (input.charCodeAt(input.length - 1) !== 10 && input.charCodeAt(input.length - 1) !== 13) {
          input += "\n";
        }
        if (input.charCodeAt(0) === 65279) {
          input = input.slice(1);
        }
      }
      var state = new State(input, options);
      var nullpos = input.indexOf("\0");
      if (nullpos !== -1) {
        state.position = nullpos;
        throwError(state, "null byte is not allowed in input");
      }
      state.input += "\0";
      while (state.input.charCodeAt(state.position) === 32) {
        state.lineIndent += 1;
        state.position += 1;
      }
      while (state.position < state.length - 1) {
        readDocument(state);
      }
      return state.documents;
    }
    function loadAll(input, iterator, options) {
      if (iterator !== null && typeof iterator === "object" && typeof options === "undefined") {
        options = iterator;
        iterator = null;
      }
      var documents = loadDocuments(input, options);
      if (typeof iterator !== "function") {
        return documents;
      }
      for (var index = 0, length = documents.length; index < length; index += 1) {
        iterator(documents[index]);
      }
    }
    function load(input, options) {
      var documents = loadDocuments(input, options);
      if (documents.length === 0) {
        return void 0;
      } else if (documents.length === 1) {
        return documents[0];
      }
      throw new YAMLException("expected a single document in the stream, but found more");
    }
    module.exports.loadAll = loadAll;
    module.exports.load = load;
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/dumper.js
var require_dumper = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/lib/dumper.js"(exports5, module) {
    "use strict";
    var common = require_common();
    var YAMLException = require_exception();
    var DEFAULT_SCHEMA = require_default();
    var _toString = Object.prototype.toString;
    var _hasOwnProperty = Object.prototype.hasOwnProperty;
    var CHAR_BOM = 65279;
    var CHAR_TAB = 9;
    var CHAR_LINE_FEED = 10;
    var CHAR_CARRIAGE_RETURN = 13;
    var CHAR_SPACE = 32;
    var CHAR_EXCLAMATION = 33;
    var CHAR_DOUBLE_QUOTE = 34;
    var CHAR_SHARP = 35;
    var CHAR_PERCENT = 37;
    var CHAR_AMPERSAND = 38;
    var CHAR_SINGLE_QUOTE = 39;
    var CHAR_ASTERISK = 42;
    var CHAR_COMMA = 44;
    var CHAR_MINUS = 45;
    var CHAR_COLON = 58;
    var CHAR_EQUALS = 61;
    var CHAR_GREATER_THAN = 62;
    var CHAR_QUESTION = 63;
    var CHAR_COMMERCIAL_AT = 64;
    var CHAR_LEFT_SQUARE_BRACKET = 91;
    var CHAR_RIGHT_SQUARE_BRACKET = 93;
    var CHAR_GRAVE_ACCENT = 96;
    var CHAR_LEFT_CURLY_BRACKET = 123;
    var CHAR_VERTICAL_LINE = 124;
    var CHAR_RIGHT_CURLY_BRACKET = 125;
    var ESCAPE_SEQUENCES = {};
    ESCAPE_SEQUENCES[0] = "\\0";
    ESCAPE_SEQUENCES[7] = "\\a";
    ESCAPE_SEQUENCES[8] = "\\b";
    ESCAPE_SEQUENCES[9] = "\\t";
    ESCAPE_SEQUENCES[10] = "\\n";
    ESCAPE_SEQUENCES[11] = "\\v";
    ESCAPE_SEQUENCES[12] = "\\f";
    ESCAPE_SEQUENCES[13] = "\\r";
    ESCAPE_SEQUENCES[27] = "\\e";
    ESCAPE_SEQUENCES[34] = '\\"';
    ESCAPE_SEQUENCES[92] = "\\\\";
    ESCAPE_SEQUENCES[133] = "\\N";
    ESCAPE_SEQUENCES[160] = "\\_";
    ESCAPE_SEQUENCES[8232] = "\\L";
    ESCAPE_SEQUENCES[8233] = "\\P";
    var DEPRECATED_BOOLEANS_SYNTAX = [
      "y",
      "Y",
      "yes",
      "Yes",
      "YES",
      "on",
      "On",
      "ON",
      "n",
      "N",
      "no",
      "No",
      "NO",
      "off",
      "Off",
      "OFF"
    ];
    var DEPRECATED_BASE60_SYNTAX = /^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;
    function compileStyleMap(schema4, map2) {
      var result, keys, index, length, tag, style, type;
      if (map2 === null) return {};
      result = {};
      keys = Object.keys(map2);
      for (index = 0, length = keys.length; index < length; index += 1) {
        tag = keys[index];
        style = String(map2[tag]);
        if (tag.slice(0, 2) === "!!") {
          tag = "tag:yaml.org,2002:" + tag.slice(2);
        }
        type = schema4.compiledTypeMap["fallback"][tag];
        if (type && _hasOwnProperty.call(type.styleAliases, style)) {
          style = type.styleAliases[style];
        }
        result[tag] = style;
      }
      return result;
    }
    function encodeHex(character) {
      var string2, handle, length;
      string2 = character.toString(16).toUpperCase();
      if (character <= 255) {
        handle = "x";
        length = 2;
      } else if (character <= 65535) {
        handle = "u";
        length = 4;
      } else if (character <= 4294967295) {
        handle = "U";
        length = 8;
      } else {
        throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
      }
      return "\\" + handle + common.repeat("0", length - string2.length) + string2;
    }
    var QUOTING_TYPE_SINGLE = 1;
    var QUOTING_TYPE_DOUBLE = 2;
    function State(options) {
      this.schema = options["schema"] || DEFAULT_SCHEMA;
      this.indent = Math.max(1, options["indent"] || 2);
      this.noArrayIndent = options["noArrayIndent"] || false;
      this.skipInvalid = options["skipInvalid"] || false;
      this.flowLevel = common.isNothing(options["flowLevel"]) ? -1 : options["flowLevel"];
      this.styleMap = compileStyleMap(this.schema, options["styles"] || null);
      this.sortKeys = options["sortKeys"] || false;
      this.lineWidth = options["lineWidth"] || 80;
      this.noRefs = options["noRefs"] || false;
      this.noCompatMode = options["noCompatMode"] || false;
      this.condenseFlow = options["condenseFlow"] || false;
      this.quotingType = options["quotingType"] === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE;
      this.forceQuotes = options["forceQuotes"] || false;
      this.replacer = typeof options["replacer"] === "function" ? options["replacer"] : null;
      this.implicitTypes = this.schema.compiledImplicit;
      this.explicitTypes = this.schema.compiledExplicit;
      this.tag = null;
      this.result = "";
      this.duplicates = [];
      this.usedDuplicates = null;
    }
    function indentString(string2, spaces) {
      var ind = common.repeat(" ", spaces), position = 0, next = -1, result = "", line, length = string2.length;
      while (position < length) {
        next = string2.indexOf("\n", position);
        if (next === -1) {
          line = string2.slice(position);
          position = length;
        } else {
          line = string2.slice(position, next + 1);
          position = next + 1;
        }
        if (line.length && line !== "\n") result += ind;
        result += line;
      }
      return result;
    }
    function generateNextLine(state, level) {
      return "\n" + common.repeat(" ", state.indent * level);
    }
    function testImplicitResolving(state, str) {
      var index, length, type;
      for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
        type = state.implicitTypes[index];
        if (type.resolve(str)) {
          return true;
        }
      }
      return false;
    }
    function isWhitespace(c) {
      return c === CHAR_SPACE || c === CHAR_TAB;
    }
    function isPrintable(c) {
      return 32 <= c && c <= 126 || 161 <= c && c <= 55295 && c !== 8232 && c !== 8233 || 57344 <= c && c <= 65533 && c !== CHAR_BOM || 65536 <= c && c <= 1114111;
    }
    function isNsCharOrWhitespace(c) {
      return isPrintable(c) && c !== CHAR_BOM && c !== CHAR_CARRIAGE_RETURN && c !== CHAR_LINE_FEED;
    }
    function isPlainSafe(c, prev, inblock) {
      var cIsNsCharOrWhitespace = isNsCharOrWhitespace(c);
      var cIsNsChar = cIsNsCharOrWhitespace && !isWhitespace(c);
      return (
        // ns-plain-safe
        (inblock ? (
          // c = flow-in
          cIsNsCharOrWhitespace
        ) : cIsNsCharOrWhitespace && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON && cIsNsChar
      );
    }
    function isPlainSafeFirst(c) {
      return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON && c !== CHAR_COMMA && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
    }
    function isPlainSafeLast(c) {
      return !isWhitespace(c) && c !== CHAR_COLON;
    }
    function codePointAt(string2, pos) {
      var first = string2.charCodeAt(pos), second;
      if (first >= 55296 && first <= 56319 && pos + 1 < string2.length) {
        second = string2.charCodeAt(pos + 1);
        if (second >= 56320 && second <= 57343) {
          return (first - 55296) * 1024 + second - 56320 + 65536;
        }
      }
      return first;
    }
    function needIndentIndicator(string2) {
      var leadingSpaceRe = /^\n* /;
      return leadingSpaceRe.test(string2);
    }
    var STYLE_PLAIN = 1;
    var STYLE_SINGLE = 2;
    var STYLE_LITERAL = 3;
    var STYLE_FOLDED = 4;
    var STYLE_DOUBLE = 5;
    function chooseScalarStyle(string2, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType, quotingType, forceQuotes, inblock) {
      var i;
      var char = 0;
      var prevChar = null;
      var hasLineBreak = false;
      var hasFoldableLine = false;
      var shouldTrackWidth = lineWidth !== -1;
      var previousLineBreak = -1;
      var plain = isPlainSafeFirst(codePointAt(string2, 0)) && isPlainSafeLast(codePointAt(string2, string2.length - 1));
      if (singleLineOnly || forceQuotes) {
        for (i = 0; i < string2.length; char >= 65536 ? i += 2 : i++) {
          char = codePointAt(string2, i);
          if (!isPrintable(char)) {
            return STYLE_DOUBLE;
          }
          plain = plain && isPlainSafe(char, prevChar, inblock);
          prevChar = char;
        }
      } else {
        for (i = 0; i < string2.length; char >= 65536 ? i += 2 : i++) {
          char = codePointAt(string2, i);
          if (char === CHAR_LINE_FEED) {
            hasLineBreak = true;
            if (shouldTrackWidth) {
              hasFoldableLine = hasFoldableLine || // Foldable line = too long, and not more-indented.
              i - previousLineBreak - 1 > lineWidth && string2[previousLineBreak + 1] !== " ";
              previousLineBreak = i;
            }
          } else if (!isPrintable(char)) {
            return STYLE_DOUBLE;
          }
          plain = plain && isPlainSafe(char, prevChar, inblock);
          prevChar = char;
        }
        hasFoldableLine = hasFoldableLine || shouldTrackWidth && (i - previousLineBreak - 1 > lineWidth && string2[previousLineBreak + 1] !== " ");
      }
      if (!hasLineBreak && !hasFoldableLine) {
        if (plain && !forceQuotes && !testAmbiguousType(string2)) {
          return STYLE_PLAIN;
        }
        return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
      }
      if (indentPerLevel > 9 && needIndentIndicator(string2)) {
        return STYLE_DOUBLE;
      }
      if (!forceQuotes) {
        return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
      }
      return quotingType === QUOTING_TYPE_DOUBLE ? STYLE_DOUBLE : STYLE_SINGLE;
    }
    function writeScalar(state, string2, level, iskey, inblock) {
      state.dump = (function() {
        if (string2.length === 0) {
          return state.quotingType === QUOTING_TYPE_DOUBLE ? '""' : "''";
        }
        if (!state.noCompatMode) {
          if (DEPRECATED_BOOLEANS_SYNTAX.indexOf(string2) !== -1 || DEPRECATED_BASE60_SYNTAX.test(string2)) {
            return state.quotingType === QUOTING_TYPE_DOUBLE ? '"' + string2 + '"' : "'" + string2 + "'";
          }
        }
        var indent = state.indent * Math.max(1, level);
        var lineWidth = state.lineWidth === -1 ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
        var singleLineOnly = iskey || state.flowLevel > -1 && level >= state.flowLevel;
        function testAmbiguity(string3) {
          return testImplicitResolving(state, string3);
        }
        switch (chooseScalarStyle(
          string2,
          singleLineOnly,
          state.indent,
          lineWidth,
          testAmbiguity,
          state.quotingType,
          state.forceQuotes && !iskey,
          inblock
        )) {
          case STYLE_PLAIN:
            return string2;
          case STYLE_SINGLE:
            return "'" + string2.replace(/'/g, "''") + "'";
          case STYLE_LITERAL:
            return "|" + blockHeader(string2, state.indent) + dropEndingNewline(indentString(string2, indent));
          case STYLE_FOLDED:
            return ">" + blockHeader(string2, state.indent) + dropEndingNewline(indentString(foldString(string2, lineWidth), indent));
          case STYLE_DOUBLE:
            return '"' + escapeString(string2, lineWidth) + '"';
          default:
            throw new YAMLException("impossible error: invalid scalar style");
        }
      })();
    }
    function blockHeader(string2, indentPerLevel) {
      var indentIndicator = needIndentIndicator(string2) ? String(indentPerLevel) : "";
      var clip = string2[string2.length - 1] === "\n";
      var keep = clip && (string2[string2.length - 2] === "\n" || string2 === "\n");
      var chomp = keep ? "+" : clip ? "" : "-";
      return indentIndicator + chomp + "\n";
    }
    function dropEndingNewline(string2) {
      return string2[string2.length - 1] === "\n" ? string2.slice(0, -1) : string2;
    }
    function foldString(string2, width) {
      var lineRe = /(\n+)([^\n]*)/g;
      var result = (function() {
        var nextLF = string2.indexOf("\n");
        nextLF = nextLF !== -1 ? nextLF : string2.length;
        lineRe.lastIndex = nextLF;
        return foldLine(string2.slice(0, nextLF), width);
      })();
      var prevMoreIndented = string2[0] === "\n" || string2[0] === " ";
      var moreIndented;
      var match;
      while (match = lineRe.exec(string2)) {
        var prefix = match[1], line = match[2];
        moreIndented = line[0] === " ";
        result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? "\n" : "") + foldLine(line, width);
        prevMoreIndented = moreIndented;
      }
      return result;
    }
    function foldLine(line, width) {
      if (line === "" || line[0] === " ") return line;
      var breakRe = / [^ ]/g;
      var match;
      var start = 0, end, curr = 0, next = 0;
      var result = "";
      while (match = breakRe.exec(line)) {
        next = match.index;
        if (next - start > width) {
          end = curr > start ? curr : next;
          result += "\n" + line.slice(start, end);
          start = end + 1;
        }
        curr = next;
      }
      result += "\n";
      if (line.length - start > width && curr > start) {
        result += line.slice(start, curr) + "\n" + line.slice(curr + 1);
      } else {
        result += line.slice(start);
      }
      return result.slice(1);
    }
    function escapeString(string2) {
      var result = "";
      var char = 0;
      var escapeSeq;
      for (var i = 0; i < string2.length; char >= 65536 ? i += 2 : i++) {
        char = codePointAt(string2, i);
        escapeSeq = ESCAPE_SEQUENCES[char];
        if (!escapeSeq && isPrintable(char)) {
          result += string2[i];
          if (char >= 65536) result += string2[i + 1];
        } else {
          result += escapeSeq || encodeHex(char);
        }
      }
      return result;
    }
    function writeFlowSequence(state, level, object) {
      var _result = "", _tag = state.tag, index, length, value;
      for (index = 0, length = object.length; index < length; index += 1) {
        value = object[index];
        if (state.replacer) {
          value = state.replacer.call(object, String(index), value);
        }
        if (writeNode(state, level, value, false, false) || typeof value === "undefined" && writeNode(state, level, null, false, false)) {
          if (_result !== "") _result += "," + (!state.condenseFlow ? " " : "");
          _result += state.dump;
        }
      }
      state.tag = _tag;
      state.dump = "[" + _result + "]";
    }
    function writeBlockSequence(state, level, object, compact) {
      var _result = "", _tag = state.tag, index, length, value;
      for (index = 0, length = object.length; index < length; index += 1) {
        value = object[index];
        if (state.replacer) {
          value = state.replacer.call(object, String(index), value);
        }
        if (writeNode(state, level + 1, value, true, true, false, true) || typeof value === "undefined" && writeNode(state, level + 1, null, true, true, false, true)) {
          if (!compact || _result !== "") {
            _result += generateNextLine(state, level);
          }
          if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
            _result += "-";
          } else {
            _result += "- ";
          }
          _result += state.dump;
        }
      }
      state.tag = _tag;
      state.dump = _result || "[]";
    }
    function writeFlowMapping(state, level, object) {
      var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, pairBuffer;
      for (index = 0, length = objectKeyList.length; index < length; index += 1) {
        pairBuffer = "";
        if (_result !== "") pairBuffer += ", ";
        if (state.condenseFlow) pairBuffer += '"';
        objectKey = objectKeyList[index];
        objectValue = object[objectKey];
        if (state.replacer) {
          objectValue = state.replacer.call(object, objectKey, objectValue);
        }
        if (!writeNode(state, level, objectKey, false, false)) {
          continue;
        }
        if (state.dump.length > 1024) pairBuffer += "? ";
        pairBuffer += state.dump + (state.condenseFlow ? '"' : "") + ":" + (state.condenseFlow ? "" : " ");
        if (!writeNode(state, level, objectValue, false, false)) {
          continue;
        }
        pairBuffer += state.dump;
        _result += pairBuffer;
      }
      state.tag = _tag;
      state.dump = "{" + _result + "}";
    }
    function writeBlockMapping(state, level, object, compact) {
      var _result = "", _tag = state.tag, objectKeyList = Object.keys(object), index, length, objectKey, objectValue, explicitPair, pairBuffer;
      if (state.sortKeys === true) {
        objectKeyList.sort();
      } else if (typeof state.sortKeys === "function") {
        objectKeyList.sort(state.sortKeys);
      } else if (state.sortKeys) {
        throw new YAMLException("sortKeys must be a boolean or a function");
      }
      for (index = 0, length = objectKeyList.length; index < length; index += 1) {
        pairBuffer = "";
        if (!compact || _result !== "") {
          pairBuffer += generateNextLine(state, level);
        }
        objectKey = objectKeyList[index];
        objectValue = object[objectKey];
        if (state.replacer) {
          objectValue = state.replacer.call(object, objectKey, objectValue);
        }
        if (!writeNode(state, level + 1, objectKey, true, true, true)) {
          continue;
        }
        explicitPair = state.tag !== null && state.tag !== "?" || state.dump && state.dump.length > 1024;
        if (explicitPair) {
          if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
            pairBuffer += "?";
          } else {
            pairBuffer += "? ";
          }
        }
        pairBuffer += state.dump;
        if (explicitPair) {
          pairBuffer += generateNextLine(state, level);
        }
        if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
          continue;
        }
        if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
          pairBuffer += ":";
        } else {
          pairBuffer += ": ";
        }
        pairBuffer += state.dump;
        _result += pairBuffer;
      }
      state.tag = _tag;
      state.dump = _result || "{}";
    }
    function detectType(state, object, explicit) {
      var _result, typeList, index, length, type, style;
      typeList = explicit ? state.explicitTypes : state.implicitTypes;
      for (index = 0, length = typeList.length; index < length; index += 1) {
        type = typeList[index];
        if ((type.instanceOf || type.predicate) && (!type.instanceOf || typeof object === "object" && object instanceof type.instanceOf) && (!type.predicate || type.predicate(object))) {
          if (explicit) {
            if (type.multi && type.representName) {
              state.tag = type.representName(object);
            } else {
              state.tag = type.tag;
            }
          } else {
            state.tag = "?";
          }
          if (type.represent) {
            style = state.styleMap[type.tag] || type.defaultStyle;
            if (_toString.call(type.represent) === "[object Function]") {
              _result = type.represent(object, style);
            } else if (_hasOwnProperty.call(type.represent, style)) {
              _result = type.represent[style](object, style);
            } else {
              throw new YAMLException("!<" + type.tag + '> tag resolver accepts not "' + style + '" style');
            }
            state.dump = _result;
          }
          return true;
        }
      }
      return false;
    }
    function writeNode(state, level, object, block, compact, iskey, isblockseq) {
      state.tag = null;
      state.dump = object;
      if (!detectType(state, object, false)) {
        detectType(state, object, true);
      }
      var type = _toString.call(state.dump);
      var inblock = block;
      var tagStr;
      if (block) {
        block = state.flowLevel < 0 || state.flowLevel > level;
      }
      var objectOrArray = type === "[object Object]" || type === "[object Array]", duplicateIndex, duplicate;
      if (objectOrArray) {
        duplicateIndex = state.duplicates.indexOf(object);
        duplicate = duplicateIndex !== -1;
      }
      if (state.tag !== null && state.tag !== "?" || duplicate || state.indent !== 2 && level > 0) {
        compact = false;
      }
      if (duplicate && state.usedDuplicates[duplicateIndex]) {
        state.dump = "*ref_" + duplicateIndex;
      } else {
        if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
          state.usedDuplicates[duplicateIndex] = true;
        }
        if (type === "[object Object]") {
          if (block && Object.keys(state.dump).length !== 0) {
            writeBlockMapping(state, level, state.dump, compact);
            if (duplicate) {
              state.dump = "&ref_" + duplicateIndex + state.dump;
            }
          } else {
            writeFlowMapping(state, level, state.dump);
            if (duplicate) {
              state.dump = "&ref_" + duplicateIndex + " " + state.dump;
            }
          }
        } else if (type === "[object Array]") {
          if (block && state.dump.length !== 0) {
            if (state.noArrayIndent && !isblockseq && level > 0) {
              writeBlockSequence(state, level - 1, state.dump, compact);
            } else {
              writeBlockSequence(state, level, state.dump, compact);
            }
            if (duplicate) {
              state.dump = "&ref_" + duplicateIndex + state.dump;
            }
          } else {
            writeFlowSequence(state, level, state.dump);
            if (duplicate) {
              state.dump = "&ref_" + duplicateIndex + " " + state.dump;
            }
          }
        } else if (type === "[object String]") {
          if (state.tag !== "?") {
            writeScalar(state, state.dump, level, iskey, inblock);
          }
        } else if (type === "[object Undefined]") {
          return false;
        } else {
          if (state.skipInvalid) return false;
          throw new YAMLException("unacceptable kind of an object to dump " + type);
        }
        if (state.tag !== null && state.tag !== "?") {
          tagStr = encodeURI(
            state.tag[0] === "!" ? state.tag.slice(1) : state.tag
          ).replace(/!/g, "%21");
          if (state.tag[0] === "!") {
            tagStr = "!" + tagStr;
          } else if (tagStr.slice(0, 18) === "tag:yaml.org,2002:") {
            tagStr = "!!" + tagStr.slice(18);
          } else {
            tagStr = "!<" + tagStr + ">";
          }
          state.dump = tagStr + " " + state.dump;
        }
      }
      return true;
    }
    function getDuplicateReferences(object, state) {
      var objects = [], duplicatesIndexes = [], index, length;
      inspectNode(object, objects, duplicatesIndexes);
      for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
        state.duplicates.push(objects[duplicatesIndexes[index]]);
      }
      state.usedDuplicates = new Array(length);
    }
    function inspectNode(object, objects, duplicatesIndexes) {
      var objectKeyList, index, length;
      if (object !== null && typeof object === "object") {
        index = objects.indexOf(object);
        if (index !== -1) {
          if (duplicatesIndexes.indexOf(index) === -1) {
            duplicatesIndexes.push(index);
          }
        } else {
          objects.push(object);
          if (Array.isArray(object)) {
            for (index = 0, length = object.length; index < length; index += 1) {
              inspectNode(object[index], objects, duplicatesIndexes);
            }
          } else {
            objectKeyList = Object.keys(object);
            for (index = 0, length = objectKeyList.length; index < length; index += 1) {
              inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
            }
          }
        }
      }
    }
    function dump(input, options) {
      options = options || {};
      var state = new State(options);
      if (!state.noRefs) getDuplicateReferences(input, state);
      var value = input;
      if (state.replacer) {
        value = state.replacer.call({ "": value }, "", value);
      }
      if (writeNode(state, 0, value, true, true)) return state.dump + "\n";
      return "";
    }
    module.exports.dump = dump;
  }
});

// src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/index.js
var require_js_yaml = __commonJS({
  "src/typespec/node_modules/.pnpm/js-yaml@4.1.0/node_modules/js-yaml/index.js"(exports5, module) {
    "use strict";
    var loader = require_loader();
    var dumper = require_dumper();
    function renamed(from, to) {
      return function() {
        throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
      };
    }
    module.exports.Type = require_type();
    module.exports.Schema = require_schema6();
    module.exports.FAILSAFE_SCHEMA = require_failsafe();
    module.exports.JSON_SCHEMA = require_json2();
    module.exports.CORE_SCHEMA = require_core5();
    module.exports.DEFAULT_SCHEMA = require_default();
    module.exports.load = loader.load;
    module.exports.loadAll = loader.loadAll;
    module.exports.dump = dumper.dump;
    module.exports.YAMLException = require_exception();
    module.exports.types = {
      binary: require_binary(),
      float: require_float(),
      map: require_map(),
      null: require_null(),
      pairs: require_pairs(),
      set: require_set(),
      timestamp: require_timestamp(),
      bool: require_bool(),
      int: require_int(),
      merge: require_merge(),
      omap: require_omap(),
      seq: require_seq(),
      str: require_str()
    };
    module.exports.safeLoad = renamed("safeLoad", "load");
    module.exports.safeLoadAll = renamed("safeLoadAll", "loadAll");
    module.exports.safeDump = renamed("safeDump", "dump");
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/yaml.js
var require_yaml = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/yaml.js"(exports5) {
    "use strict";
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    var errors_js_1 = require_errors2();
    var js_yaml_1 = __importDefault(require_js_yaml());
    var js_yaml_2 = require_js_yaml();
    exports5.default = {
      /**
       * The order that this parser will run, in relation to other parsers.
       */
      order: 200,
      /**
       * Whether to allow "empty" files. This includes zero-byte files, as well as empty JSON objects.
       */
      allowEmpty: true,
      /**
       * Determines whether this parser can parse a given file reference.
       * Parsers that match will be tried, in order, until one successfully parses the file.
       * Parsers that don't match will be skipped, UNLESS none of the parsers match, in which case
       * every parser will be tried.
       */
      canParse: [".yaml", ".yml", ".json"],
      // JSON is valid YAML
      /**
       * Parses the given file as YAML
       *
       * @param file           - An object containing information about the referenced file
       * @param file.url       - The full URL of the referenced file
       * @param file.extension - The lowercased file extension (e.g. ".txt", ".html", etc.)
       * @param file.data      - The file contents. This will be whatever data type was returned by the resolver
       * @returns
       */
      async parse(file) {
        let data = file.data;
        if (Buffer.isBuffer(data)) {
          data = data.toString();
        }
        if (typeof data === "string") {
          try {
            return js_yaml_1.default.load(data, { schema: js_yaml_2.JSON_SCHEMA });
          } catch (e) {
            throw new errors_js_1.ParserError(e?.message || "Parser Error", file.url);
          }
        } else {
          return data;
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js
var require_text = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/text.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var errors_js_1 = require_errors2();
    var TEXT_REGEXP = /\.(txt|htm|html|md|xml|js|min|map|css|scss|less|svg)$/i;
    exports5.default = {
      /**
       * The order that this parser will run, in relation to other parsers.
       */
      order: 300,
      /**
       * Whether to allow "empty" files (zero bytes).
       */
      allowEmpty: true,
      /**
       * The encoding that the text is expected to be in.
       */
      encoding: "utf8",
      /**
       * Determines whether this parser can parse a given file reference.
       * Parsers that return true will be tried, in order, until one successfully parses the file.
       * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case
       * every parser will be tried.
       */
      canParse(file) {
        return (typeof file.data === "string" || Buffer.isBuffer(file.data)) && TEXT_REGEXP.test(file.url);
      },
      /**
       * Parses the given file as text
       */
      parse(file) {
        if (typeof file.data === "string") {
          return file.data;
        } else if (Buffer.isBuffer(file.data)) {
          return file.data.toString(this.encoding);
        } else {
          throw new errors_js_1.ParserError("data is not text", file.url);
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js
var require_binary2 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/parsers/binary.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    var BINARY_REGEXP = /\.(jpeg|jpg|gif|png|bmp|ico)$/i;
    exports5.default = {
      /**
       * The order that this parser will run, in relation to other parsers.
       */
      order: 400,
      /**
       * Whether to allow "empty" files (zero bytes).
       */
      allowEmpty: true,
      /**
       * Determines whether this parser can parse a given file reference.
       * Parsers that return true will be tried, in order, until one successfully parses the file.
       * Parsers that return false will be skipped, UNLESS all parsers returned false, in which case
       * every parser will be tried.
       */
      canParse(file) {
        return Buffer.isBuffer(file.data) && BINARY_REGEXP.test(file.url);
      },
      /**
       * Parses the given data as a Buffer (byte array).
       */
      parse(file) {
        if (Buffer.isBuffer(file.data)) {
          return file.data;
        } else {
          return Buffer.from(file.data);
        }
      }
    };
  }
});

// node-modules-polyfills-empty:fs
var require_fs = __commonJS({
  "node-modules-polyfills-empty:fs"(exports5, module) {
    module.exports = {};
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/file.js
var require_file = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/file.js"(exports5) {
    "use strict";
    var __createBinding = exports5 && exports5.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports5 && exports5.__importStar || /* @__PURE__ */ (function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    })();
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    var fs_1 = __importDefault(require_fs());
    var url = __importStar(require_url());
    var errors_js_1 = require_errors2();
    exports5.default = {
      /**
       * The order that this resolver will run, in relation to other resolvers.
       */
      order: 100,
      /**
       * Determines whether this resolver can read a given file reference.
       * Resolvers that return true will be tried, in order, until one successfully resolves the file.
       * Resolvers that return false will not be given a chance to resolve the file.
       */
      canRead(file) {
        return url.isFileSystemPath(file.url);
      },
      /**
       * Reads the given file and returns its raw contents as a Buffer.
       */
      async read(file) {
        let path;
        try {
          path = url.toFileSystemPath(file.url);
        } catch (err) {
          const e = err;
          e.message = `Malformed URI: ${file.url}: ${e.message}`;
          throw new errors_js_1.ResolverError(e, file.url);
        }
        try {
          return await fs_1.default.promises.readFile(path);
        } catch (err) {
          const e = err;
          e.message = `Error opening file ${path}: ${e.message}`;
          throw new errors_js_1.ResolverError(e, path);
        }
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js
var require_http = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolvers/http.js"(exports5) {
    "use strict";
    var __createBinding = exports5 && exports5.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports5 && exports5.__importStar || /* @__PURE__ */ (function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    })();
    Object.defineProperty(exports5, "__esModule", { value: true });
    var url = __importStar(require_url());
    var errors_js_1 = require_errors2();
    exports5.default = {
      /**
       * The order that this resolver will run, in relation to other resolvers.
       */
      order: 200,
      /**
       * HTTP headers to send when downloading files.
       *
       * @example:
       * {
       *   "User-Agent": "JSON Schema $Ref Parser",
       *   Accept: "application/json"
       * }
       */
      headers: null,
      /**
       * HTTP request timeout (in milliseconds).
       */
      timeout: 6e4,
      // 60 seconds
      /**
       * The maximum number of HTTP redirects to follow.
       * To disable automatic following of redirects, set this to zero.
       */
      redirects: 5,
      /**
       * The `withCredentials` option of XMLHttpRequest.
       * Set this to `true` if you're downloading files from a CORS-enabled server that requires authentication
       */
      withCredentials: false,
      /**
       * Set this to `false` if you want to allow unsafe URLs (e.g., `127.0.0.1`, localhost, and other internal URLs).
       */
      safeUrlResolver: true,
      /**
       * Determines whether this resolver can read a given file reference.
       * Resolvers that return true will be tried in order, until one successfully resolves the file.
       * Resolvers that return false will not be given a chance to resolve the file.
       */
      canRead(file) {
        return url.isHttp(file.url) && (!this.safeUrlResolver || !url.isUnsafeUrl(file.url));
      },
      /**
       * Reads the given URL and returns its raw contents as a Buffer.
       */
      read(file) {
        const u = url.parse(file.url);
        if (typeof window !== "undefined" && !u.protocol) {
          u.protocol = url.parse(location.href).protocol;
        }
        return download(u, this);
      }
    };
    async function download(u, httpOptions, _redirects) {
      u = url.parse(u);
      const redirects = _redirects || [];
      redirects.push(u.href);
      try {
        const res = await get(u, httpOptions);
        if (res.status >= 400) {
          const error = new Error(`HTTP ERROR ${res.status}`);
          error.status = res.status;
          throw error;
        } else if (res.status >= 300) {
          if (!Number.isNaN(httpOptions.redirects) && redirects.length > httpOptions.redirects) {
            const error = new Error(`Error downloading ${redirects[0]}. 
Too many redirects: 
  ${redirects.join(" \n  ")}`);
            error.status = res.status;
            throw new errors_js_1.ResolverError(error);
          } else if (!("location" in res.headers) || !res.headers.location) {
            const error = new Error(`HTTP ${res.status} redirect with no location header`);
            error.status = res.status;
            throw error;
          } else {
            const redirectTo = url.resolve(u.href, res.headers.location);
            return download(redirectTo, httpOptions, redirects);
          }
        } else {
          if (res.body) {
            const buf = await res.arrayBuffer();
            return Buffer.from(buf);
          }
          return Buffer.alloc(0);
        }
      } catch (err) {
        const e = err;
        e.message = `Error downloading ${u.href}: ${e.message}`;
        throw new errors_js_1.ResolverError(e, u.href);
      }
    }
    async function get(u, httpOptions) {
      let controller;
      let timeoutId;
      if (httpOptions.timeout) {
        controller = new AbortController();
        timeoutId = setTimeout(() => controller.abort(), httpOptions.timeout);
      }
      const response = await fetch(u, {
        method: "GET",
        headers: httpOptions.headers || {},
        credentials: httpOptions.withCredentials ? "include" : "same-origin",
        signal: controller ? controller.signal : null
      });
      if (timeoutId) {
        clearTimeout(timeoutId);
      }
      return response;
    }
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js
var require_options = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/options.js"(exports5) {
    "use strict";
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.getNewOptions = exports5.getJsonSchemaRefParserDefaultOptions = void 0;
    var json_js_1 = __importDefault(require_json());
    var yaml_js_1 = __importDefault(require_yaml());
    var text_js_1 = __importDefault(require_text());
    var binary_js_1 = __importDefault(require_binary2());
    var file_js_1 = __importDefault(require_file());
    var http_js_1 = __importDefault(require_http());
    var getJsonSchemaRefParserDefaultOptions = () => {
      const defaults = {
        /**
         * Determines how different types of files will be parsed.
         *
         * You can add additional parsers of your own, replace an existing one with
         * your own implementation, or disable any parser by setting it to false.
         */
        parse: {
          json: { ...json_js_1.default },
          yaml: { ...yaml_js_1.default },
          text: { ...text_js_1.default },
          binary: { ...binary_js_1.default }
        },
        /**
         * Determines how JSON References will be resolved.
         *
         * You can add additional resolvers of your own, replace an existing one with
         * your own implementation, or disable any resolver by setting it to false.
         */
        resolve: {
          file: { ...file_js_1.default },
          http: { ...http_js_1.default },
          /**
           * Determines whether external $ref pointers will be resolved.
           * If this option is disabled, then none of above resolvers will be called.
           * Instead, external $ref pointers will simply be ignored.
           *
           * @type {boolean}
           */
          external: true
        },
        /**
         * By default, JSON Schema $Ref Parser throws the first error it encounters. Setting `continueOnError` to `true`
         * causes it to keep processing as much as possible and then throw a single error that contains all errors
         * that were encountered.
         */
        continueOnError: false,
        /**
         * Determines the types of JSON references that are allowed.
         */
        dereference: {
          /**
           * Dereference circular (recursive) JSON references?
           * If false, then a {@link ReferenceError} will be thrown if a circular reference is found.
           * If "ignore", then circular references will not be dereferenced.
           *
           * @type {boolean|string}
           */
          circular: true,
          /**
           * A function, called for each path, which can return true to stop this path and all
           * subpaths from being dereferenced further. This is useful in schemas where some
           * subpaths contain literal $ref keys that should not be dereferenced.
           *
           * @type {function}
           */
          excludedPathMatcher: () => false,
          referenceResolution: "relative"
        },
        mutateInputSchema: true
      };
      return defaults;
    };
    exports5.getJsonSchemaRefParserDefaultOptions = getJsonSchemaRefParserDefaultOptions;
    var getNewOptions = (options) => {
      const newOptions = (0, exports5.getJsonSchemaRefParserDefaultOptions)();
      if (options) {
        merge2(newOptions, options);
      }
      return newOptions;
    };
    exports5.getNewOptions = getNewOptions;
    function merge2(target, source) {
      if (isMergeable(source)) {
        const keys = Object.keys(source).filter((key) => !["__proto__", "constructor", "prototype"].includes(key));
        for (let i = 0; i < keys.length; i++) {
          const key = keys[i];
          const sourceSetting = source[key];
          const targetSetting = target[key];
          if (isMergeable(sourceSetting)) {
            target[key] = merge2(targetSetting || {}, sourceSetting);
          } else if (sourceSetting !== void 0) {
            target[key] = sourceSetting;
          }
        }
      }
      return target;
    }
    function isMergeable(val) {
      return val && typeof val === "object" && !Array.isArray(val) && !(val instanceof RegExp) && !(val instanceof Date);
    }
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/normalize-args.js
var require_normalize_args = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/normalize-args.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.normalizeArgs = normalizeArgs;
    var options_js_1 = require_options();
    function normalizeArgs(_args) {
      let path;
      let schema4;
      let options;
      let callback;
      const args = Array.prototype.slice.call(_args);
      if (typeof args[args.length - 1] === "function") {
        callback = args.pop();
      }
      if (typeof args[0] === "string") {
        path = args[0];
        if (typeof args[2] === "object") {
          schema4 = args[1];
          options = args[2];
        } else {
          schema4 = void 0;
          options = args[1];
        }
      } else {
        path = "";
        schema4 = args[0];
        options = args[1];
      }
      try {
        options = (0, options_js_1.getNewOptions)(options);
      } catch (e) {
        console.error(`JSON Schema Ref Parser: Error normalizing options: ${e}`);
      }
      if (!options.mutateInputSchema && typeof schema4 === "object") {
        schema4 = JSON.parse(JSON.stringify(schema4));
      }
      return {
        path,
        schema: schema4,
        options,
        callback
      };
    }
    exports5.default = normalizeArgs;
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolve-external.js
var require_resolve_external = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/resolve-external.js"(exports5) {
    "use strict";
    var __createBinding = exports5 && exports5.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports5 && exports5.__importStar || /* @__PURE__ */ (function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    })();
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    var ref_js_1 = __importDefault(require_ref2());
    var pointer_js_1 = __importDefault(require_pointer());
    var parse_js_1 = __importDefault(require_parse());
    var url = __importStar(require_url());
    var errors_js_1 = require_errors2();
    function resolveExternal(parser, options) {
      if (!options.resolve?.external) {
        return Promise.resolve();
      }
      try {
        const promises = crawl(parser.schema, parser.$refs._root$Ref.path + "#", parser.$refs, options);
        return Promise.all(promises);
      } catch (e) {
        return Promise.reject(e);
      }
    }
    function crawl(obj, path, $refs, options, seen, external) {
      seen || (seen = /* @__PURE__ */ new Set());
      let promises = [];
      if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !seen.has(obj)) {
        seen.add(obj);
        if (ref_js_1.default.isExternal$Ref(obj)) {
          promises.push(resolve$Ref(obj, path, $refs, options));
        }
        const keys = Object.keys(obj);
        for (const key of keys) {
          const keyPath = pointer_js_1.default.join(path, key);
          const value = obj[key];
          promises = promises.concat(crawl(value, keyPath, $refs, options, seen, external));
        }
      }
      return promises;
    }
    async function resolve$Ref($ref, path, $refs, options) {
      const shouldResolveOnCwd = options.dereference?.externalReferenceResolution === "root";
      const resolvedPath = url.resolve(shouldResolveOnCwd ? url.cwd() : path, $ref.$ref);
      const withoutHash = url.stripHash(resolvedPath);
      const ref = $refs._$refs[withoutHash];
      if (ref) {
        return Promise.resolve(ref.value);
      }
      try {
        const result = await (0, parse_js_1.default)(resolvedPath, $refs, options);
        const promises = crawl(result, withoutHash + "#", $refs, options, /* @__PURE__ */ new Set(), true);
        return Promise.all(promises);
      } catch (err) {
        if (!options?.continueOnError || !(0, errors_js_1.isHandledError)(err)) {
          throw err;
        }
        if ($refs._$refs[withoutHash]) {
          err.source = decodeURI(url.stripHash(path));
          err.path = url.safePointerToPath(url.getHash(path));
        }
        return [];
      }
    }
    exports5.default = resolveExternal;
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js
var require_bundle = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/bundle.js"(exports5) {
    "use strict";
    var __createBinding = exports5 && exports5.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports5 && exports5.__importStar || /* @__PURE__ */ (function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    })();
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    var ref_js_1 = __importDefault(require_ref2());
    var pointer_js_1 = __importDefault(require_pointer());
    var url = __importStar(require_url());
    function bundle(parser, options) {
      const inventory = [];
      crawl(parser, "schema", parser.$refs._root$Ref.path + "#", "#", 0, inventory, parser.$refs, options);
      remap(inventory);
    }
    function crawl(parent, key, path, pathFromRoot, indirections, inventory, $refs, options) {
      const obj = key === null ? parent : parent[key];
      if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj)) {
        if (ref_js_1.default.isAllowed$Ref(obj)) {
          inventory$Ref(parent, key, path, pathFromRoot, indirections, inventory, $refs, options);
        } else {
          const keys = Object.keys(obj).sort((a, b) => {
            if (a === "definitions" || a === "$defs") {
              return -1;
            } else if (b === "definitions" || b === "$defs") {
              return 1;
            } else {
              return a.length - b.length;
            }
          });
          for (const key2 of keys) {
            const keyPath = pointer_js_1.default.join(path, key2);
            const keyPathFromRoot = pointer_js_1.default.join(pathFromRoot, key2);
            const value = obj[key2];
            if (ref_js_1.default.isAllowed$Ref(value)) {
              inventory$Ref(obj, key2, path, keyPathFromRoot, indirections, inventory, $refs, options);
            } else {
              crawl(obj, key2, keyPath, keyPathFromRoot, indirections, inventory, $refs, options);
            }
          }
        }
      }
    }
    function inventory$Ref($refParent, $refKey, path, pathFromRoot, indirections, inventory, $refs, options) {
      const $ref = $refKey === null ? $refParent : $refParent[$refKey];
      const $refPath = url.resolve(path, $ref.$ref);
      const pointer = $refs._resolve($refPath, pathFromRoot, options);
      if (pointer === null) {
        return;
      }
      const parsed = pointer_js_1.default.parse(pathFromRoot);
      const depth = parsed.length;
      const file = url.stripHash(pointer.path);
      const hash = url.getHash(pointer.path);
      const external = file !== $refs._root$Ref.path;
      const extended = ref_js_1.default.isExtended$Ref($ref);
      indirections += pointer.indirections;
      const existingEntry = findInInventory(inventory, $refParent, $refKey);
      if (existingEntry) {
        if (depth < existingEntry.depth || indirections < existingEntry.indirections) {
          removeFromInventory(inventory, existingEntry);
        } else {
          return;
        }
      }
      inventory.push({
        $ref,
        // The JSON Reference (e.g. {$ref: string})
        parent: $refParent,
        // The object that contains this $ref pointer
        key: $refKey,
        // The key in `parent` that is the $ref pointer
        pathFromRoot,
        // The path to the $ref pointer, from the JSON Schema root
        depth,
        // How far from the JSON Schema root is this $ref pointer?
        file,
        // The file that the $ref pointer resolves to
        hash,
        // The hash within `file` that the $ref pointer resolves to
        value: pointer.value,
        // The resolved value of the $ref pointer
        circular: pointer.circular,
        // Is this $ref pointer DIRECTLY circular? (i.e. it references itself)
        extended,
        // Does this $ref extend its resolved value? (i.e. it has extra properties, in addition to "$ref")
        external,
        // Does this $ref pointer point to a file other than the main JSON Schema file?
        indirections
        // The number of indirect references that were traversed to resolve the value
      });
      if (!existingEntry || external) {
        crawl(pointer.value, null, pointer.path, pathFromRoot, indirections + 1, inventory, $refs, options);
      }
    }
    function remap(inventory) {
      inventory.sort((a, b) => {
        if (a.file !== b.file) {
          return a.file < b.file ? -1 : 1;
        } else if (a.hash !== b.hash) {
          return a.hash < b.hash ? -1 : 1;
        } else if (a.circular !== b.circular) {
          return a.circular ? -1 : 1;
        } else if (a.extended !== b.extended) {
          return a.extended ? 1 : -1;
        } else if (a.indirections !== b.indirections) {
          return a.indirections - b.indirections;
        } else if (a.depth !== b.depth) {
          return a.depth - b.depth;
        } else {
          const aDefinitionsIndex = Math.max(a.pathFromRoot.lastIndexOf("/definitions"), a.pathFromRoot.lastIndexOf("/$defs"));
          const bDefinitionsIndex = Math.max(b.pathFromRoot.lastIndexOf("/definitions"), b.pathFromRoot.lastIndexOf("/$defs"));
          if (aDefinitionsIndex !== bDefinitionsIndex) {
            return bDefinitionsIndex - aDefinitionsIndex;
          } else {
            return a.pathFromRoot.length - b.pathFromRoot.length;
          }
        }
      });
      let file, hash, pathFromRoot;
      for (const entry of inventory) {
        if (!entry.external) {
          entry.$ref.$ref = entry.hash;
        } else if (entry.file === file && entry.hash === hash) {
          entry.$ref.$ref = pathFromRoot;
        } else if (entry.file === file && entry.hash.indexOf(hash + "/") === 0) {
          entry.$ref.$ref = pointer_js_1.default.join(pathFromRoot, pointer_js_1.default.parse(entry.hash.replace(hash, "#")));
        } else {
          file = entry.file;
          hash = entry.hash;
          pathFromRoot = entry.pathFromRoot;
          entry.$ref = entry.parent[entry.key] = ref_js_1.default.dereference(entry.$ref, entry.value);
          if (entry.circular) {
            entry.$ref.$ref = entry.pathFromRoot;
          }
        }
      }
    }
    function findInInventory(inventory, $refParent, $refKey) {
      for (const existingEntry of inventory) {
        if (existingEntry && existingEntry.parent === $refParent && existingEntry.key === $refKey) {
          return existingEntry;
        }
      }
      return void 0;
    }
    function removeFromInventory(inventory, entry) {
      const index = inventory.indexOf(entry);
      inventory.splice(index, 1);
    }
    exports5.default = bundle;
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js
var require_dereference = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/dereference.js"(exports5) {
    "use strict";
    var __createBinding = exports5 && exports5.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports5 && exports5.__importStar || /* @__PURE__ */ (function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    })();
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    var ref_js_1 = __importDefault(require_ref2());
    var pointer_js_1 = __importDefault(require_pointer());
    var url = __importStar(require_url());
    var errors_1 = require_errors2();
    exports5.default = dereference;
    function dereference(parser, options) {
      const start = Date.now();
      const dereferenced = crawl(parser.schema, parser.$refs._root$Ref.path, "#", /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set(), /* @__PURE__ */ new Map(), parser.$refs, options, start);
      parser.$refs.circular = dereferenced.circular;
      parser.schema = dereferenced.value;
    }
    function crawl(obj, path, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime) {
      let dereferenced;
      const result = {
        value: obj,
        circular: false
      };
      checkDereferenceTimeout(startTime, options);
      const derefOptions = options.dereference || {};
      const isExcludedPath = derefOptions.excludedPathMatcher || (() => false);
      if (derefOptions?.circular === "ignore" || !processedObjects.has(obj)) {
        if (obj && typeof obj === "object" && !ArrayBuffer.isView(obj) && !isExcludedPath(pathFromRoot)) {
          parents.add(obj);
          processedObjects.add(obj);
          if (ref_js_1.default.isAllowed$Ref(obj, options)) {
            dereferenced = dereference$Ref(obj, path, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime);
            result.circular = dereferenced.circular;
            result.value = dereferenced.value;
          } else {
            for (const key of Object.keys(obj)) {
              checkDereferenceTimeout(startTime, options);
              const keyPath = pointer_js_1.default.join(path, key);
              const keyPathFromRoot = pointer_js_1.default.join(pathFromRoot, key);
              if (isExcludedPath(keyPathFromRoot)) {
                continue;
              }
              const value = obj[key];
              let circular = false;
              if (ref_js_1.default.isAllowed$Ref(value, options)) {
                dereferenced = dereference$Ref(value, keyPath, keyPathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime);
                circular = dereferenced.circular;
                if (obj[key] !== dereferenced.value) {
                  const preserved = /* @__PURE__ */ new Map();
                  if (derefOptions?.preservedProperties) {
                    if (typeof obj[key] === "object" && !Array.isArray(obj[key])) {
                      derefOptions?.preservedProperties.forEach((prop) => {
                        if (prop in obj[key]) {
                          preserved.set(prop, obj[key][prop]);
                        }
                      });
                    }
                  }
                  obj[key] = dereferenced.value;
                  if (derefOptions?.preservedProperties) {
                    if (preserved.size && typeof obj[key] === "object" && !Array.isArray(obj[key])) {
                      preserved.forEach((value2, prop) => {
                        obj[key][prop] = value2;
                      });
                    }
                  }
                  derefOptions?.onDereference?.(value.$ref, obj[key], obj, key);
                }
              } else {
                if (!parents.has(value)) {
                  dereferenced = crawl(value, keyPath, keyPathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime);
                  circular = dereferenced.circular;
                  if (obj[key] !== dereferenced.value) {
                    obj[key] = dereferenced.value;
                  }
                } else {
                  circular = foundCircularReference(keyPath, $refs, options);
                }
              }
              result.circular = result.circular || circular;
            }
          }
          parents.delete(obj);
        }
      }
      return result;
    }
    function dereference$Ref($ref, path, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime) {
      const isExternalRef = ref_js_1.default.isExternal$Ref($ref);
      const shouldResolveOnCwd = isExternalRef && options?.dereference?.externalReferenceResolution === "root";
      const $refPath = url.resolve(shouldResolveOnCwd ? url.cwd() : path, $ref.$ref);
      const cache = dereferencedCache.get($refPath);
      if (cache) {
        if (!cache.circular) {
          const refKeys = Object.keys($ref);
          if (refKeys.length > 1) {
            const extraKeys = {};
            for (const key of refKeys) {
              if (key !== "$ref" && !(key in cache.value)) {
                extraKeys[key] = $ref[key];
              }
            }
            return {
              circular: cache.circular,
              value: Object.assign({}, cache.value, extraKeys)
            };
          }
          return cache;
        }
        if (typeof cache.value === "object" && "$ref" in cache.value && "$ref" in $ref) {
          if (cache.value.$ref === $ref.$ref) {
            return cache;
          } else {
          }
        } else {
          return cache;
        }
      }
      const pointer = $refs._resolve($refPath, path, options);
      if (pointer === null) {
        return {
          circular: false,
          value: null
        };
      }
      const directCircular = pointer.circular;
      let circular = directCircular || parents.has(pointer.value);
      if (circular) {
        foundCircularReference(path, $refs, options);
      }
      let dereferencedValue = ref_js_1.default.dereference($ref, pointer.value);
      if (!circular) {
        const dereferenced = crawl(dereferencedValue, pointer.path, pathFromRoot, parents, processedObjects, dereferencedCache, $refs, options, startTime);
        circular = dereferenced.circular;
        dereferencedValue = dereferenced.value;
      }
      if (circular && !directCircular && options.dereference?.circular === "ignore") {
        dereferencedValue = $ref;
      }
      if (directCircular) {
        dereferencedValue.$ref = pathFromRoot;
      }
      const dereferencedObject = {
        circular,
        value: dereferencedValue
      };
      if (Object.keys($ref).length === 1) {
        dereferencedCache.set($refPath, dereferencedObject);
      }
      return dereferencedObject;
    }
    function checkDereferenceTimeout(startTime, options) {
      if (options && options.timeoutMs) {
        if (Date.now() - startTime > options.timeoutMs) {
          throw new errors_1.TimeoutError(options.timeoutMs);
        }
      }
    }
    function foundCircularReference(keyPath, $refs, options) {
      $refs.circular = true;
      options?.dereference?.onCircular?.(keyPath);
      if (!options.dereference.circular) {
        const error = new ReferenceError(`Circular $ref pointer found at ${keyPath}`);
        throw error;
      }
      return true;
    }
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/next.js
var require_next2 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/next.js"(exports5) {
    "use strict";
    Object.defineProperty(exports5, "__esModule", { value: true });
    function makeNext() {
      if (typeof process === "object" && typeof process.nextTick === "function") {
        return process.nextTick;
      } else if (typeof setImmediate === "function") {
        return setImmediate;
      } else {
        return function next(f) {
          setTimeout(f, 0);
        };
      }
    }
    exports5.default = makeNext();
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/maybe.js
var require_maybe = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/util/maybe.js"(exports5) {
    "use strict";
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.default = maybe;
    var next_js_1 = __importDefault(require_next2());
    function maybe(cb, promise) {
      if (cb) {
        promise.then(function(result) {
          (0, next_js_1.default)(function() {
            cb(null, result);
          });
        }, function(err) {
          (0, next_js_1.default)(function() {
            cb(err);
          });
        });
        return void 0;
      } else {
        return promise;
      }
    }
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js
var require_lib3 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+json-schema-ref-parser@14.0.1/node_modules/@apidevtools/json-schema-ref-parser/dist/lib/index.js"(exports5) {
    "use strict";
    var __createBinding = exports5 && exports5.__createBinding || (Object.create ? (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      var desc = Object.getOwnPropertyDescriptor(m, k);
      if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
        desc = { enumerable: true, get: function() {
          return m[k];
        } };
      }
      Object.defineProperty(o, k2, desc);
    }) : (function(o, m, k, k2) {
      if (k2 === void 0) k2 = k;
      o[k2] = m[k];
    }));
    var __setModuleDefault = exports5 && exports5.__setModuleDefault || (Object.create ? (function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    }) : function(o, v) {
      o["default"] = v;
    });
    var __importStar = exports5 && exports5.__importStar || /* @__PURE__ */ (function() {
      var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function(o2) {
          var ar = [];
          for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
          return ar;
        };
        return ownKeys(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        }
        __setModuleDefault(result, mod);
        return result;
      };
    })();
    var __importDefault = exports5 && exports5.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports5, "__esModule", { value: true });
    exports5.isUnsafeUrl = exports5.$Refs = exports5.getJsonSchemaRefParserDefaultOptions = exports5.jsonSchemaParserNormalizeArgs = exports5.dereferenceInternal = exports5.JSONParserErrorGroup = exports5.isHandledError = exports5.UnmatchedParserError = exports5.ParserError = exports5.ResolverError = exports5.MissingPointerError = exports5.InvalidPointerError = exports5.JSONParserError = exports5.UnmatchedResolverError = exports5.dereference = exports5.bundle = exports5.resolve = exports5.parse = exports5.$RefParser = void 0;
    var refs_js_1 = __importDefault(require_refs());
    exports5.$Refs = refs_js_1.default;
    var parse_js_1 = __importDefault(require_parse());
    var normalize_args_js_1 = __importDefault(require_normalize_args());
    exports5.jsonSchemaParserNormalizeArgs = normalize_args_js_1.default;
    var resolve_external_js_1 = __importDefault(require_resolve_external());
    var bundle_js_1 = __importDefault(require_bundle());
    var dereference_js_1 = __importDefault(require_dereference());
    exports5.dereferenceInternal = dereference_js_1.default;
    var url = __importStar(require_url());
    var errors_js_1 = require_errors2();
    Object.defineProperty(exports5, "JSONParserError", { enumerable: true, get: function() {
      return errors_js_1.JSONParserError;
    } });
    Object.defineProperty(exports5, "InvalidPointerError", { enumerable: true, get: function() {
      return errors_js_1.InvalidPointerError;
    } });
    Object.defineProperty(exports5, "MissingPointerError", { enumerable: true, get: function() {
      return errors_js_1.MissingPointerError;
    } });
    Object.defineProperty(exports5, "ResolverError", { enumerable: true, get: function() {
      return errors_js_1.ResolverError;
    } });
    Object.defineProperty(exports5, "ParserError", { enumerable: true, get: function() {
      return errors_js_1.ParserError;
    } });
    Object.defineProperty(exports5, "UnmatchedParserError", { enumerable: true, get: function() {
      return errors_js_1.UnmatchedParserError;
    } });
    Object.defineProperty(exports5, "UnmatchedResolverError", { enumerable: true, get: function() {
      return errors_js_1.UnmatchedResolverError;
    } });
    Object.defineProperty(exports5, "isHandledError", { enumerable: true, get: function() {
      return errors_js_1.isHandledError;
    } });
    Object.defineProperty(exports5, "JSONParserErrorGroup", { enumerable: true, get: function() {
      return errors_js_1.JSONParserErrorGroup;
    } });
    var maybe_js_1 = __importDefault(require_maybe());
    var options_js_1 = require_options();
    Object.defineProperty(exports5, "getJsonSchemaRefParserDefaultOptions", { enumerable: true, get: function() {
      return options_js_1.getJsonSchemaRefParserDefaultOptions;
    } });
    var url_js_1 = require_url();
    Object.defineProperty(exports5, "isUnsafeUrl", { enumerable: true, get: function() {
      return url_js_1.isUnsafeUrl;
    } });
    var $RefParser = class _$RefParser {
      constructor() {
        this.schema = null;
        this.$refs = new refs_js_1.default();
      }
      async parse() {
        const args = (0, normalize_args_js_1.default)(arguments);
        let promise;
        if (!args.path && !args.schema) {
          const err = new Error(`Expected a file path, URL, or object. Got ${args.path || args.schema}`);
          return (0, maybe_js_1.default)(args.callback, Promise.reject(err));
        }
        this.schema = null;
        this.$refs = new refs_js_1.default();
        let pathType = "http";
        if (url.isFileSystemPath(args.path)) {
          args.path = url.fromFileSystemPath(args.path);
          pathType = "file";
        } else if (!args.path && args.schema && "$id" in args.schema && args.schema.$id) {
          const params = url.parse(args.schema.$id);
          const port = params.protocol === "https:" ? 443 : 80;
          args.path = `${params.protocol}//${params.hostname}:${port}`;
        }
        args.path = url.resolve(url.cwd(), args.path);
        if (args.schema && typeof args.schema === "object") {
          const $ref = this.$refs._add(args.path);
          $ref.value = args.schema;
          $ref.pathType = pathType;
          promise = Promise.resolve(args.schema);
        } else {
          promise = (0, parse_js_1.default)(args.path, this.$refs, args.options);
        }
        try {
          const result = await promise;
          if (result !== null && typeof result === "object" && !Buffer.isBuffer(result)) {
            this.schema = result;
            return (0, maybe_js_1.default)(args.callback, Promise.resolve(this.schema));
          } else if (args.options.continueOnError) {
            this.schema = null;
            return (0, maybe_js_1.default)(args.callback, Promise.resolve(this.schema));
          } else {
            throw new SyntaxError(`"${this.$refs._root$Ref.path || result}" is not a valid JSON Schema`);
          }
        } catch (err) {
          if (!args.options.continueOnError || !(0, errors_js_1.isHandledError)(err)) {
            return (0, maybe_js_1.default)(args.callback, Promise.reject(err));
          }
          if (this.$refs._$refs[url.stripHash(args.path)]) {
            this.$refs._$refs[url.stripHash(args.path)].addError(err);
          }
          return (0, maybe_js_1.default)(args.callback, Promise.resolve(null));
        }
      }
      static parse() {
        const parser = new _$RefParser();
        return parser.parse.apply(parser, arguments);
      }
      async resolve() {
        const args = (0, normalize_args_js_1.default)(arguments);
        try {
          await this.parse(args.path, args.schema, args.options);
          await (0, resolve_external_js_1.default)(this, args.options);
          finalize(this);
          return (0, maybe_js_1.default)(args.callback, Promise.resolve(this.$refs));
        } catch (err) {
          return (0, maybe_js_1.default)(args.callback, Promise.reject(err));
        }
      }
      static resolve() {
        const instance = new _$RefParser();
        return instance.resolve.apply(instance, arguments);
      }
      static bundle() {
        const instance = new _$RefParser();
        return instance.bundle.apply(instance, arguments);
      }
      async bundle() {
        const args = (0, normalize_args_js_1.default)(arguments);
        try {
          await this.resolve(args.path, args.schema, args.options);
          (0, bundle_js_1.default)(this, args.options);
          finalize(this);
          return (0, maybe_js_1.default)(args.callback, Promise.resolve(this.schema));
        } catch (err) {
          return (0, maybe_js_1.default)(args.callback, Promise.reject(err));
        }
      }
      static dereference() {
        const instance = new _$RefParser();
        return instance.dereference.apply(instance, arguments);
      }
      async dereference() {
        const args = (0, normalize_args_js_1.default)(arguments);
        try {
          await this.resolve(args.path, args.schema, args.options);
          (0, dereference_js_1.default)(this, args.options);
          finalize(this);
          return (0, maybe_js_1.default)(args.callback, Promise.resolve(this.schema));
        } catch (err) {
          return (0, maybe_js_1.default)(args.callback, Promise.reject(err));
        }
      }
    };
    exports5.$RefParser = $RefParser;
    exports5.default = $RefParser;
    function finalize(parser) {
      const errors = errors_js_1.JSONParserErrorGroup.getParserErrors(parser);
      if (errors.length > 0) {
        throw new errors_js_1.JSONParserErrorGroup(parser);
      }
    }
    exports5.parse = $RefParser.parse;
    exports5.resolve = $RefParser.resolve;
    exports5.bundle = $RefParser.bundle;
    exports5.dereference = $RefParser.dereference;
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+swagger-parser@12.0.0_openapi-types@12.1.3/node_modules/@apidevtools/swagger-parser/lib/options.js
var require_options2 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+swagger-parser@12.0.0_openapi-types@12.1.3/node_modules/@apidevtools/swagger-parser/lib/options.js"(exports5, module) {
    "use strict";
    var { getJsonSchemaRefParserDefaultOptions } = require_lib3();
    var schemaValidator = require_schema5();
    var specValidator = require_spec();
    module.exports = ParserOptions;
    function merge2(target, source) {
      if (isMergeable(source)) {
        const keys = Object.keys(source).filter((key) => !["__proto__", "constructor", "prototype"].includes(key));
        for (let i = 0; i < keys.length; i++) {
          const key = keys[i];
          const sourceSetting = source[key];
          const targetSetting = target[key];
          if (isMergeable(sourceSetting)) {
            target[key] = merge2(targetSetting || {}, sourceSetting);
          } else if (sourceSetting !== void 0) {
            target[key] = sourceSetting;
          }
        }
      }
      return target;
    }
    function isMergeable(val) {
      return val && typeof val === "object" && !Array.isArray(val) && !(val instanceof RegExp) && !(val instanceof Date);
    }
    function ParserOptions(_options) {
      const defaultOptions2 = getJsonSchemaRefParserDefaultOptions();
      const options = merge2(defaultOptions2, ParserOptions.defaults);
      return merge2(options, _options);
    }
    ParserOptions.defaults = {
      /**
       * Determines how the API definition will be validated.
       *
       * You can add additional validators of your own, replace an existing one with
       * your own implemenation, or disable any validator by setting it to false.
       */
      validate: {
        schema: schemaValidator,
        spec: specValidator
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/call-me-maybe@1.0.2/node_modules/call-me-maybe/src/next.js
var require_next3 = __commonJS({
  "src/typespec/node_modules/.pnpm/call-me-maybe@1.0.2/node_modules/call-me-maybe/src/next.js"(exports5, module) {
    "use strict";
    function makeNext() {
      if (typeof process === "object" && typeof process.nextTick === "function") {
        return process.nextTick;
      } else if (typeof setImmediate === "function") {
        return setImmediate;
      } else {
        return function next(f) {
          setTimeout(f, 0);
        };
      }
    }
    module.exports = makeNext();
  }
});

// src/typespec/node_modules/.pnpm/call-me-maybe@1.0.2/node_modules/call-me-maybe/src/maybe.js
var require_maybe2 = __commonJS({
  "src/typespec/node_modules/.pnpm/call-me-maybe@1.0.2/node_modules/call-me-maybe/src/maybe.js"(exports5, module) {
    "use strict";
    var next = require_next3();
    module.exports = function maybe(cb, promise) {
      if (cb) {
        promise.then(function(result) {
          next(function() {
            cb(null, result);
          });
        }, function(err) {
          next(function() {
            cb(err);
          });
        });
        return void 0;
      } else {
        return promise;
      }
    };
  }
});

// src/typespec/node_modules/.pnpm/@apidevtools+swagger-parser@12.0.0_openapi-types@12.1.3/node_modules/@apidevtools/swagger-parser/lib/index.js
var require_lib4 = __commonJS({
  "src/typespec/node_modules/.pnpm/@apidevtools+swagger-parser@12.0.0_openapi-types@12.1.3/node_modules/@apidevtools/swagger-parser/lib/index.js"(exports5, module) {
    "use strict";
    var validateSchema = require_schema5();
    var validateSpec = require_spec();
    var {
      jsonSchemaParserNormalizeArgs: normalizeArgs,
      dereferenceInternal: dereference,
      $RefParser
    } = require_lib3();
    var util = require_util();
    var Options = require_options2();
    var maybe = require_maybe2();
    var supported31Versions = ["3.1.0", "3.1.1"];
    var supported30Versions = ["3.0.0", "3.0.1", "3.0.2", "3.0.3", "3.0.4"];
    var supportedVersions = [...supported31Versions, ...supported30Versions];
    var SwaggerParser = class extends $RefParser {
      /**
       * Parses the given Swagger API.
       * This method does not resolve any JSON references.
       * It just reads a single file in JSON or YAML format, and parse it as a JavaScript object.
       *
       * @param {string} [path] - The file path or URL of the JSON schema
       * @param {object} [api] - The Swagger API object. This object will be used instead of reading from `path`.
       * @param {ParserOptions} [options] - Options that determine how the API is parsed
       * @param {Function} [callback] - An error-first callback. The second parameter is the parsed API object.
       * @returns {Promise} - The returned promise resolves with the parsed API object.
       */
      async parse(path, api, options, callback) {
        let args = normalizeArgs(arguments);
        args.options = new Options(args.options);
        try {
          let schema4 = await super.parse(args.path, args.schema, args.options);
          if (schema4.swagger) {
            if (typeof schema4.swagger === "number") {
              throw new SyntaxError('Swagger version number must be a string (e.g. "2.0") not a number.');
            } else if (schema4.info && typeof schema4.info.version === "number") {
              throw new SyntaxError('API version number must be a string (e.g. "1.0.0") not a number.');
            } else if (schema4.swagger !== "2.0") {
              throw new SyntaxError(`Unrecognized Swagger version: ${schema4.swagger}. Expected 2.0`);
            }
          } else {
            if (schema4.paths === void 0) {
              if (supported31Versions.indexOf(schema4.openapi) !== -1) {
                if (schema4.webhooks === void 0) {
                  throw new SyntaxError(`${args.path || args.schema} is not a valid Openapi API definition`);
                }
              } else {
                throw new SyntaxError(`${args.path || args.schema} is not a valid Openapi API definition`);
              }
            } else if (typeof schema4.openapi === "number") {
              throw new SyntaxError('Openapi version number must be a string (e.g. "3.0.0") not a number.');
            } else if (schema4.info && typeof schema4.info.version === "number") {
              throw new SyntaxError('API version number must be a string (e.g. "1.0.0") not a number.');
            } else if (supportedVersions.indexOf(schema4.openapi) === -1) {
              throw new SyntaxError(
                `Unsupported OpenAPI version: ${schema4.openapi}. Swagger Parser only supports versions ${supportedVersions.join(", ")}`
              );
            }
            util.fixOasRelativeServers(schema4, args.path);
          }
          return maybe(args.callback, Promise.resolve(schema4));
        } catch (err) {
          return maybe(args.callback, Promise.reject(err));
        }
      }
      /**
       * Parses, dereferences, and validates the given Swagger API.
       * Depending on the options, validation can include JSON Schema validation and/or Swagger Spec validation.
       *
       * @param {string} [path] - The file path or URL of the JSON schema
       * @param {object} [api] - The Swagger API object. This object will be used instead of reading from `path`.
       * @param {ParserOptions} [options] - Options that determine how the API is parsed, dereferenced, and validated
       * @param {Function} [callback] - An error-first callback. The second parameter is the parsed API object.
       * @returns {Promise} - The returned promise resolves with the parsed API object.
       */
      async validate(path, api, options, callback) {
        let me = this;
        let args = normalizeArgs(arguments);
        args.options = new Options(args.options);
        let circular$RefOption = args.options.dereference.circular;
        args.options.validate.schema && (args.options.dereference.circular = "ignore");
        try {
          await this.dereference(args.path, args.schema, args.options);
          args.options.dereference.circular = circular$RefOption;
          if (args.options.validate.schema) {
            validateSchema(me.api);
            if (me.$refs.circular) {
              if (circular$RefOption === true) {
                dereference(me, args.options);
              } else if (circular$RefOption === false) {
                throw new ReferenceError("The API contains circular references");
              }
            }
          }
          if (args.options.validate.spec) {
            validateSpec(me.api);
          }
          return maybe(args.callback, Promise.resolve(me.schema));
        } catch (err) {
          return maybe(args.callback, Promise.reject(err));
        }
      }
    };
    Object.defineProperty(SwaggerParser.prototype, "api", {
      configurable: true,
      enumerable: true,
      get() {
        return this.schema;
      }
    });
    var defaultExport = SwaggerParser;
    defaultExport.validate = (...args) => {
      const defaultInstance = new SwaggerParser();
      return defaultInstance.validate(...args);
    };
    defaultExport.dereference = (...args) => {
      const defaultInstance = new SwaggerParser();
      return defaultInstance.dereference(...args);
    };
    defaultExport.bundle = (...args) => {
      const defaultInstance = new SwaggerParser();
      return defaultInstance.bundle(...args);
    };
    defaultExport.parse = (...args) => {
      const defaultInstance = new SwaggerParser();
      return defaultInstance.parse(...args);
    };
    defaultExport.resolve = (...args) => {
      const defaultInstance = new SwaggerParser();
      return defaultInstance.resolve(...args);
    };
    defaultExport.default = defaultExport;
    defaultExport.SwaggerParser = defaultExport;
    module.exports = defaultExport;
  }
});

// src/typespec/core/packages/openapi3/dist/src/index.js
var src_exports = {};
__export(src_exports, {
  $decorators: () => $decorators,
  $lib: () => $lib,
  $onEmit: () => $onEmit,
  $oneOf: () => $oneOf,
  $useRef: () => $useRef,
  convertOpenAPI3Document: () => convertOpenAPI3Document,
  getOneOf: () => getOneOf,
  getOpenAPI3: () => getOpenAPI3,
  getRef: () => getRef,
  namespace: () => namespace,
  resolveOptions: () => resolveOptions
});

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/convert.js
var import_swagger_parser = __toESM(require_lib4(), 1);
import { formatTypeSpec } from "@typespec/compiler";

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/utils/supported-http-methods.js
var supportedHttpMethods = /* @__PURE__ */ new Set([
  "delete",
  "get",
  "head",
  "patch",
  "post",
  "put"
]);

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/utils/generate-helpers.js
function generateHelpers(context) {
  const helpers = [];
  if (usesDefaultResponse(context)) {
    helpers.push(DEFAULT_RESPONSE_TEMPLATE);
  }
  if (helpers.length) {
    return `namespace GeneratedHelpers {
${helpers.join("\n")}
}`;
  }
  return "";
}
var DEFAULT_RESPONSE_TEMPLATE = `
@doc(Description)
@error
model DefaultResponse<Description extends valueof string = "", Body = void, Headers extends {} = {}> {
  @body body: Body;
  ...Headers;
}
`.trim();
function usesDefaultResponse(context) {
  const doc = context.openApi3Doc;
  for (const [statusCode] of Object.keys(doc.components?.responses ?? {})) {
    if (statusCode === "default")
      return true;
  }
  for (const pathItem of Object.values(doc.paths)) {
    for (const method of supportedHttpMethods) {
      const operation = pathItem[method];
      if (!operation)
        continue;
      for (const statusCode of Object.keys(operation.responses ?? {})) {
        if (statusCode === "default")
          return true;
      }
    }
  }
  return false;
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-model.js
import { printIdentifier as printIdentifier4 } from "@typespec/compiler";

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/utils/decorators.js
import { printIdentifier } from "@typespec/compiler";
var validLocations = ["header", "query", "path"];
var extensionDecoratorName = "extension";
function getExtensions(element) {
  const decorators = [];
  for (const key of Object.keys(element)) {
    if (isExtensionKey(key)) {
      decorators.push({
        name: extensionDecoratorName,
        args: [key, normalizeObjectValue(element[key])]
      });
    }
  }
  return decorators;
}
function normalizeObjectValue(source) {
  if (typeof source === "object") {
    const result = createTSValueFromObjectValue(source);
    if (result) {
      return result;
    }
  }
  return source;
}
function isExtensionKey(key) {
  return key.startsWith("x-");
}
function getParameterDecorators(parameter) {
  const decorators = [];
  decorators.push(...getExtensions(parameter));
  decorators.push(...getDecoratorsForSchema(parameter.schema));
  const locationDecorator = getLocationDecorator(parameter);
  if (locationDecorator)
    decorators.push(locationDecorator);
  return decorators;
}
function getLocationDecorator(parameter) {
  if (!validLocations.includes(parameter.in))
    return;
  const decorator = {
    name: parameter.in,
    args: []
  };
  let decoratorArgs;
  switch (parameter.in) {
    case "header":
      decoratorArgs = getHeaderArgs(parameter);
      break;
    case "query":
      decoratorArgs = getQueryArgs(parameter);
      break;
  }
  if (decoratorArgs) {
    decorator.args.push(decoratorArgs);
  }
  return decorator;
}
function createTSValueFromObjectValue(value) {
  if (Object.keys(value).length || Array.isArray(value)) {
    return {
      __kind: "value",
      value: normalizeObjectValueToTSValueExpression(value)
    };
  }
  return void 0;
}
function normalizeObjectValueToTSValueExpression(value) {
  if (typeof value === "object" && !Array.isArray(value)) {
    return `#{${Object.entries(value).map(([key, v]) => {
      return `${printIdentifier(key, "disallow-reserved")}: ${normalizeObjectValueToTSValueExpression(v)}`;
    }).join(", ")}}`;
  } else if (Array.isArray(value)) {
    return `#[${value.map((v) => normalizeObjectValueToTSValueExpression(v)).join(", ")}]`;
  } else
    return `${JSON.stringify(value)}`;
}
function getQueryArgs(parameter) {
  const queryOptions = getNormalizedQueryOptions(parameter);
  return createTSValueFromObjectValue(queryOptions);
}
function getNormalizedQueryOptions({ explode, style = "" }) {
  const queryOptions = {};
  if (typeof explode !== "boolean") {
    if (style === "form" || !style) {
      explode = true;
    } else {
      explode = false;
    }
  }
  if (style === "spaceDelimited") {
    queryOptions.format = "ssv";
  } else if (style === "pipeDelimited") {
    queryOptions.format = "pipes";
  }
  if (!explode && queryOptions.format) {
    queryOptions.explode = false;
  } else if (explode) {
    queryOptions.explode = true;
  }
  return queryOptions;
}
function getHeaderArgs({ explode }) {
  if (explode === true) {
    return createTSValue(`#{ explode: true }`);
  }
  return void 0;
}
function getDecoratorsForSchema(schema4) {
  const decorators = [];
  if ("$ref" in schema4) {
    return decorators;
  }
  decorators.push(...getExtensions(schema4));
  switch (schema4.type) {
    case "array":
      decorators.push(...getArraySchemaDecorators(schema4));
      break;
    case "integer":
    case "number":
      decorators.push(...getNumberSchemaDecorators(schema4));
      break;
    case "string":
      decorators.push(...getStringSchemaDecorators(schema4));
      break;
    default:
      break;
  }
  if (schema4.title) {
    decorators.push({ name: "summary", args: [schema4.title] });
  }
  if (schema4.discriminator) {
    if (schema4.oneOf || schema4.anyOf) {
      decorators.push({
        name: "discriminated",
        args: [
          createTSValue(`#{ envelope: "none", discriminatorPropertyName: ${JSON.stringify(schema4.discriminator.propertyName)} }`)
        ]
      });
    } else {
      decorators.push({ name: "discriminator", args: [schema4.discriminator.propertyName] });
    }
  }
  if (schema4.oneOf) {
    decorators.push(...getOneOfSchemaDecorators(schema4));
  }
  return decorators;
}
function createTSValue(value) {
  return { __kind: "value", value };
}
function getOneOfSchemaDecorators(schema4) {
  return [{ name: "oneOf", args: [] }];
}
function getArraySchemaDecorators(schema4) {
  const decorators = [];
  if (typeof schema4.minItems === "number") {
    decorators.push({ name: "minItems", args: [schema4.minItems] });
  }
  if (typeof schema4.maxItems === "number") {
    decorators.push({ name: "maxItems", args: [schema4.maxItems] });
  }
  return decorators;
}
function getNumberSchemaDecorators(schema4) {
  const decorators = [];
  if (typeof schema4.minimum === "number") {
    if (schema4.exclusiveMinimum) {
      decorators.push({ name: "minValueExclusive", args: [schema4.minimum] });
    } else {
      decorators.push({ name: "minValue", args: [schema4.minimum] });
    }
  }
  if (typeof schema4.maximum === "number") {
    if (schema4.exclusiveMaximum) {
      decorators.push({ name: "maxValueExclusive", args: [schema4.maximum] });
    } else {
      decorators.push({ name: "maxValue", args: [schema4.maximum] });
    }
  }
  return decorators;
}
var knownStringFormats = /* @__PURE__ */ new Set([
  "binary",
  "byte",
  "date",
  "date-time",
  "time",
  "duration",
  "uri"
]);
function getStringSchemaDecorators(schema4) {
  const decorators = [];
  if (typeof schema4.minLength === "number") {
    decorators.push({ name: "minLength", args: [schema4.minLength] });
  }
  if (typeof schema4.maxLength === "number") {
    decorators.push({ name: "maxLength", args: [schema4.maxLength] });
  }
  if (typeof schema4.pattern === "string") {
    decorators.push({ name: "pattern", args: [escapeRegex(schema4.pattern)] });
  }
  if (typeof schema4.format === "string" && !knownStringFormats.has(schema4.format)) {
    decorators.push({ name: "format", args: [schema4.format] });
  }
  return decorators;
}
function escapeRegex(str) {
  return str.replace(/\\/g, "\\\\");
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/utils/docs.js
function generateDocs(doc) {
  if (isEmptyDoc(doc)) {
    return ``;
  }
  const split = splitNewlines(doc);
  for (let i = 0; i < split.length; i++) {
    if (split[i].includes("@") || split[i].includes("*/")) {
      if (split.length === 1) {
        return `@doc("${split[0].replace(/\\/g, "\\\\").replace(/"/g, '\\"')}")`;
      }
      return `@doc("""
${split.join("\n").replace(/\\/g, "\\\\").replace(/"/g, '\\"')}
""")`;
    }
  }
  return `/**
* ${split.join("\n* ")}
*/`;
}
function splitNewlines(doc) {
  let docString = Array.isArray(doc) ? doc.join("\n") : doc;
  docString = docString.replace(/\r\n/g, "\n");
  docString = docString.replace(/\r/g, "\n");
  if (!docString.includes("\n")) {
    return [docString];
  }
  return docString.split("\n");
}
function isEmptyDoc(doc) {
  if (!doc) {
    return true;
  }
  if (Array.isArray(doc) && !doc.length) {
    return true;
  }
  return false;
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-decorators.js
function generateDecorator({ name, args }) {
  const hasArgs = args.length;
  const stringifiedArguments = hasArgs ? `(${args.map((a) => isTSValue(a) ? a.value : JSON.stringify(a)).join(", ")})` : "";
  return `@${name}${stringifiedArguments}`;
}
function generateDecorators(decorators, namesToExclude = []) {
  const uniqueDecorators = new Set(decorators.filter((d) => !namesToExclude.includes(d.name)).map(generateDecorator));
  return Array.from(uniqueDecorators);
}
function isTSValue(value) {
  return Boolean(value && typeof value === "object" && "__kind" in value && value["__kind"] === "value");
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-types.js
import { printIdentifier as printIdentifier3 } from "@typespec/compiler";

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/utils/get-scope-and-name.js
import { printIdentifier as printIdentifier2 } from "@typespec/compiler";
function getScopeAndName(originalName) {
  const path = originalName.split(".");
  const name = path.pop();
  return { scope: path.map((x) => printIdentifier2(x)), name: printIdentifier2(name), rawName: name };
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-types.js
var SchemaToExpressionGenerator = class _SchemaToExpressionGenerator {
  rootNamespace;
  constructor(rootNamespace) {
    this.rootNamespace = rootNamespace;
  }
  generateTypeFromRefableSchema(schema4, callingScope, isHttpPart = false, encoding, context) {
    const hasRef = "$ref" in schema4;
    return hasRef ? this.getRefName(schema4.$ref, callingScope) : this.getTypeFromSchema(schema4, callingScope, isHttpPart, encoding, context);
  }
  generateArrayType(schema4, callingScope) {
    const items = schema4.items;
    if (!items) {
      return "unknown[]";
    }
    if ("$ref" in items) {
      return `${this.getRefName(items.$ref, callingScope)}[]`;
    }
    return `(${this.getTypeFromSchema(items, callingScope)})[]`;
  }
  getRefName(ref, callingScope) {
    const { scope, name } = this.getRefScopeAndName(ref, callingScope);
    return [...scope, name].join(".");
  }
  getRefScopeAndName(ref, callingScope) {
    const parts = ref.split("/");
    const name = parts.pop() ?? "";
    const componentType = parts.pop()?.toLowerCase() ?? "";
    const scopeAndName = getScopeAndName(name);
    switch (componentType) {
      case "schemas":
        if (callingScope.length) {
          scopeAndName.scope.unshift(this.rootNamespace);
        }
        break;
      case "parameters":
        scopeAndName.scope.unshift("Parameters");
        break;
    }
    return scopeAndName;
  }
  getTypeFromSchema(schema4, callingScope, isHttpPart = false, encoding, context) {
    let type = "unknown";
    if (schema4.const !== void 0) {
      type = JSON.stringify(schema4.const);
    } else if (schema4.enum) {
      type = getEnum(schema4.enum);
    } else if (schema4.anyOf?.length) {
      type = this.getAnyOfType(schema4, callingScope);
    } else if (schema4.allOf?.length) {
      type = this.getAllOfType(schema4, callingScope);
    } else if (schema4?.items) {
      type = this.generateArrayType(schema4, callingScope);
    } else if (schema4.type === "boolean") {
      type = "boolean";
    } else if (schema4.type === "null") {
      type = "null";
    } else if (schema4.type === "integer") {
      type = getIntegerType(schema4);
    } else if (schema4.type === "number") {
      type = getNumberType(schema4);
    } else if (schema4?.properties && Object.keys(schema4.properties).length || schema4?.additionalProperties) {
      type = this.getObjectType(schema4, callingScope, isHttpPart, encoding, context);
    } else if (schema4.oneOf?.length) {
      type = this.getOneOfType(schema4, callingScope);
    } else if (schema4.type === "string") {
      type = getStringType(schema4);
    } else if (schema4.type === "object") {
      type = this.getObjectType(schema4, callingScope, isHttpPart, encoding, context);
    } else if (schema4.type === "array") {
      type = this.generateArrayType(schema4, callingScope);
    }
    if (schema4.nullable) {
      type += ` | null`;
    }
    if (schema4.default !== void 0) {
      const defaultValue = this.generateDefaultValue(schema4, callingScope, context);
      type += ` = ${defaultValue}`;
    }
    return type;
  }
  generateDefaultValue(schema4, callingScope, context) {
    if (typeof schema4.default === "object") {
      return normalizeObjectValueToTSValueExpression(schema4.default);
    }
    if (context && schema4.default !== void 0 && (schema4.anyOf?.length || schema4.oneOf?.length)) {
      const unionMembers = schema4.anyOf || schema4.oneOf || [];
      for (const member of unionMembers) {
        if ("$ref" in member) {
          const refSchema = context.getSchemaByRef(member.$ref);
          if (refSchema?.enum && refSchema.type === "string" && refSchema.enum.includes(schema4.default)) {
            const enumRefName = this.getRefName(member.$ref, callingScope);
            const memberName = printIdentifier3(schema4.default, "disallow-reserved");
            return `${enumRefName}.${memberName}`;
          }
        }
      }
    }
    return JSON.stringify(schema4.default);
  }
  getAllOfType(schema4, callingScope) {
    const requiredProps = schema4.required || [];
    let properties = {};
    const baseTypes = [];
    for (const member of schema4.allOf || []) {
      if ("$ref" in member) {
        baseTypes.push(this.getRefName(member.$ref, callingScope));
      } else if (member.properties) {
        properties = { ...properties, ...member.properties };
        if (member.required) {
          requiredProps.push(...member.required);
        }
      }
    }
    const props = [];
    for (const name of Object.keys(properties)) {
      const isOptional = !requiredProps.includes(name) ? "?" : "";
      props.push(`${printIdentifier3(name)}${isOptional}: ${this.generateTypeFromRefableSchema(properties[name], callingScope)}`);
    }
    if (baseTypes.length > 0 && props.length > 0) {
      return `${baseTypes.join(" & ")} & {${props.join("; ")}}`;
    } else if (baseTypes.length > 0) {
      return baseTypes.join(" & ");
    } else {
      return `{${props.join("; ")}}`;
    }
  }
  getAnyOfType(schema4, callingScope) {
    const definitions = [];
    for (const item of schema4.anyOf ?? []) {
      definitions.push(this.generateTypeFromRefableSchema(item, callingScope));
    }
    return definitions.join(" | ");
  }
  getOneOfType(schema4, callingScope) {
    const definitions = [];
    for (const item of schema4.oneOf ?? []) {
      definitions.push(this.generateTypeFromRefableSchema(item, callingScope));
    }
    return definitions.join(" | ");
  }
  getPartType(propType, name, isHttpPart, encoding, isEnumType, isUnionType) {
    if (!isHttpPart) {
      return propType;
    }
    const propTypeWithoutDefault = propType.replace(/ = .*/, "");
    const propTypeWithoutNull = propTypeWithoutDefault.replace(/ \| null/g, "");
    const encodingForProperty = encoding?.[name];
    const filePartType = encodingForProperty?.contentType && this.shouldUpgradeToFileDefinition(propTypeWithoutDefault, encodingForProperty.contentType) ? `File<"${encodingForProperty.contentType}">` : void 0;
    const contentTypeHeader = encodingForProperty?.contentType && !filePartType && !this.isDefaultPartType(propTypeWithoutNull, encodingForProperty.contentType) && !this.isInlineUnionType(propTypeWithoutNull) && !isUnionType && !this.isScalarType(propTypeWithoutNull) && !isEnumType ? ` & { @header contentType: "${encodingForProperty.contentType}" }` : "";
    return `HttpPart<${filePartType ?? propTypeWithoutDefault}${contentTypeHeader}>`;
  }
  isInlineUnionType(partType) {
    return partType.includes("|");
  }
  isScalarType(partType) {
    return partType === "string" || partType === "boolean" || partType === "null" || this.numericTypes[partType];
  }
  isDefaultPartType(partType, partMediaType) {
    return (partType === "string" || this.numericTypes[partType]) && partMediaType === "text/plain" || partType === "bytes" && partMediaType === "application/octet-stream";
  }
  shouldUpgradeToFileDefinition(partType, partMediaType) {
    return partType === "bytes" && !this.isDefaultPartType(partType, partMediaType);
  }
  numericTypes = {
    // https://typespec.io/docs/language-basics/built-in-types/
    numeric: true,
    integer: true,
    float: true,
    float32: true,
    float64: true,
    int8: true,
    int16: true,
    int32: true,
    int64: true,
    safeint: true,
    uint8: true,
    uint16: true,
    uint32: true,
    uint64: true,
    decimal: true,
    decimal128: true
  };
  static decoratorNamesToExcludeForParts = ["minValue", "maxValue"];
  getObjectType(schema4, callingScope, isHttpPart = false, encoding, context) {
    const recordType = typeof schema4.additionalProperties === "object" ? `Record<${this.generateTypeFromRefableSchema(schema4.additionalProperties, callingScope)}>` : "";
    const requiredProps = schema4.required ?? [];
    const props = [];
    if (schema4.properties) {
      for (const name of Object.keys(schema4.properties)) {
        const originalPropSchema = schema4.properties[name];
        const isEnumType = !!context && isReferencedEnumType(originalPropSchema, context);
        const isUnionType = !!context && isReferencedUnionType(originalPropSchema, context);
        const propType = this.generateTypeFromRefableSchema(originalPropSchema, callingScope);
        const decorators = generateDecorators(getDecoratorsForSchema(originalPropSchema), isHttpPart ? _SchemaToExpressionGenerator.decoratorNamesToExcludeForParts : []).map((d) => `${d}
`).join("");
        const isOptional = !requiredProps.includes(name) ? "?" : "";
        props.push(`${decorators}${printIdentifier3(name)}${isOptional}: ${this.getPartType(propType, name, isHttpPart, encoding, isEnumType, isUnionType)}`);
      }
    }
    let objectBody = "unknown";
    if (props.length > 0) {
      objectBody = `{${props.join("; ")}}`;
    }
    if (recordType) {
      if (props.length > 0) {
        objectBody = `{${props.join("; ")}; ...${recordType}}`;
      } else {
        objectBody = recordType;
      }
    } else {
      if (props.length === 0) {
        objectBody = "{}";
      }
    }
    return objectBody;
  }
};
function isReferencedEnumType(propSchema, context) {
  let isEnumType = false;
  try {
    isEnumType = "$ref" in propSchema && context.getSchemaByRef(propSchema.$ref)?.enum || "items" in propSchema && propSchema.items && "$ref" in propSchema.items && context.getSchemaByRef(propSchema.items.$ref)?.enum ? true : false;
  } catch {
  }
  return isEnumType;
}
function isReferencedUnionType(propSchema, context) {
  let isUnionType = false;
  try {
    const resolvedSchema = "$ref" in propSchema ? context.getSchemaByRef(propSchema.$ref) : void 0;
    const resolvedItemsSchema = "items" in propSchema && propSchema.items && "$ref" in propSchema.items ? context.getSchemaByRef(propSchema.items.$ref) : void 0;
    isUnionType = resolvedSchema && (resolvedSchema.oneOf?.length || resolvedSchema.anyOf?.length) || resolvedItemsSchema && (resolvedItemsSchema.oneOf?.length || resolvedItemsSchema.anyOf?.length) ? true : false;
  } catch {
  }
  return isUnionType;
}
function getTypeSpecPrimitiveFromSchema(schema4) {
  if (schema4.type === "boolean") {
    return "boolean";
  } else if (schema4.type === "null") {
    return "null";
  } else if (schema4.type === "integer") {
    return getIntegerType(schema4);
  } else if (schema4.type === "number") {
    return getNumberType(schema4);
  } else if (schema4.type === "string") {
    return getStringType(schema4);
  }
  return;
}
function getIntegerType(schema4) {
  const format3 = schema4.format ?? "";
  switch (format3) {
    case "int8":
    case "int16":
    case "int32":
    case "int64":
    case "uint8":
    case "uint16":
    case "uint32":
    case "uint64":
      return format3;
    case "double-int":
      return "safeint";
    default:
      return "integer";
  }
}
function getNumberType(schema4) {
  const format3 = schema4.format ?? "";
  switch (format3) {
    case "decimal":
    case "decimal128":
      return format3;
    case "double":
      return "float64";
    case "float":
      return "float32";
    default:
      return "numeric";
  }
}
function getStringType(schema4) {
  const format3 = schema4.format ?? "";
  let type = "string";
  switch (format3) {
    case "binary":
    case "byte":
      type = "bytes";
      break;
    case "date":
      type = "plainDate";
      break;
    case "date-time":
      type = "utcDateTime";
      break;
    case "time":
      type = "plainTime";
      break;
    case "duration":
      type = "duration";
      break;
    case "uri":
      type = "url";
      break;
  }
  return type;
}
function getEnum(schemaEnum) {
  return schemaEnum.map((e) => JSON.stringify(e)).join(" | ");
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-model.js
function generateDataType(type, context) {
  switch (type.kind) {
    case "alias":
      return generateAlias(type, context);
    case "enum":
      return generateEnum(type);
    case "model":
      return generateModel(type, context);
    case "scalar":
      return generateScalar(type, context);
    case "union":
      return generateUnion(type, context);
  }
}
function generateAlias(alias, context) {
  const sourceModel = context.getRefName(alias.ref, alias.scope);
  return `model ${alias.name} is ${sourceModel};`;
}
function generateEnum(tsEnum) {
  const definitions = [];
  if (tsEnum.doc) {
    definitions.push(generateDocs(tsEnum.doc));
  }
  definitions.push(...generateDecorators(tsEnum.decorators));
  definitions.push(`enum ${tsEnum.name} {`);
  const schema4 = tsEnum.schema;
  if (schema4.enum) {
    definitions.push(...schema4.enum.map((e) => `${JSON.stringify(e)},`));
  }
  definitions.push("}");
  return definitions.join("\n");
}
function generateScalar(scalar, context) {
  const definitions = [];
  if (scalar.doc) {
    definitions.push(generateDocs(scalar.doc));
  }
  definitions.push(...generateDecorators(scalar.decorators));
  const type = context.generateTypeFromRefableSchema(scalar.schema, scalar.scope);
  if (type === "unknown") {
    definitions.push(`scalar ${scalar.name};`);
  } else {
    definitions.push(`scalar ${scalar.name} extends ${type};`);
  }
  return definitions.join("\n");
}
function generateUnion(union, context) {
  const definitions = [];
  if (union.doc) {
    definitions.push(generateDocs(union.doc));
  }
  definitions.push(...generateDecorators(union.decorators));
  definitions.push(`union ${union.name} {`);
  const schema4 = union.schema;
  const getVariantName = (member) => {
    if (union.schema.discriminator === void 0) {
      return "";
    }
    const memberSchema = "$ref" in member ? context.getSchemaByRef(member.$ref) : member;
    const value = (union.schema.discriminator?.mapping && "$ref" in member ? Object.entries(union.schema.discriminator.mapping).find((x) => x[1] === member.$ref)?.[0] : void 0) ?? memberSchema.properties?.[union.schema.discriminator.propertyName]?.enum?.[0];
    const valueIdentifier = value ? printIdentifier4(value, "disallow-reserved") : "";
    return value ? `${value === valueIdentifier ? value : valueIdentifier}: ` : "";
  };
  if (schema4.enum) {
    definitions.push(...schema4.enum.map((e) => `${JSON.stringify(e)},`));
  } else if (schema4.oneOf) {
    definitions.push(...schema4.oneOf.map((member) => getVariantName(member) + context.generateTypeFromRefableSchema(member, union.scope) + ","));
  } else if (schema4.anyOf) {
    definitions.push(...schema4.anyOf.map((member) => getVariantName(member) + context.generateTypeFromRefableSchema(member, union.scope) + ","));
  } else {
    const primitiveType = getTypeSpecPrimitiveFromSchema(schema4);
    if (primitiveType) {
      definitions.push(`${primitiveType},`);
    } else if (schema4.type === "array" || schema4.items) {
      const schemaWithoutNullable = { ...schema4, nullable: void 0 };
      const arrayType = context.generateTypeFromRefableSchema(schemaWithoutNullable, union.scope);
      definitions.push(`${arrayType},`);
    }
  }
  if (schema4.nullable) {
    definitions.push("null,");
  }
  definitions.push("}");
  return definitions.join("\n");
}
function generateModel(model, context) {
  const definitions = [];
  const modelDeclaration = generateModelDeclaration(model);
  if (model.doc) {
    definitions.push(generateDocs(model.doc));
  }
  definitions.push(...generateDecorators(model.decorators));
  definitions.push(modelDeclaration.open);
  if (model.spread?.length) {
    definitions.push(...model.spread.map((spread) => `...${spread};`));
  }
  definitions.push(...model.properties.map((prop) => generateModelProperty(prop, model.scope, context, model.isModelReferencedAsMultipartRequestBody, model.encoding)));
  if (model.additionalProperties) {
    definitions.push(`...Record<${context.generateTypeFromRefableSchema(model.additionalProperties, model.scope)}>;`);
  }
  if (modelDeclaration.close)
    definitions.push(modelDeclaration.close);
  return definitions.join("\n");
}
function generateModelProperty(prop, containerScope, context, isModelReferencedAsMultipartRequestBody, encoding) {
  const propertyType = context.generateTypeFromRefableSchema(prop.schema, containerScope);
  const decorators = generateDecorators([...prop.decorators, ...getDecoratorsForSchema(prop.schema)], isModelReferencedAsMultipartRequestBody ? SchemaToExpressionGenerator.decoratorNamesToExcludeForParts : []).join(" ");
  const isEnumType = isReferencedEnumType(prop.schema, context);
  const isUnionType = isReferencedUnionType(prop.schema, context);
  const doc = prop.doc ? generateDocs(prop.doc) : "";
  return `${doc}${decorators} ${prop.name}${prop.isOptional ? "?" : ""}: ${context.getPartType(propertyType, prop.name, isModelReferencedAsMultipartRequestBody ?? false, encoding, isEnumType, isUnionType)};`;
}
function generateModelExpression(props, containerScope, context) {
  return `{ ${props.map((prop) => generateModelProperty(prop, containerScope, context)).join(" ")} }`;
}
function generateModelDeclaration(model) {
  const modelName = model.name;
  if (model.is) {
    return { open: `model ${modelName} is ${model.is};` };
  }
  if (model.extends) {
    return { open: `model ${modelName} extends ${model.extends} {`, close: "}" };
  }
  return { open: `model ${modelName} {`, close: "}" };
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/utils/convert-header-name.js
function convertHeaderName(s) {
  return s.split("-").map((s2, idx) => idx === 0 ? s2 : s2.substring(0, 1).toUpperCase() + s2.substring(1)).join("");
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-response-expressions.js
function generateOperationReturnType(operation, context) {
  const expressions = [];
  for (const [statusCode, response] of Object.entries(operation.responses)) {
    expressions.push(...generateReturnTypeForStatusCode({
      statusCode,
      response,
      context,
      operationScope: operation.scope
    }));
  }
  return expressions.join(" | ");
}
function generateReturnTypeForStatusCode(props) {
  const { statusCode, context } = props;
  const response = "$ref" in props.response ? context.getByRef(props.response.$ref) : props.response;
  if (!response) {
    return [];
  }
  const description = props.response.description ?? response.description;
  const headerProperties = Object.entries(response.headers ?? {}).map(([name, header]) => {
    return convertHeaderToProperty({ name, header, context });
  }).filter((h) => !!h);
  const contentEntries = Object.entries(response.content ?? {});
  return generateResponseExpressions({
    statusCode,
    description,
    headers: headerProperties,
    contents: contentEntries,
    operationScope: props.operationScope,
    context
  });
}
function getStatusCodeMetadata(statusCode) {
  const isDefault = statusCode === "default";
  if (isDefault) {
    return { statusCode, isDefault };
  }
  const metadata = {
    statusCode,
    isDefault,
    modelProperty: convertStatusCodeToProperty(statusCode)
  };
  if (isValidLiteralStatusCode(statusCode)) {
    metadata.literalStatusCode = parseInt(statusCode, 10);
    metadata.httpLibModel = statusCodeToResponse.get(metadata.literalStatusCode);
  }
  return metadata;
}
function handleDefaultResponse({ contents, context, headers, operationScope, description }) {
  if (!contents.length) {
    return [
      generateDefaultResponse({
        context,
        headers,
        operationScope,
        description
      })
    ];
  }
  return contents.map(([mediaType, content]) => {
    const bodySchema = content.schema;
    const headerProps = [...headers];
    if (mediaType !== "application/json") {
      headerProps.push({
        name: "contentType",
        decorators: [{ name: "header", args: [] }],
        isOptional: false,
        schema: { type: "string", enum: [mediaType] }
      });
    }
    return generateDefaultResponse({
      context,
      headers: headerProps,
      operationScope,
      body: bodySchema && context.generateTypeFromRefableSchema(bodySchema, operationScope),
      description
    });
  });
}
function generateResponseExpressions({ statusCode, contents, context, headers, operationScope, description }) {
  const hasContents = contents.length > 0;
  const statusCodeMetadata = getStatusCodeMetadata(statusCode);
  if (statusCodeMetadata.isDefault) {
    return handleDefaultResponse({ headers, contents, operationScope, context, description });
  }
  if (statusCodeMetadata.httpLibModel && !hasContents && !headers.length) {
    return [statusCodeMetadata.httpLibModel];
  }
  if (statusCodeMetadata.literalStatusCode === 200) {
    statusCodeMetadata.httpLibModel = void 0;
    statusCodeMetadata.modelProperty = void 0;
  }
  if (!hasContents) {
    if (statusCodeMetadata.httpLibModel) {
      return [
        `${statusCodeMetadata.httpLibModel} & ${generateModelExpression(headers, operationScope, context)}`
      ];
    }
    const modelProps = [...headers];
    if (statusCodeMetadata.modelProperty) {
      modelProps.push(statusCodeMetadata.modelProperty);
    }
    return [generateModelExpression(modelProps, operationScope, context)];
  }
  return contents.map(([mediaType, content]) => {
    const bodySchema = content.schema;
    if (bodySchema && mediaType === "application/json" && !headers.length) {
      if ("$ref" in bodySchema && statusCodeMetadata.httpLibModel) {
        return `${statusCodeMetadata.httpLibModel} & ${context.generateTypeFromRefableSchema(bodySchema, operationScope)}`;
      }
      if (statusCodeMetadata.literalStatusCode === 200) {
        const body = context.generateTypeFromRefableSchema(bodySchema, operationScope);
        if ("$ref" in bodySchema) {
          return body;
        }
        return `Body<${body}>`;
      }
    }
    const modelExpressionProps = [];
    if (statusCodeMetadata.modelProperty) {
      modelExpressionProps.push(statusCodeMetadata.modelProperty);
    }
    modelExpressionProps.push(...headers);
    if (mediaType !== "application/json") {
      modelExpressionProps.push({
        name: "contentType",
        decorators: [{ name: "header", args: [] }],
        isOptional: false,
        schema: { type: "string", enum: [mediaType] }
      });
    }
    if (bodySchema) {
      modelExpressionProps.push({
        name: "body",
        isOptional: false,
        decorators: [{ name: "body", args: [] }],
        schema: bodySchema
      });
    }
    return generateModelExpression(modelExpressionProps, operationScope, context);
  });
}
function generateDefaultResponse({ operationScope, context, ...props }) {
  const hasTemplateParams = !!(props.description || props.headers.length || props.body);
  if (!hasTemplateParams)
    return "GeneratedHelpers.DefaultResponse";
  const description = props.description ? `Description = "${props.description}", ` : "";
  const headers = props.headers.length ? `Headers = ${generateModelExpression(props.headers, operationScope, context)}, ` : "";
  const body = props.body ? `Body = ${props.body}, ` : "";
  return `GeneratedHelpers.DefaultResponse<${description}${headers}${body}>`;
}
function convertStatusCodeToProperty(statusCode) {
  const schema4 = { type: "integer", format: "int32" };
  if (statusCode === "1XX") {
    schema4.minimum = 100;
    schema4.maximum = 199;
  } else if (statusCode === "2XX") {
    schema4.minimum = 200;
    schema4.maximum = 299;
  } else if (statusCode === "3XX") {
    schema4.minimum = 300;
    schema4.maximum = 399;
  } else if (statusCode === "4XX") {
    schema4.minimum = 400;
    schema4.maximum = 499;
  } else if (statusCode === "5XX") {
    schema4.minimum = 500;
    schema4.maximum = 599;
  } else if (isValidLiteralStatusCode(statusCode)) {
    const literalStatusCode = parseInt(statusCode, 10);
    schema4.enum = [literalStatusCode];
  }
  return {
    name: "statusCode",
    schema: schema4,
    decorators: [{ name: "statusCode", args: [] }],
    isOptional: false
  };
}
function isValidLiteralStatusCode(statusCode) {
  if (statusCode === "default" || statusCode.endsWith("X"))
    return false;
  const literalStatusCode = parseInt(statusCode, 10);
  return isFinite(literalStatusCode) && literalStatusCode >= 100 && literalStatusCode <= 599;
}
function convertHeaderToProperty(props) {
  const { name, context } = props;
  const header = "$ref" in props.header ? context.getByRef(props.header.$ref) : props.header;
  if (!header)
    return;
  const normalizedName = convertHeaderName(name);
  const headerDecorator = { name: "header", args: [] };
  if (normalizedName !== name) {
    headerDecorator.args.push(name);
  }
  return {
    name: normalizedName,
    decorators: [headerDecorator, ...getDecoratorsForSchema(header.schema)],
    doc: props.header.description ?? header.description ?? header.schema.description,
    isOptional: !header.required,
    schema: header.schema
  };
}
var statusCodeToResponse = /* @__PURE__ */ new Map([
  [200, "OkResponse"],
  [201, "CreatedResponse"],
  [202, "AcceptedResponse"],
  [204, "NoContentResponse"],
  [304, "NotModifiedResponse"],
  [400, "BadRequestResponse"],
  [401, "UnauthorizedResponse"],
  [403, "ForbiddenResponse"],
  [404, "NotFoundResponse"],
  [409, "ConflictResponse"]
]);

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-operation.js
function generateOperation(operation, context) {
  const definitions = [];
  if (operation.doc) {
    definitions.push(generateDocs(operation.doc));
  }
  definitions.push(...operation.tags.map((t) => `@tag("${t}")`));
  definitions.push(generateDecorators(operation.decorators).join(" "));
  const parameters = [
    ...operation.parameters.map((p) => generateOperationParameter(operation, p, context)),
    ...generateRequestBodyParameters(operation.requestBodies, context)
  ];
  const responses = generateOperationReturnType(operation, context);
  if (operation.fixmes?.length) {
    definitions.push("\n", ...operation.fixmes.map((f) => `// FIXME: ${f}
`));
  }
  definitions.push(`op ${operation.name}(${parameters.join(", ")}): ${responses};`);
  return definitions.join(" ");
}
function generateOperationParameter(operation, parameter, context) {
  if ("$ref" in parameter) {
    return `...${context.getRefName(parameter.$ref, operation.scope)}`;
  }
  const definitions = [];
  if (parameter.doc) {
    definitions.push(generateDocs(parameter.doc));
  }
  definitions.push(...generateDecorators(parameter.decorators));
  definitions.push(`${parameter.name}${parameter.isOptional ? "?" : ""}: ${context.generateTypeFromRefableSchema(parameter.schema, operation.scope)}`);
  return definitions.join(" ");
}
function generateRequestBodyParameters(requestBodies, context) {
  if (!requestBodies.length) {
    return [];
  }
  const definitions = [];
  const contentTypes = requestBodies.map((r) => r.contentType);
  if (!supportsOnlyJson(contentTypes)) {
    definitions.push(`@header contentType: ${contentTypes.map((c) => `"${c}"`).join(" | ")}`);
  }
  const isMultipart = contentTypes.includes("multipart/form-data");
  const body = Array.from(new Set(requestBodies.filter((r) => !!r.schema).map((r) => context.generateTypeFromRefableSchema(r.schema, [], isMultipart, r.encoding)))).join(" | ");
  if (body) {
    let doc = "";
    if (requestBodies[0].doc) {
      doc = generateDocs(requestBodies[0].doc);
    }
    if (isMultipart) {
      definitions.push(`${doc}@multipartBody body: ${body}`);
    } else {
      definitions.push(`${doc}@body body: ${body}`);
    }
  }
  return definitions;
}
function supportsOnlyJson(contentTypes) {
  return contentTypes.length === 1 && contentTypes[0] === "application/json";
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-namespace.js
function generateNamespace(name, namespace2, context) {
  const definitions = [];
  definitions.push(`namespace ${name} {`);
  definitions.push(...namespace2.types.map((t) => generateDataType(t, context)));
  definitions.push(...namespace2.operations.map((o) => generateOperation(o, context)));
  for (const [namespaceName, nestedNamespace] of Object.entries(namespace2.namespaces)) {
    definitions.push(generateNamespace(namespaceName, nestedNamespace, context));
  }
  definitions.push("}");
  return definitions.join("\n");
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/utils/generate-namespace-name.js
function generateNamespaceName(name) {
  return name.replaceAll(/[^\w^\d_]+/g, "");
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/utils/tsp-values.js
function toTspValues(item) {
  if (typeof item === "object") {
    if (Array.isArray(item)) {
      return `#[${item.map(toTspValues).join(", ")}]`;
    } else {
      const content = Object.entries(item).filter(([, value]) => value !== void 0).map(([key, value]) => {
        if (typeof value === "string") {
          return `${key}: "${value}"`;
        }
        return `${key}: ${toTspValues(value)}`;
      }).join(", ");
      return `#{${content}}`;
    }
  } else {
    return JSON.stringify(item);
  }
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-servers.js
function generateServerVariable(variableName, variable) {
  const { default: defaultValue, description, enum: enumValues } = variable;
  const enumString = enumValues ? `${enumValues.map((x) => `"${x}"`).join(" | ")}` : "";
  return `
    ${description ? `@doc("${description}")` : ""}
    ${variableName}: ${enumString || "string"}${defaultValue ? ` = "${defaultValue}"` : ""},
  `;
}
function generateServerVariables(variables) {
  return Object.entries(variables).map(([name, variable]) => generateServerVariable(name, variable)).join("\n");
}
function generateServers(servers) {
  if (!servers || servers.length === 0) {
    return "";
  }
  const definitions = servers.map((server) => {
    const variables = server.variables && Object.keys(server.variables).length > 0 ? `, {
        ${generateServerVariables(server.variables)}
      }` : "";
    const description = server.description ? `, "${server.description}"` : variables ? `, ""` : "";
    return `@server("${server.url}"${description}${variables})`;
  });
  return definitions.join("\n");
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-tags.js
function generateExternalDocs(externalDocs) {
  if (!externalDocs) {
    return "";
  }
  const externalDocsUrl = externalDocs.url ? `url: "${externalDocs.url}"` : "";
  const externalDocsDescription = externalDocs.description ? `description: "${externalDocs.description}"` : "";
  if (!externalDocsUrl && !externalDocsDescription) {
    return "";
  }
  return `externalDocs: #{${[externalDocsUrl, externalDocsDescription].filter((x) => !!x).join(", ")}}`;
}
function generateTags(tags) {
  const definitions = tags.map((tag) => {
    const description = tag.description ? `description: "${tag.description}"` : "";
    const externalDocs = generateExternalDocs(tag.externalDocs);
    const tagMetadata = description || externalDocs ? `, #{${[description, externalDocs].filter((x) => !!x).join(", ")}}` : "";
    return `@tagMetadata("${tag.name}"${tagMetadata})`;
  });
  return definitions.join("\n");
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-service-info.js
function generateServiceInformation(serviceInfo, servers = [], tags = [], namespaceName) {
  const definitions = [];
  const { name, doc, ...info } = serviceInfo;
  definitions.push(`
    @service(#{
      title: "${name}"
    })
    @info(${toTspValues(info)})
    `);
  if (doc) {
    definitions.push(generateDocs(doc));
  }
  if (servers.length > 0) {
    definitions.push(generateServers(servers));
  }
  if (tags.length > 0) {
    definitions.push(generateTags(tags));
  }
  const namespace2 = namespaceName && generateNamespaceName(namespaceName) || generateNamespaceName(name);
  definitions.push(`namespace ${namespace2};`);
  return definitions.join("\n");
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/generators/generate-main.js
function generateMain(program, context) {
  return `
  import "@typespec/http";
  import "@typespec/openapi";
  import "@typespec/openapi3";

  using Http;
  using OpenAPI;

  ${generateServiceInformation(program.serviceInfo, program.servers, program.tags, context.rootNamespace)}

  ${program.types.map((t) => generateDataType(t, context)).join("\n\n")}

  ${program.operations.map((o) => generateOperation(o, context)).join("\n\n")}

  ${Object.entries(program.namespaces).map(([name, namespace2]) => generateNamespace(name, namespace2, context)).join("\n\n")}
  ${generateHelpers(context)}
  `;
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/transforms/transform-component-parameters.js
import { printIdentifier as printIdentifier5 } from "@typespec/compiler";
function transformComponentParameters(context, dataTypes) {
  const parameters = context.openApi3Doc.components?.parameters;
  if (!parameters)
    return;
  for (const name of Object.keys(parameters)) {
    const parameter = parameters[name];
    transformComponentParameter(dataTypes, name, parameter);
  }
}
function transformComponentParameter(dataTypes, key, parameter) {
  const { name, scope } = getScopeAndName(key);
  scope.unshift("Parameters");
  dataTypes.push({
    kind: "model",
    scope,
    name,
    decorators: [],
    properties: [getModelPropertyFromParameter(parameter)]
  });
}
function getModelPropertyFromParameter(parameter) {
  return {
    name: printIdentifier5(parameter.name),
    isOptional: !parameter.required,
    doc: parameter.description ?? parameter.schema.description,
    decorators: getParameterDecorators(parameter),
    schema: parameter.schema
  };
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/transforms/transform-component-schemas.js
import { printIdentifier as printIdentifier6 } from "@typespec/compiler";
function transformComponentSchemas(context, models) {
  const schemas2 = context.openApi3Doc.components?.schemas;
  if (!schemas2)
    return;
  for (const name of Object.keys(schemas2)) {
    const schema4 = schemas2[name];
    transformComponentSchema(models, name, context, schema4);
  }
  return;
  function transformComponentSchema(types2, name, context2, schema4) {
    const kind = getTypeSpecKind(schema4);
    switch (kind) {
      case "alias":
        return populateAlias(types2, name, schema4);
      case "enum":
        return populateEnum(types2, name, schema4);
      case "model":
        return populateModel(types2, name, context2, schema4);
      case "union":
        return populateUnion(types2, name, schema4);
      case "scalar":
        return populateScalar(types2, name, schema4);
    }
  }
  function populateAlias(types2, rawName, schema4) {
    if (!("$ref" in schema4)) {
      return;
    }
    const { name, scope } = getScopeAndName(rawName);
    types2.push({
      kind: "alias",
      name,
      scope,
      doc: schema4.description,
      ref: context.getRefName(schema4.$ref, scope)
    });
  }
  function populateEnum(types2, name, schema4) {
    const tsEnum = {
      kind: "enum",
      ...getScopeAndName(name),
      decorators: getDecoratorsForSchema(schema4),
      doc: schema4.description,
      schema: schema4
    };
    types2.push(tsEnum);
  }
  function populateModel(types2, rawName, context2, schema4) {
    const { name, scope } = getScopeAndName(rawName);
    const allOfDetails = getAllOfDetails(schema4, scope);
    const isParent = getModelIs(schema4, scope);
    const refName = `#/components/schemas/${rawName}`;
    const isModelReferencedAsMultipartRequestBody = context2.isSchemaReferenceRegisteredForMultipartForm(refName);
    const encoding = isModelReferencedAsMultipartRequestBody ? context2.getMultipartSchemaEncoding(refName) : void 0;
    types2.push({
      kind: "model",
      name,
      scope,
      decorators: [...getDecoratorsForSchema(schema4)],
      doc: schema4.description,
      properties: [...getModelPropertiesFromObjectSchema(schema4), ...allOfDetails.properties],
      additionalProperties: typeof schema4.additionalProperties === "object" ? schema4.additionalProperties : void 0,
      extends: allOfDetails.extends,
      is: isParent,
      type: schema4.type,
      spread: allOfDetails.spread,
      isModelReferencedAsMultipartRequestBody,
      encoding
    });
  }
  function populateUnion(types2, name, schema4) {
    const union = {
      kind: "union",
      ...getScopeAndName(name),
      decorators: getDecoratorsForSchema(schema4),
      doc: schema4.description,
      schema: schema4
    };
    types2.push(union);
  }
  function populateScalar(types2, name, schema4) {
    types2.push({
      kind: "scalar",
      ...getScopeAndName(name),
      decorators: getDecoratorsForSchema(schema4),
      doc: schema4.description,
      schema: schema4
    });
  }
  function getAllOfDetails(schema4, callingScope) {
    const details = {
      spread: [],
      properties: []
    };
    if (!schema4.allOf) {
      return details;
    }
    let foundParentWithDiscriminator = false;
    for (const member of schema4.allOf) {
      if (!("$ref" in member)) {
        details.properties.push(...getModelPropertiesFromObjectSchema(member));
        continue;
      }
      const refSchema = context.getSchemaByRef(member.$ref);
      if (!refSchema?.discriminator) {
        details.spread.push(context.getRefName(member.$ref, callingScope));
        continue;
      }
      if (!foundParentWithDiscriminator) {
        details.extends = context.getRefName(member.$ref, callingScope);
        foundParentWithDiscriminator = true;
        continue;
      }
      if (details.extends) {
        details.spread.push(details.extends);
        details.extends = void 0;
      }
      details.spread.push(context.getRefName(member.$ref, callingScope));
    }
    return details;
  }
  function getModelIs(schema4, callingScope) {
    if (schema4.type !== "array") {
      return;
    }
    return context.generateTypeFromRefableSchema(schema4, callingScope);
  }
}
function getModelPropertiesFromObjectSchema({ properties, required = [] }) {
  if (!properties)
    return [];
  const modelProperties = [];
  for (const name of Object.keys(properties)) {
    const property = properties[name];
    modelProperties.push({
      name: printIdentifier6(name),
      doc: property.description,
      schema: property,
      isOptional: !required.includes(name),
      decorators: [...getDecoratorsForSchema(property)]
    });
  }
  return modelProperties;
}
function getTypeSpecKind(schema4) {
  if ("$ref" in schema4) {
    return "alias";
  }
  if (schema4.enum && schema4.type === "string" && !schema4.nullable) {
    return "enum";
  } else if (schema4.anyOf || schema4.oneOf || schema4.enum || schema4.nullable) {
    return "union";
  } else if (schema4.type === "object" || schema4.properties && Object.keys(schema4.properties).length > 0 || schema4.type === "array" || schema4.items || schema4.allOf) {
    return "model";
  }
  return "scalar";
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/transforms/transform-namespaces.js
function transformNamespaces(types2, operations) {
  const programDecs = {
    types: [],
    operations: [],
    namespaces: {}
  };
  expandModels(programDecs, types2);
  expandOperations(programDecs, operations);
  return programDecs;
}
function expandModels(programDecs, types2) {
  for (const type of types2) {
    const { scope } = type;
    const namespace2 = getNamespace(programDecs, scope) ?? createNamespace(programDecs, scope);
    namespace2.types.push(type);
  }
}
function expandOperations(programDecs, operations) {
  for (const operation of operations) {
    const { scope } = operation;
    const namespace2 = getNamespace(programDecs, scope) ?? createNamespace(programDecs, scope);
    namespace2.operations.push(operation);
  }
}
function getNamespace(programDecs, scope) {
  if (!scope.length)
    return programDecs;
  let namespace2 = programDecs;
  for (const fragment of scope) {
    if (!namespace2)
      return;
    namespace2 = namespace2.namespaces[fragment];
  }
  return namespace2;
}
function createNamespace(programDecs, scope) {
  let namespace2 = programDecs;
  for (const fragment of scope) {
    if (!namespace2.namespaces[fragment]) {
      namespace2.namespaces[fragment] = {
        namespaces: {},
        types: [],
        operations: []
      };
    }
    namespace2 = namespace2.namespaces[fragment];
  }
  return namespace2;
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/transforms/transform-paths.js
import { printIdentifier as printIdentifier7 } from "@typespec/compiler";

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/utils/generate-operation-id.js
function generateOperationId(method, path, usedIds) {
  const cleanPath = path.replace(/^\//, "").replace(/\//g, "_").replace(/[{}]/g, "").replace(/[^a-zA-Z0-9_]/g, "_");
  const baseId = `${method.toLowerCase()}_${cleanPath || "root"}`;
  let operationId = baseId.replace(/_+/g, "_").replace(/_$/, "");
  let suffix = 1;
  const originalId = operationId;
  while (usedIds.has(operationId)) {
    operationId = `${originalId}_${suffix}`;
    suffix++;
  }
  usedIds.add(operationId);
  return operationId;
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/transforms/transform-paths.js
function transformPaths(paths, context) {
  const operations = [];
  const usedOperationIds = /* @__PURE__ */ new Set();
  for (const route of Object.keys(paths)) {
    const routeParameters = paths[route].parameters?.map(transformOperationParameter) ?? [];
    const path = paths[route];
    for (const verb of supportedHttpMethods) {
      const operation = path[verb];
      if (!operation)
        continue;
      const parameters = operation.parameters?.map(transformOperationParameter) ?? [];
      const tags = operation.tags?.map((t) => t) ?? [];
      const operationResponses = operation.responses ?? {};
      const decorators = [
        ...getExtensions(operation),
        { name: "route", args: [route] },
        { name: verb, args: [] }
      ];
      if (operation.summary) {
        decorators.push({ name: "summary", args: [operation.summary] });
      }
      const fixmes = [];
      let operationId = operation.operationId;
      if (!operationId) {
        operationId = generateOperationId(verb, route, usedOperationIds);
        const warning = `Open API operation '${verb.toUpperCase()} ${route}' is missing an operationId. Generated: '${operationId}'`;
        context.logger.warn(warning);
        fixmes.push(warning);
      } else {
        usedOperationIds.add(operationId);
      }
      operations.push({
        ...getScopeAndName(operationId),
        decorators,
        parameters: dedupeParameters([...routeParameters, ...parameters]),
        doc: operation.description,
        operationId,
        requestBodies: transformRequestBodies(operation.requestBody, context),
        responses: operationResponses,
        tags,
        fixmes
      });
    }
  }
  return operations;
}
function dedupeParameters(parameters) {
  const seen = /* @__PURE__ */ new Set();
  const dedupeList = [];
  for (let i = parameters.length - 1; i >= 0; i--) {
    const param = parameters[i];
    const identifier = "$ref" in param ? param.$ref : `${param.in}.${param.name}`;
    if (seen.has(identifier))
      continue;
    seen.add(identifier);
    dedupeList.unshift(param);
  }
  return dedupeList;
}
function transformOperationParameter(parameter) {
  if ("$ref" in parameter) {
    return { $ref: parameter.$ref };
  }
  return {
    name: printIdentifier7(parameter.name),
    in: parameter.in,
    doc: parameter.description,
    decorators: getParameterDecorators(parameter),
    isOptional: !parameter.required,
    schema: parameter.schema
  };
}
function transformRequestBodies(requestBodies, context) {
  if (!requestBodies) {
    return [];
  }
  const description = requestBodies.description;
  if ("$ref" in requestBodies) {
    requestBodies = context.getByRef(requestBodies.$ref);
  }
  if (!requestBodies) {
    return [];
  }
  const typespecBodies = [];
  for (const contentType of Object.keys(requestBodies.content)) {
    const contentBody = requestBodies.content[contentType];
    typespecBodies.push({
      contentType,
      isOptional: !requestBodies.required,
      doc: description ?? requestBodies.description,
      encoding: contentBody.encoding,
      schema: contentBody.schema
    });
  }
  return typespecBodies;
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/transforms/transform-servers.js
function transformServerVariables(variables) {
  if (!variables)
    return void 0;
  const result = {};
  for (const [name, variable] of Object.entries(variables)) {
    result[name] = {
      default: variable.default,
      description: variable.description,
      enum: variable.enum ? [...variable.enum] : void 0
    };
  }
  return result;
}
function transformServers(servers) {
  return servers.map((server) => ({
    url: server.url,
    description: server.description,
    variables: transformServerVariables(server.variables)
  }));
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/transforms/transform-service-info.js
function transformServiceInfo(info) {
  return {
    name: info.title,
    doc: info.description,
    version: info.version,
    contact: info.contact,
    license: info.license,
    termsOfService: info.termsOfService,
    summary: info.summary
  };
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/transforms/transform-tags.js
function transformTags(tags) {
  return tags.map((tag) => ({
    name: tag.name,
    description: tag.description,
    externalDocs: tag.externalDocs?.url || tag.externalDocs?.description ? {
      url: tag.externalDocs.url,
      description: tag.externalDocs.description
    } : void 0
  }));
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/transforms/transforms.js
function transform(context) {
  const openapi = context.openApi3Doc;
  scanForMultipartSchemas(openapi, context);
  const models = collectDataTypes(context);
  const operations = transformPaths(openapi.paths, context);
  return {
    serviceInfo: transformServiceInfo(openapi.info),
    ...transformNamespaces(models, operations),
    augmentations: [],
    servers: transformServers(openapi.servers ?? []),
    tags: transformTags(openapi.tags ?? [])
  };
}
function scanForMultipartSchemas(openapi, context) {
  if (!openapi.paths)
    return;
  for (const path of Object.values(openapi.paths)) {
    if (!path)
      continue;
    scanPathForMultipartSchemas(path, context);
  }
}
function scanPathForMultipartSchemas(path, context) {
  const methods = ["get", "post", "put", "patch", "delete", "head"];
  for (const method of methods) {
    const operation = path[method];
    if (!operation?.requestBody)
      continue;
    scanOperationForMultipartSchemas(operation.requestBody, context);
  }
}
function scanOperationForMultipartSchemas(requestBodyRef, context) {
  let requestBody = requestBodyRef;
  if ("$ref" in requestBody) {
    const resolved = context.getByRef(requestBody.$ref);
    if (!resolved)
      return;
    requestBody = resolved;
  }
  if (!("content" in requestBody) || !requestBody.content)
    return;
  for (const [_, contentBody] of Object.entries(requestBody.content).filter(([mediaType, _2]) => mediaType === "multipart/form-data")) {
    const schemaReference = contentBody.schema;
    const encoding = contentBody.encoding;
    if (schemaReference && "$ref" in schemaReference) {
      context.registerMultipartSchema(schemaReference.$ref, encoding);
    }
  }
}
function collectDataTypes(context) {
  const models = [];
  transformComponentSchemas(context, models);
  transformComponentParameters(context, models);
  return models;
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/utils/context.js
function createContext(parser, openApi3Doc, logger, namespace2) {
  const rootNamespace = namespace2 ? generateNamespaceName(namespace2) : generateNamespaceName(openApi3Doc.info.title);
  const schemaExpressionGenerator = new SchemaToExpressionGenerator(rootNamespace);
  const multipartSchemas = /* @__PURE__ */ new Map();
  const defaultLogger = {
    trace: () => {
    },
    warn: () => {
    },
    error: () => {
    }
  };
  const context = {
    openApi3Doc,
    rootNamespace,
    logger: logger ?? defaultLogger,
    getRefName(ref, callingScope) {
      return schemaExpressionGenerator.getRefName(ref, callingScope);
    },
    generateTypeFromRefableSchema(schema4, callingScope, isHttpPart = false, encoding) {
      return schemaExpressionGenerator.generateTypeFromRefableSchema(schema4, callingScope, isHttpPart, encoding, this);
    },
    getSchemaByRef(ref) {
      return this.getByRef(ref);
    },
    getByRef(ref) {
      return parser.$refs.get(ref);
    },
    registerMultipartSchema(ref, encoding) {
      multipartSchemas.set(ref, encoding ?? null);
    },
    getMultipartSchemaEncoding(ref) {
      const result = multipartSchemas.get(ref);
      return result === null ? void 0 : result;
    },
    isSchemaReferenceRegisteredForMultipartForm(ref) {
      return multipartSchemas.has(ref);
    },
    getPartType(propType, name, isHttpPart, encoding, isEnumType, isUnionType) {
      return schemaExpressionGenerator.getPartType(propType, name, isHttpPart, encoding, isEnumType, isUnionType);
    }
  };
  return context;
}

// src/typespec/core/packages/openapi3/dist/src/cli/actions/convert/convert.js
async function convertOpenAPI3Document(document2, { disableExternalRefs, namespace: namespace2 } = {}) {
  const parser = new import_swagger_parser.default();
  const bundleOptions = disableExternalRefs ? {
    resolve: { external: false, http: false, file: false }
  } : {};
  await parser.bundle(document2, bundleOptions);
  const context = createContext(parser, document2, console, namespace2);
  const program = transform(context);
  const content = generateMain(program, context);
  try {
    return await formatTypeSpec(content, {
      printWidth: 100,
      tabWidth: 2
    });
  } catch {
    return content;
  }
}

// src/typespec/core/packages/openapi3/dist/src/lib.js
import { createTypeSpecLibrary, paramMessage } from "@typespec/compiler";
var EmitterOptionsSchema = {
  type: "object",
  additionalProperties: false,
  properties: {
    "file-type": {
      type: "string",
      enum: ["yaml", "json"],
      nullable: true,
      description: "If the content should be serialized as YAML or JSON. Default 'yaml', it not specified infer from the `output-file` extension"
    },
    "output-file": {
      type: "string",
      nullable: true,
      description: [
        "Name of the output file.",
        " Output file will interpolate the following values:",
        "  - service-name: Name of the service",
        "  - service-name-if-multiple: Name of the service if multiple",
        "  - version: Version of the service if multiple",
        "",
        ' Default: `{service-name-if-multiple}.{version}.openapi.yaml` or `.json` if `file-type` is `"json"`',
        "",
        " Example Single service no versioning",
        "  - `openapi.yaml`",
        "",
        " Example Multiple services no versioning",
        "  - `openapi.Org1.Service1.yaml`",
        "  - `openapi.Org1.Service2.yaml`",
        "",
        " Example Single service with versioning",
        "  - `openapi.v1.yaml`",
        "  - `openapi.v2.yaml`",
        "",
        " Example Multiple service with versioning",
        "  - `openapi.Org1.Service1.v1.yaml`",
        "  - `openapi.Org1.Service1.v2.yaml`",
        "  - `openapi.Org1.Service2.v1.0.yaml`",
        "  - `openapi.Org1.Service2.v1.1.yaml`    "
      ].join("\n")
    },
    "openapi-versions": {
      type: "array",
      items: {
        type: "string",
        enum: ["3.0.0", "3.1.0"],
        nullable: true,
        description: "The versions of OpenAPI to emit. Defaults to `[3.0.0]`"
      },
      nullable: true,
      uniqueItems: true,
      minItems: 1
    },
    "new-line": {
      type: "string",
      enum: ["crlf", "lf"],
      default: "lf",
      nullable: true,
      description: "Set the newline character for emitting files."
    },
    "omit-unreachable-types": {
      type: "boolean",
      nullable: true,
      description: "Omit unreachable types.\nBy default all types declared under the service namespace will be included. With this flag on only types references in an operation will be emitted."
    },
    "include-x-typespec-name": {
      type: "string",
      enum: ["inline-only", "never"],
      nullable: true,
      default: "never",
      description: "If the generated openapi types should have the `x-typespec-name` extension set with the name of the TypeSpec type that created it.\nThis extension is meant for debugging and should not be depended on."
    },
    "safeint-strategy": {
      type: "string",
      enum: ["double-int", "int64"],
      nullable: true,
      default: "int64",
      description: [
        "How to handle safeint type. Options are:",
        " - `double-int`: Will produce `type: integer, format: double-int`",
        " - `int64`: Will produce `type: integer, format: int64`",
        "",
        "Default: `int64`"
      ].join("\n")
    },
    "seal-object-schemas": {
      type: "boolean",
      nullable: true,
      default: false,
      description: [
        "If true, then for models emitted as object schemas we default `additionalProperties` to false for",
        "OpenAPI 3.0, and `unevaluatedProperties` to false for OpenAPI 3.1, if not explicitly specified elsewhere.",
        "Default: `false`"
      ].join("\n")
    },
    "experimental-parameter-examples": {
      type: "string",
      enum: ["data", "serialized"],
      nullable: true,
      description: [
        "Determines how to emit examples on parameters.",
        "Note: This is an experimental feature and may change in future versions.",
        "See https://spec.openapis.org/oas/v3.0.4.html#style-examples for parameter example serialization rules",
        "See https://github.com/OAI/OpenAPI-Specification/discussions/4622 for discussion on handling parameter examples."
      ].join("\n")
    }
  },
  required: []
};
var $lib = createTypeSpecLibrary({
  name: "@typespec/openapi3",
  capabilities: {
    dryRun: true
  },
  diagnostics: {
    "oneof-union": {
      severity: "error",
      messages: {
        default: "@oneOf decorator can only be used on a union or a model property which type is a union."
      }
    },
    "inconsistent-shared-route-request-visibility": {
      severity: "error",
      messages: {
        default: "All operations with `@sharedRoutes` must have the same `@requestVisibility`."
      }
    },
    "invalid-server-variable": {
      severity: "error",
      messages: {
        default: paramMessage`Server variable '${"propName"}' must be assignable to 'string'. It must either be a string, enum of string or union of strings.`
      }
    },
    "invalid-format": {
      severity: "warning",
      messages: {
        default: paramMessage`Collection format '${"value"}' is not supported in OpenAPI3 ${"paramType"} parameters. Defaulting to type 'string'.`
      }
    },
    "invalid-style": {
      severity: "warning",
      messages: {
        default: paramMessage`Style '${"style"}' is not supported in OpenAPI3 ${"paramType"} parameters. Defaulting to style 'simple'.`,
        optionalPath: paramMessage`Style '${"style"}' is not supported in OpenAPI3 ${"paramType"} parameters. The style ${"style"} could be introduced by an optional parameter. Defaulting to style 'simple'.`
      }
    },
    "path-reserved-expansion": {
      severity: "warning",
      messages: {
        default: `Reserved expansion of path parameter with '+' operator #{allowReserved: true} is not supported in OpenAPI3.`
      }
    },
    "resource-namespace": {
      severity: "error",
      messages: {
        default: "Resource goes on namespace"
      }
    },
    "path-query": {
      severity: "error",
      messages: {
        default: `OpenAPI does not allow paths containing a query string.`
      }
    },
    "duplicate-header": {
      severity: "error",
      messages: {
        default: paramMessage`The header ${"header"} is defined across multiple content types`
      }
    },
    "status-code-in-default-response": {
      severity: "error",
      messages: {
        default: "a default response should not have an explicit status code"
      }
    },
    "invalid-schema": {
      severity: "error",
      messages: {
        default: paramMessage`Couldn't get schema for type ${"type"}`
      }
    },
    "union-null": {
      severity: "error",
      messages: {
        default: "Cannot have a union containing only null types."
      }
    },
    "empty-union": {
      severity: "error",
      messages: {
        default: "Empty unions are not supported for OpenAPI v3 - enums must have at least one value."
      }
    },
    "empty-enum": {
      severity: "error",
      messages: {
        default: "Empty enums are not supported for OpenAPI v3 - enums must have at least one value."
      }
    },
    "enum-unique-type": {
      severity: "error",
      messages: {
        default: "Enums are not supported unless all options are literals of the same type."
      }
    },
    "inline-cycle": {
      severity: "error",
      messages: {
        default: paramMessage`Cycle detected in '${"type"}'. Use @friendlyName decorator to assign an OpenAPI definition name and make it non-inline.`
      }
    },
    "unsupported-status-code-range": {
      severity: "error",
      messages: {
        default: paramMessage`Status code range '${"start"} to '${"end"}' is not supported. OpenAPI 3.0 can only represent range 1XX, 2XX, 3XX, 4XX and 5XX. Example: \`@minValue(400) @maxValue(499)\` for 4XX.`
      }
    },
    "invalid-model-property": {
      severity: "error",
      messages: {
        default: paramMessage`'${"type"}' cannot be specified as a model property.`
      }
    },
    "unsupported-auth": {
      severity: "warning",
      messages: {
        default: paramMessage`Authentication "${"authType"}" is not a known authentication by the openapi3 emitter, it will be ignored.`
      }
    },
    "xml-attribute-invalid-property-type": {
      severity: "warning",
      messages: {
        default: paramMessage`XML \`@attribute\` can only be primitive types in the OpenAPI 3 emitter, Property '${"name"}' type will be changed to type: string.`
      }
    },
    "xml-unwrapped-invalid-property-type": {
      severity: "warning",
      messages: {
        default: paramMessage`XML \`@unwrapped\` can only used on array properties or primitive ones in the OpenAPI 3 emitter, Property '${"name"}' will be ignored.`
      }
    },
    "invalid-component-fixed-field-key": {
      severity: "warning",
      messages: {
        default: paramMessage`Invalid key '${"value"}' used in a fixed field of the Component object. Only alphanumerics, dot (.), hyphen (-), and underscore (_) characters are allowed in keys.`
      }
    }
  },
  emitter: {
    options: EmitterOptionsSchema
  }
});
var { createDiagnostic, reportDiagnostic, createStateSymbol } = $lib;

// src/typespec/core/packages/openapi3/dist/src/decorators.js
var refTargetsKey = createStateSymbol("refs");
var $useRef = (context, entity, refUrl) => {
  context.program.stateMap(refTargetsKey).set(entity, refUrl);
};
function getRef(program, entity) {
  return program.stateMap(refTargetsKey).get(entity);
}
var oneOfKey = createStateSymbol("oneOf");
var $oneOf = (context, entity) => {
  if (entity.kind === "ModelProperty" && entity.type.kind !== "Union") {
    reportDiagnostic(context.program, {
      code: "oneof-union",
      target: context.decoratorTarget
    });
  }
  context.program.stateMap(oneOfKey).set(entity, true);
};
function getOneOf(program, entity) {
  return program.stateMap(oneOfKey).get(entity);
}

// src/typespec/core/packages/openapi3/dist/src/openapi.js
import { compilerAssert as compilerAssert8, createDiagnosticCollector, emitFile as emitFile2, getAllTags, getAnyExtensionFromPath, getDoc as getDoc2, getFormat as getFormat2, getMaxItems as getMaxItems2, getMaxLength as getMaxLength2, getMaxValue as getMaxValue2, getMaxValueExclusive as getMaxValueExclusive3, getMinItems as getMinItems2, getMinLength as getMinLength2, getMinValue as getMinValue2, getMinValueExclusive as getMinValueExclusive3, getNamespaceFullName as getNamespaceFullName2, getPattern as getPattern2, getService, getSummary as getSummary2, ignoreDiagnostics as ignoreDiagnostics4, interpolatePath, isDeprecated, isGlobalNamespace, isNeverType as isNeverType2, isSecret as isSecret2, isVoidType, listServices, navigateTypesInNamespace as navigateTypesInNamespace2, resolvePath } from "@typespec/compiler";
import { unsafe_mutateSubgraphWithNamespace } from "@typespec/compiler/experimental";
import { $ as $5 } from "@typespec/compiler/typekit";
import { createMetadataInfo, getHttpService, getServers, getStatusCodeDescription, isOrExtendsHttpFile, isOverloadSameEndpoint, reportIfNoRoutes, resolveAuthentication, resolveRequestVisibility as resolveRequestVisibility2, Visibility as Visibility3 } from "@typespec/http";
import { getExtensions as getExtensions4, getExternalDocs as getExternalDocs3, getOpenAPITypeName as getOpenAPITypeName2, getParameterKey, getTagsMetadata, isReadonlyProperty as isReadonlyProperty2, resolveOperationId, shouldInline as shouldInline5 } from "@typespec/openapi";

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/nodes/identity.js
var ALIAS = Symbol.for("yaml.alias");
var DOC = Symbol.for("yaml.document");
var MAP = Symbol.for("yaml.map");
var PAIR = Symbol.for("yaml.pair");
var SCALAR = Symbol.for("yaml.scalar");
var SEQ = Symbol.for("yaml.seq");
var NODE_TYPE = Symbol.for("yaml.node.type");
var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
var isMap = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
var isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR;
var isSeq = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
function isCollection(node) {
  if (node && typeof node === "object")
    switch (node[NODE_TYPE]) {
      case MAP:
      case SEQ:
        return true;
    }
  return false;
}
function isNode(node) {
  if (node && typeof node === "object")
    switch (node[NODE_TYPE]) {
      case ALIAS:
      case MAP:
      case SCALAR:
      case SEQ:
        return true;
    }
  return false;
}
var hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/visit.js
var BREAK = Symbol("break visit");
var SKIP = Symbol("skip children");
var REMOVE = Symbol("remove node");
function visit(node, visitor) {
  const visitor_ = initVisitor(visitor);
  if (isDocument(node)) {
    const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
    if (cd === REMOVE)
      node.contents = null;
  } else
    visit_(null, node, visitor_, Object.freeze([]));
}
visit.BREAK = BREAK;
visit.SKIP = SKIP;
visit.REMOVE = REMOVE;
function visit_(key, node, visitor, path) {
  const ctrl = callVisitor(key, node, visitor, path);
  if (isNode(ctrl) || isPair(ctrl)) {
    replaceNode(key, path, ctrl);
    return visit_(key, ctrl, visitor, path);
  }
  if (typeof ctrl !== "symbol") {
    if (isCollection(node)) {
      path = Object.freeze(path.concat(node));
      for (let i = 0; i < node.items.length; ++i) {
        const ci = visit_(i, node.items[i], visitor, path);
        if (typeof ci === "number")
          i = ci - 1;
        else if (ci === BREAK)
          return BREAK;
        else if (ci === REMOVE) {
          node.items.splice(i, 1);
          i -= 1;
        }
      }
    } else if (isPair(node)) {
      path = Object.freeze(path.concat(node));
      const ck = visit_("key", node.key, visitor, path);
      if (ck === BREAK)
        return BREAK;
      else if (ck === REMOVE)
        node.key = null;
      const cv = visit_("value", node.value, visitor, path);
      if (cv === BREAK)
        return BREAK;
      else if (cv === REMOVE)
        node.value = null;
    }
  }
  return ctrl;
}
async function visitAsync(node, visitor) {
  const visitor_ = initVisitor(visitor);
  if (isDocument(node)) {
    const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));
    if (cd === REMOVE)
      node.contents = null;
  } else
    await visitAsync_(null, node, visitor_, Object.freeze([]));
}
visitAsync.BREAK = BREAK;
visitAsync.SKIP = SKIP;
visitAsync.REMOVE = REMOVE;
async function visitAsync_(key, node, visitor, path) {
  const ctrl = await callVisitor(key, node, visitor, path);
  if (isNode(ctrl) || isPair(ctrl)) {
    replaceNode(key, path, ctrl);
    return visitAsync_(key, ctrl, visitor, path);
  }
  if (typeof ctrl !== "symbol") {
    if (isCollection(node)) {
      path = Object.freeze(path.concat(node));
      for (let i = 0; i < node.items.length; ++i) {
        const ci = await visitAsync_(i, node.items[i], visitor, path);
        if (typeof ci === "number")
          i = ci - 1;
        else if (ci === BREAK)
          return BREAK;
        else if (ci === REMOVE) {
          node.items.splice(i, 1);
          i -= 1;
        }
      }
    } else if (isPair(node)) {
      path = Object.freeze(path.concat(node));
      const ck = await visitAsync_("key", node.key, visitor, path);
      if (ck === BREAK)
        return BREAK;
      else if (ck === REMOVE)
        node.key = null;
      const cv = await visitAsync_("value", node.value, visitor, path);
      if (cv === BREAK)
        return BREAK;
      else if (cv === REMOVE)
        node.value = null;
    }
  }
  return ctrl;
}
function initVisitor(visitor) {
  if (typeof visitor === "object" && (visitor.Collection || visitor.Node || visitor.Value)) {
    return Object.assign({
      Alias: visitor.Node,
      Map: visitor.Node,
      Scalar: visitor.Node,
      Seq: visitor.Node
    }, visitor.Value && {
      Map: visitor.Value,
      Scalar: visitor.Value,
      Seq: visitor.Value
    }, visitor.Collection && {
      Map: visitor.Collection,
      Seq: visitor.Collection
    }, visitor);
  }
  return visitor;
}
function callVisitor(key, node, visitor, path) {
  if (typeof visitor === "function")
    return visitor(key, node, path);
  if (isMap(node))
    return visitor.Map?.(key, node, path);
  if (isSeq(node))
    return visitor.Seq?.(key, node, path);
  if (isPair(node))
    return visitor.Pair?.(key, node, path);
  if (isScalar(node))
    return visitor.Scalar?.(key, node, path);
  if (isAlias(node))
    return visitor.Alias?.(key, node, path);
  return void 0;
}
function replaceNode(key, path, node) {
  const parent = path[path.length - 1];
  if (isCollection(parent)) {
    parent.items[key] = node;
  } else if (isPair(parent)) {
    if (key === "key")
      parent.key = node;
    else
      parent.value = node;
  } else if (isDocument(parent)) {
    parent.contents = node;
  } else {
    const pt = isAlias(parent) ? "alias" : "scalar";
    throw new Error(`Cannot replace node with ${pt} parent`);
  }
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/doc/directives.js
var escapeChars = {
  "!": "%21",
  ",": "%2C",
  "[": "%5B",
  "]": "%5D",
  "{": "%7B",
  "}": "%7D"
};
var escapeTagName = (tn) => tn.replace(/[!,[\]{}]/g, (ch) => escapeChars[ch]);
var Directives = class _Directives {
  constructor(yaml, tags) {
    this.docStart = null;
    this.docEnd = false;
    this.yaml = Object.assign({}, _Directives.defaultYaml, yaml);
    this.tags = Object.assign({}, _Directives.defaultTags, tags);
  }
  clone() {
    const copy = new _Directives(this.yaml, this.tags);
    copy.docStart = this.docStart;
    return copy;
  }
  /**
   * During parsing, get a Directives instance for the current document and
   * update the stream state according to the current version's spec.
   */
  atDocument() {
    const res = new _Directives(this.yaml, this.tags);
    switch (this.yaml.version) {
      case "1.1":
        this.atNextDocument = true;
        break;
      case "1.2":
        this.atNextDocument = false;
        this.yaml = {
          explicit: _Directives.defaultYaml.explicit,
          version: "1.2"
        };
        this.tags = Object.assign({}, _Directives.defaultTags);
        break;
    }
    return res;
  }
  /**
   * @param onError - May be called even if the action was successful
   * @returns `true` on success
   */
  add(line, onError) {
    if (this.atNextDocument) {
      this.yaml = { explicit: _Directives.defaultYaml.explicit, version: "1.1" };
      this.tags = Object.assign({}, _Directives.defaultTags);
      this.atNextDocument = false;
    }
    const parts = line.trim().split(/[ \t]+/);
    const name = parts.shift();
    switch (name) {
      case "%TAG": {
        if (parts.length !== 2) {
          onError(0, "%TAG directive should contain exactly two parts");
          if (parts.length < 2)
            return false;
        }
        const [handle, prefix] = parts;
        this.tags[handle] = prefix;
        return true;
      }
      case "%YAML": {
        this.yaml.explicit = true;
        if (parts.length !== 1) {
          onError(0, "%YAML directive should contain exactly one part");
          return false;
        }
        const [version3] = parts;
        if (version3 === "1.1" || version3 === "1.2") {
          this.yaml.version = version3;
          return true;
        } else {
          const isValid = /^\d+\.\d+$/.test(version3);
          onError(6, `Unsupported YAML version ${version3}`, isValid);
          return false;
        }
      }
      default:
        onError(0, `Unknown directive ${name}`, true);
        return false;
    }
  }
  /**
   * Resolves a tag, matching handles to those defined in %TAG directives.
   *
   * @returns Resolved tag, which may also be the non-specific tag `'!'` or a
   *   `'!local'` tag, or `null` if unresolvable.
   */
  tagName(source, onError) {
    if (source === "!")
      return "!";
    if (source[0] !== "!") {
      onError(`Not a valid tag: ${source}`);
      return null;
    }
    if (source[1] === "<") {
      const verbatim = source.slice(2, -1);
      if (verbatim === "!" || verbatim === "!!") {
        onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);
        return null;
      }
      if (source[source.length - 1] !== ">")
        onError("Verbatim tags must end with a >");
      return verbatim;
    }
    const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);
    if (!suffix)
      onError(`The ${source} tag has no suffix`);
    const prefix = this.tags[handle];
    if (prefix) {
      try {
        return prefix + decodeURIComponent(suffix);
      } catch (error) {
        onError(String(error));
        return null;
      }
    }
    if (handle === "!")
      return source;
    onError(`Could not resolve tag: ${source}`);
    return null;
  }
  /**
   * Given a fully resolved tag, returns its printable string form,
   * taking into account current tag prefixes and defaults.
   */
  tagString(tag) {
    for (const [handle, prefix] of Object.entries(this.tags)) {
      if (tag.startsWith(prefix))
        return handle + escapeTagName(tag.substring(prefix.length));
    }
    return tag[0] === "!" ? tag : `!<${tag}>`;
  }
  toString(doc) {
    const lines = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [];
    const tagEntries = Object.entries(this.tags);
    let tagNames;
    if (doc && tagEntries.length > 0 && isNode(doc.contents)) {
      const tags = {};
      visit(doc.contents, (_key, node) => {
        if (isNode(node) && node.tag)
          tags[node.tag] = true;
      });
      tagNames = Object.keys(tags);
    } else
      tagNames = [];
    for (const [handle, prefix] of tagEntries) {
      if (handle === "!!" && prefix === "tag:yaml.org,2002:")
        continue;
      if (!doc || tagNames.some((tn) => tn.startsWith(prefix)))
        lines.push(`%TAG ${handle} ${prefix}`);
    }
    return lines.join("\n");
  }
};
Directives.defaultYaml = { explicit: false, version: "1.2" };
Directives.defaultTags = { "!!": "tag:yaml.org,2002:" };

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/doc/anchors.js
function anchorIsValid(anchor) {
  if (/[\x00-\x19\s,[\]{}]/.test(anchor)) {
    const sa = JSON.stringify(anchor);
    const msg = `Anchor must not contain whitespace or control characters: ${sa}`;
    throw new Error(msg);
  }
  return true;
}
function anchorNames(root) {
  const anchors = /* @__PURE__ */ new Set();
  visit(root, {
    Value(_key, node) {
      if (node.anchor)
        anchors.add(node.anchor);
    }
  });
  return anchors;
}
function findNewAnchor(prefix, exclude) {
  for (let i = 1; true; ++i) {
    const name = `${prefix}${i}`;
    if (!exclude.has(name))
      return name;
  }
}
function createNodeAnchors(doc, prefix) {
  const aliasObjects = [];
  const sourceObjects = /* @__PURE__ */ new Map();
  let prevAnchors = null;
  return {
    onAnchor: (source) => {
      aliasObjects.push(source);
      prevAnchors ?? (prevAnchors = anchorNames(doc));
      const anchor = findNewAnchor(prefix, prevAnchors);
      prevAnchors.add(anchor);
      return anchor;
    },
    /**
     * With circular references, the source node is only resolved after all
     * of its child nodes are. This is why anchors are set only after all of
     * the nodes have been created.
     */
    setAnchors: () => {
      for (const source of aliasObjects) {
        const ref = sourceObjects.get(source);
        if (typeof ref === "object" && ref.anchor && (isScalar(ref.node) || isCollection(ref.node))) {
          ref.node.anchor = ref.anchor;
        } else {
          const error = new Error("Failed to resolve repeated object (this should not happen)");
          error.source = source;
          throw error;
        }
      }
    },
    sourceObjects
  };
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/doc/applyReviver.js
function applyReviver(reviver, obj, key, val) {
  if (val && typeof val === "object") {
    if (Array.isArray(val)) {
      for (let i = 0, len = val.length; i < len; ++i) {
        const v0 = val[i];
        const v1 = applyReviver(reviver, val, String(i), v0);
        if (v1 === void 0)
          delete val[i];
        else if (v1 !== v0)
          val[i] = v1;
      }
    } else if (val instanceof Map) {
      for (const k of Array.from(val.keys())) {
        const v0 = val.get(k);
        const v1 = applyReviver(reviver, val, k, v0);
        if (v1 === void 0)
          val.delete(k);
        else if (v1 !== v0)
          val.set(k, v1);
      }
    } else if (val instanceof Set) {
      for (const v0 of Array.from(val)) {
        const v1 = applyReviver(reviver, val, v0, v0);
        if (v1 === void 0)
          val.delete(v0);
        else if (v1 !== v0) {
          val.delete(v0);
          val.add(v1);
        }
      }
    } else {
      for (const [k, v0] of Object.entries(val)) {
        const v1 = applyReviver(reviver, val, k, v0);
        if (v1 === void 0)
          delete val[k];
        else if (v1 !== v0)
          val[k] = v1;
      }
    }
  }
  return reviver.call(obj, key, val);
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/nodes/toJS.js
function toJS(value, arg, ctx) {
  if (Array.isArray(value))
    return value.map((v, i) => toJS(v, String(i), ctx));
  if (value && typeof value.toJSON === "function") {
    if (!ctx || !hasAnchor(value))
      return value.toJSON(arg, ctx);
    const data = { aliasCount: 0, count: 1, res: void 0 };
    ctx.anchors.set(value, data);
    ctx.onCreate = (res2) => {
      data.res = res2;
      delete ctx.onCreate;
    };
    const res = value.toJSON(arg, ctx);
    if (ctx.onCreate)
      ctx.onCreate(res);
    return res;
  }
  if (typeof value === "bigint" && !ctx?.keep)
    return Number(value);
  return value;
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/nodes/Node.js
var NodeBase = class {
  constructor(type) {
    Object.defineProperty(this, NODE_TYPE, { value: type });
  }
  /** Create a copy of this node.  */
  clone() {
    const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
    if (this.range)
      copy.range = this.range.slice();
    return copy;
  }
  /** A plain JavaScript representation of this node. */
  toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
    if (!isDocument(doc))
      throw new TypeError("A document argument is required");
    const ctx = {
      anchors: /* @__PURE__ */ new Map(),
      doc,
      keep: true,
      mapAsMap: mapAsMap === true,
      mapKeyWarned: false,
      maxAliasCount: typeof maxAliasCount === "number" ? maxAliasCount : 100
    };
    const res = toJS(this, "", ctx);
    if (typeof onAnchor === "function")
      for (const { count, res: res2 } of ctx.anchors.values())
        onAnchor(res2, count);
    return typeof reviver === "function" ? applyReviver(reviver, { "": res }, "", res) : res;
  }
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/nodes/Alias.js
var Alias = class extends NodeBase {
  constructor(source) {
    super(ALIAS);
    this.source = source;
    Object.defineProperty(this, "tag", {
      set() {
        throw new Error("Alias nodes cannot have tags");
      }
    });
  }
  /**
   * Resolve the value of this alias within `doc`, finding the last
   * instance of the `source` anchor before this node.
   */
  resolve(doc, ctx) {
    let nodes;
    if (ctx?.aliasResolveCache) {
      nodes = ctx.aliasResolveCache;
    } else {
      nodes = [];
      visit(doc, {
        Node: (_key, node) => {
          if (isAlias(node) || hasAnchor(node))
            nodes.push(node);
        }
      });
      if (ctx)
        ctx.aliasResolveCache = nodes;
    }
    let found = void 0;
    for (const node of nodes) {
      if (node === this)
        break;
      if (node.anchor === this.source)
        found = node;
    }
    return found;
  }
  toJSON(_arg, ctx) {
    if (!ctx)
      return { source: this.source };
    const { anchors, doc, maxAliasCount } = ctx;
    const source = this.resolve(doc, ctx);
    if (!source) {
      const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
      throw new ReferenceError(msg);
    }
    let data = anchors.get(source);
    if (!data) {
      toJS(source, null, ctx);
      data = anchors.get(source);
    }
    if (!data || data.res === void 0) {
      const msg = "This should not happen: Alias anchor was not resolved?";
      throw new ReferenceError(msg);
    }
    if (maxAliasCount >= 0) {
      data.count += 1;
      if (data.aliasCount === 0)
        data.aliasCount = getAliasCount(doc, source, anchors);
      if (data.count * data.aliasCount > maxAliasCount) {
        const msg = "Excessive alias count indicates a resource exhaustion attack";
        throw new ReferenceError(msg);
      }
    }
    return data.res;
  }
  toString(ctx, _onComment, _onChompKeep) {
    const src = `*${this.source}`;
    if (ctx) {
      anchorIsValid(this.source);
      if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {
        const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
        throw new Error(msg);
      }
      if (ctx.implicitKey)
        return `${src} `;
    }
    return src;
  }
};
function getAliasCount(doc, node, anchors) {
  if (isAlias(node)) {
    const source = node.resolve(doc);
    const anchor = anchors && source && anchors.get(source);
    return anchor ? anchor.count * anchor.aliasCount : 0;
  } else if (isCollection(node)) {
    let count = 0;
    for (const item of node.items) {
      const c = getAliasCount(doc, item, anchors);
      if (c > count)
        count = c;
    }
    return count;
  } else if (isPair(node)) {
    const kc = getAliasCount(doc, node.key, anchors);
    const vc = getAliasCount(doc, node.value, anchors);
    return Math.max(kc, vc);
  }
  return 1;
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/nodes/Scalar.js
var isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
var Scalar = class extends NodeBase {
  constructor(value) {
    super(SCALAR);
    this.value = value;
  }
  toJSON(arg, ctx) {
    return ctx?.keep ? this.value : toJS(this.value, arg, ctx);
  }
  toString() {
    return String(this.value);
  }
};
Scalar.BLOCK_FOLDED = "BLOCK_FOLDED";
Scalar.BLOCK_LITERAL = "BLOCK_LITERAL";
Scalar.PLAIN = "PLAIN";
Scalar.QUOTE_DOUBLE = "QUOTE_DOUBLE";
Scalar.QUOTE_SINGLE = "QUOTE_SINGLE";

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/doc/createNode.js
var defaultTagPrefix = "tag:yaml.org,2002:";
function findTagObject(value, tagName, tags) {
  if (tagName) {
    const match = tags.filter((t) => t.tag === tagName);
    const tagObj = match.find((t) => !t.format) ?? match[0];
    if (!tagObj)
      throw new Error(`Tag ${tagName} not found`);
    return tagObj;
  }
  return tags.find((t) => t.identify?.(value) && !t.format);
}
function createNode(value, tagName, ctx) {
  if (isDocument(value))
    value = value.contents;
  if (isNode(value))
    return value;
  if (isPair(value)) {
    const map2 = ctx.schema[MAP].createNode?.(ctx.schema, null, ctx);
    map2.items.push(value);
    return map2;
  }
  if (value instanceof String || value instanceof Number || value instanceof Boolean || typeof BigInt !== "undefined" && value instanceof BigInt) {
    value = value.valueOf();
  }
  const { aliasDuplicateObjects, onAnchor, onTagObj, schema: schema4, sourceObjects } = ctx;
  let ref = void 0;
  if (aliasDuplicateObjects && value && typeof value === "object") {
    ref = sourceObjects.get(value);
    if (ref) {
      ref.anchor ?? (ref.anchor = onAnchor(value));
      return new Alias(ref.anchor);
    } else {
      ref = { anchor: null, node: null };
      sourceObjects.set(value, ref);
    }
  }
  if (tagName?.startsWith("!!"))
    tagName = defaultTagPrefix + tagName.slice(2);
  let tagObj = findTagObject(value, tagName, schema4.tags);
  if (!tagObj) {
    if (value && typeof value.toJSON === "function") {
      value = value.toJSON();
    }
    if (!value || typeof value !== "object") {
      const node2 = new Scalar(value);
      if (ref)
        ref.node = node2;
      return node2;
    }
    tagObj = value instanceof Map ? schema4[MAP] : Symbol.iterator in Object(value) ? schema4[SEQ] : schema4[MAP];
  }
  if (onTagObj) {
    onTagObj(tagObj);
    delete ctx.onTagObj;
  }
  const node = tagObj?.createNode ? tagObj.createNode(ctx.schema, value, ctx) : typeof tagObj?.nodeClass?.from === "function" ? tagObj.nodeClass.from(ctx.schema, value, ctx) : new Scalar(value);
  if (tagName)
    node.tag = tagName;
  else if (!tagObj.default)
    node.tag = tagObj.tag;
  if (ref)
    ref.node = node;
  return node;
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/nodes/Collection.js
function collectionFromPath(schema4, path, value) {
  let v = value;
  for (let i = path.length - 1; i >= 0; --i) {
    const k = path[i];
    if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
      const a = [];
      a[k] = v;
      v = a;
    } else {
      v = /* @__PURE__ */ new Map([[k, v]]);
    }
  }
  return createNode(v, void 0, {
    aliasDuplicateObjects: false,
    keepUndefined: false,
    onAnchor: () => {
      throw new Error("This should not happen, please report a bug.");
    },
    schema: schema4,
    sourceObjects: /* @__PURE__ */ new Map()
  });
}
var isEmptyPath = (path) => path == null || typeof path === "object" && !!path[Symbol.iterator]().next().done;
var Collection = class extends NodeBase {
  constructor(type, schema4) {
    super(type);
    Object.defineProperty(this, "schema", {
      value: schema4,
      configurable: true,
      enumerable: false,
      writable: true
    });
  }
  /**
   * Create a copy of this collection.
   *
   * @param schema - If defined, overwrites the original's schema
   */
  clone(schema4) {
    const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
    if (schema4)
      copy.schema = schema4;
    copy.items = copy.items.map((it) => isNode(it) || isPair(it) ? it.clone(schema4) : it);
    if (this.range)
      copy.range = this.range.slice();
    return copy;
  }
  /**
   * Adds a value to the collection. For `!!map` and `!!omap` the value must
   * be a Pair instance or a `{ key, value }` object, which may not have a key
   * that already exists in the map.
   */
  addIn(path, value) {
    if (isEmptyPath(path))
      this.add(value);
    else {
      const [key, ...rest] = path;
      const node = this.get(key, true);
      if (isCollection(node))
        node.addIn(rest, value);
      else if (node === void 0 && this.schema)
        this.set(key, collectionFromPath(this.schema, rest, value));
      else
        throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
    }
  }
  /**
   * Removes a value from the collection.
   * @returns `true` if the item was found and removed.
   */
  deleteIn(path) {
    const [key, ...rest] = path;
    if (rest.length === 0)
      return this.delete(key);
    const node = this.get(key, true);
    if (isCollection(node))
      return node.deleteIn(rest);
    else
      throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
  }
  /**
   * Returns item at `key`, or `undefined` if not found. By default unwraps
   * scalar values from their surrounding node; to disable set `keepScalar` to
   * `true` (collections are always returned intact).
   */
  getIn(path, keepScalar) {
    const [key, ...rest] = path;
    const node = this.get(key, true);
    if (rest.length === 0)
      return !keepScalar && isScalar(node) ? node.value : node;
    else
      return isCollection(node) ? node.getIn(rest, keepScalar) : void 0;
  }
  hasAllNullValues(allowScalar) {
    return this.items.every((node) => {
      if (!isPair(node))
        return false;
      const n = node.value;
      return n == null || allowScalar && isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
    });
  }
  /**
   * Checks if the collection includes a value with the key `key`.
   */
  hasIn(path) {
    const [key, ...rest] = path;
    if (rest.length === 0)
      return this.has(key);
    const node = this.get(key, true);
    return isCollection(node) ? node.hasIn(rest) : false;
  }
  /**
   * Sets a value in this collection. For `!!set`, `value` needs to be a
   * boolean to add/remove the item from the set.
   */
  setIn(path, value) {
    const [key, ...rest] = path;
    if (rest.length === 0) {
      this.set(key, value);
    } else {
      const node = this.get(key, true);
      if (isCollection(node))
        node.setIn(rest, value);
      else if (node === void 0 && this.schema)
        this.set(key, collectionFromPath(this.schema, rest, value));
      else
        throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
    }
  }
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/stringify/stringifyComment.js
var stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, "#");
function indentComment(comment, indent) {
  if (/^\n+$/.test(comment))
    return comment.substring(1);
  return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
}
var lineComment = (str, indent, comment) => str.endsWith("\n") ? indentComment(comment, indent) : comment.includes("\n") ? "\n" + indentComment(comment, indent) : (str.endsWith(" ") ? "" : " ") + comment;

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/stringify/foldFlowLines.js
var FOLD_FLOW = "flow";
var FOLD_BLOCK = "block";
var FOLD_QUOTED = "quoted";
function foldFlowLines(text, indent, mode = "flow", { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {
  if (!lineWidth || lineWidth < 0)
    return text;
  if (lineWidth < minContentWidth)
    minContentWidth = 0;
  const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);
  if (text.length <= endStep)
    return text;
  const folds = [];
  const escapedFolds = {};
  let end = lineWidth - indent.length;
  if (typeof indentAtStart === "number") {
    if (indentAtStart > lineWidth - Math.max(2, minContentWidth))
      folds.push(0);
    else
      end = lineWidth - indentAtStart;
  }
  let split = void 0;
  let prev = void 0;
  let overflow = false;
  let i = -1;
  let escStart = -1;
  let escEnd = -1;
  if (mode === FOLD_BLOCK) {
    i = consumeMoreIndentedLines(text, i, indent.length);
    if (i !== -1)
      end = i + endStep;
  }
  for (let ch; ch = text[i += 1]; ) {
    if (mode === FOLD_QUOTED && ch === "\\") {
      escStart = i;
      switch (text[i + 1]) {
        case "x":
          i += 3;
          break;
        case "u":
          i += 5;
          break;
        case "U":
          i += 9;
          break;
        default:
          i += 1;
      }
      escEnd = i;
    }
    if (ch === "\n") {
      if (mode === FOLD_BLOCK)
        i = consumeMoreIndentedLines(text, i, indent.length);
      end = i + indent.length + endStep;
      split = void 0;
    } else {
      if (ch === " " && prev && prev !== " " && prev !== "\n" && prev !== "	") {
        const next = text[i + 1];
        if (next && next !== " " && next !== "\n" && next !== "	")
          split = i;
      }
      if (i >= end) {
        if (split) {
          folds.push(split);
          end = split + endStep;
          split = void 0;
        } else if (mode === FOLD_QUOTED) {
          while (prev === " " || prev === "	") {
            prev = ch;
            ch = text[i += 1];
            overflow = true;
          }
          const j = i > escEnd + 1 ? i - 2 : escStart - 1;
          if (escapedFolds[j])
            return text;
          folds.push(j);
          escapedFolds[j] = true;
          end = j + endStep;
          split = void 0;
        } else {
          overflow = true;
        }
      }
    }
    prev = ch;
  }
  if (overflow && onOverflow)
    onOverflow();
  if (folds.length === 0)
    return text;
  if (onFold)
    onFold();
  let res = text.slice(0, folds[0]);
  for (let i2 = 0; i2 < folds.length; ++i2) {
    const fold = folds[i2];
    const end2 = folds[i2 + 1] || text.length;
    if (fold === 0)
      res = `
${indent}${text.slice(0, end2)}`;
    else {
      if (mode === FOLD_QUOTED && escapedFolds[fold])
        res += `${text[fold]}\\`;
      res += `
${indent}${text.slice(fold + 1, end2)}`;
    }
  }
  return res;
}
function consumeMoreIndentedLines(text, i, indent) {
  let end = i;
  let start = i + 1;
  let ch = text[start];
  while (ch === " " || ch === "	") {
    if (i < start + indent) {
      ch = text[++i];
    } else {
      do {
        ch = text[++i];
      } while (ch && ch !== "\n");
      end = i;
      start = i + 1;
      ch = text[start];
    }
  }
  return end;
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/stringify/stringifyString.js
var getFoldOptions = (ctx, isBlock) => ({
  indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
  lineWidth: ctx.options.lineWidth,
  minContentWidth: ctx.options.minContentWidth
});
var containsDocumentMarker = (str) => /^(%|---|\.\.\.)/m.test(str);
function lineLengthOverLimit(str, lineWidth, indentLength) {
  if (!lineWidth || lineWidth < 0)
    return false;
  const limit = lineWidth - indentLength;
  const strLen = str.length;
  if (strLen <= limit)
    return false;
  for (let i = 0, start = 0; i < strLen; ++i) {
    if (str[i] === "\n") {
      if (i - start > limit)
        return true;
      start = i + 1;
      if (strLen - start <= limit)
        return false;
    }
  }
  return true;
}
function doubleQuotedString(value, ctx) {
  const json = JSON.stringify(value);
  if (ctx.options.doubleQuotedAsJSON)
    return json;
  const { implicitKey } = ctx;
  const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
  const indent = ctx.indent || (containsDocumentMarker(value) ? "  " : "");
  let str = "";
  let start = 0;
  for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
    if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
      str += json.slice(start, i) + "\\ ";
      i += 1;
      start = i;
      ch = "\\";
    }
    if (ch === "\\")
      switch (json[i + 1]) {
        case "u":
          {
            str += json.slice(start, i);
            const code2 = json.substr(i + 2, 4);
            switch (code2) {
              case "0000":
                str += "\\0";
                break;
              case "0007":
                str += "\\a";
                break;
              case "000b":
                str += "\\v";
                break;
              case "001b":
                str += "\\e";
                break;
              case "0085":
                str += "\\N";
                break;
              case "00a0":
                str += "\\_";
                break;
              case "2028":
                str += "\\L";
                break;
              case "2029":
                str += "\\P";
                break;
              default:
                if (code2.substr(0, 2) === "00")
                  str += "\\x" + code2.substr(2);
                else
                  str += json.substr(i, 6);
            }
            i += 5;
            start = i + 1;
          }
          break;
        case "n":
          if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
            i += 1;
          } else {
            str += json.slice(start, i) + "\n\n";
            while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
              str += "\n";
              i += 2;
            }
            str += indent;
            if (json[i + 2] === " ")
              str += "\\";
            i += 1;
            start = i + 1;
          }
          break;
        default:
          i += 1;
      }
  }
  str = start ? str + json.slice(start) : json;
  return implicitKey ? str : foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx, false));
}
function singleQuotedString(value, ctx) {
  if (ctx.options.singleQuote === false || ctx.implicitKey && value.includes("\n") || /[ \t]\n|\n[ \t]/.test(value))
    return doubleQuotedString(value, ctx);
  const indent = ctx.indent || (containsDocumentMarker(value) ? "  " : "");
  const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&
${indent}`) + "'";
  return ctx.implicitKey ? res : foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx, false));
}
function quotedString(value, ctx) {
  const { singleQuote } = ctx.options;
  let qs;
  if (singleQuote === false)
    qs = doubleQuotedString;
  else {
    const hasDouble = value.includes('"');
    const hasSingle = value.includes("'");
    if (hasDouble && !hasSingle)
      qs = singleQuotedString;
    else if (hasSingle && !hasDouble)
      qs = doubleQuotedString;
    else
      qs = singleQuote ? singleQuotedString : doubleQuotedString;
  }
  return qs(value, ctx);
}
var blockEndNewlines;
try {
  blockEndNewlines = new RegExp("(^|(?<!\n))\n+(?!\n|$)", "g");
} catch {
  blockEndNewlines = /\n+(?!\n|$)/g;
}
function blockString({ comment, type, value }, ctx, onComment, onChompKeep) {
  const { blockQuote, commentString, lineWidth } = ctx.options;
  if (!blockQuote || /\n[\t ]+$/.test(value)) {
    return quotedString(value, ctx);
  }
  const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? "  " : "");
  const literal = blockQuote === "literal" ? true : blockQuote === "folded" || type === Scalar.BLOCK_FOLDED ? false : type === Scalar.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, lineWidth, indent.length);
  if (!value)
    return literal ? "|\n" : ">\n";
  let chomp;
  let endStart;
  for (endStart = value.length; endStart > 0; --endStart) {
    const ch = value[endStart - 1];
    if (ch !== "\n" && ch !== "	" && ch !== " ")
      break;
  }
  let end = value.substring(endStart);
  const endNlPos = end.indexOf("\n");
  if (endNlPos === -1) {
    chomp = "-";
  } else if (value === end || endNlPos !== end.length - 1) {
    chomp = "+";
    if (onChompKeep)
      onChompKeep();
  } else {
    chomp = "";
  }
  if (end) {
    value = value.slice(0, -end.length);
    if (end[end.length - 1] === "\n")
      end = end.slice(0, -1);
    end = end.replace(blockEndNewlines, `$&${indent}`);
  }
  let startWithSpace = false;
  let startEnd;
  let startNlPos = -1;
  for (startEnd = 0; startEnd < value.length; ++startEnd) {
    const ch = value[startEnd];
    if (ch === " ")
      startWithSpace = true;
    else if (ch === "\n")
      startNlPos = startEnd;
    else
      break;
  }
  let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);
  if (start) {
    value = value.substring(start.length);
    start = start.replace(/\n+/g, `$&${indent}`);
  }
  const indentSize = indent ? "2" : "1";
  let header = (startWithSpace ? indentSize : "") + chomp;
  if (comment) {
    header += " " + commentString(comment.replace(/ ?[\r\n]+/g, " "));
    if (onComment)
      onComment();
  }
  if (!literal) {
    const foldedValue = value.replace(/\n+/g, "\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, "$1$2").replace(/\n+/g, `$&${indent}`);
    let literalFallback = false;
    const foldOptions = getFoldOptions(ctx, true);
    if (blockQuote !== "folded" && type !== Scalar.BLOCK_FOLDED) {
      foldOptions.onOverflow = () => {
        literalFallback = true;
      };
    }
    const body = foldFlowLines(`${start}${foldedValue}${end}`, indent, FOLD_BLOCK, foldOptions);
    if (!literalFallback)
      return `>${header}
${indent}${body}`;
  }
  value = value.replace(/\n+/g, `$&${indent}`);
  return `|${header}
${indent}${start}${value}${end}`;
}
function plainString(item, ctx, onComment, onChompKeep) {
  const { type, value } = item;
  const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;
  if (implicitKey && value.includes("\n") || inFlow && /[[\]{},]/.test(value)) {
    return quotedString(value, ctx);
  }
  if (/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) {
    return implicitKey || inFlow || !value.includes("\n") ? quotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep);
  }
  if (!implicitKey && !inFlow && type !== Scalar.PLAIN && value.includes("\n")) {
    return blockString(item, ctx, onComment, onChompKeep);
  }
  if (containsDocumentMarker(value)) {
    if (indent === "") {
      ctx.forceBlockIndent = true;
      return blockString(item, ctx, onComment, onChompKeep);
    } else if (implicitKey && indent === indentStep) {
      return quotedString(value, ctx);
    }
  }
  const str = value.replace(/\n+/g, `$&
${indent}`);
  if (actualString) {
    const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(str);
    const { compat, tags } = ctx.doc.schema;
    if (tags.some(test) || compat?.some(test))
      return quotedString(value, ctx);
  }
  return implicitKey ? str : foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx, false));
}
function stringifyString(item, ctx, onComment, onChompKeep) {
  const { implicitKey, inFlow } = ctx;
  const ss = typeof item.value === "string" ? item : Object.assign({}, item, { value: String(item.value) });
  let { type } = item;
  if (type !== Scalar.QUOTE_DOUBLE) {
    if (/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(ss.value))
      type = Scalar.QUOTE_DOUBLE;
  }
  const _stringify = (_type) => {
    switch (_type) {
      case Scalar.BLOCK_FOLDED:
      case Scalar.BLOCK_LITERAL:
        return implicitKey || inFlow ? quotedString(ss.value, ctx) : blockString(ss, ctx, onComment, onChompKeep);
      case Scalar.QUOTE_DOUBLE:
        return doubleQuotedString(ss.value, ctx);
      case Scalar.QUOTE_SINGLE:
        return singleQuotedString(ss.value, ctx);
      case Scalar.PLAIN:
        return plainString(ss, ctx, onComment, onChompKeep);
      default:
        return null;
    }
  };
  let res = _stringify(type);
  if (res === null) {
    const { defaultKeyType, defaultStringType } = ctx.options;
    const t = implicitKey && defaultKeyType || defaultStringType;
    res = _stringify(t);
    if (res === null)
      throw new Error(`Unsupported default string type ${t}`);
  }
  return res;
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/stringify/stringify.js
function createStringifyContext(doc, options) {
  const opt = Object.assign({
    blockQuote: true,
    commentString: stringifyComment,
    defaultKeyType: null,
    defaultStringType: "PLAIN",
    directives: null,
    doubleQuotedAsJSON: false,
    doubleQuotedMinMultiLineLength: 40,
    falseStr: "false",
    flowCollectionPadding: true,
    indentSeq: true,
    lineWidth: 80,
    minContentWidth: 20,
    nullStr: "null",
    simpleKeys: false,
    singleQuote: null,
    trueStr: "true",
    verifyAliasOrder: true
  }, doc.schema.toStringOptions, options);
  let inFlow;
  switch (opt.collectionStyle) {
    case "block":
      inFlow = false;
      break;
    case "flow":
      inFlow = true;
      break;
    default:
      inFlow = null;
  }
  return {
    anchors: /* @__PURE__ */ new Set(),
    doc,
    flowCollectionPadding: opt.flowCollectionPadding ? " " : "",
    indent: "",
    indentStep: typeof opt.indent === "number" ? " ".repeat(opt.indent) : "  ",
    inFlow,
    options: opt
  };
}
function getTagObject(tags, item) {
  if (item.tag) {
    const match = tags.filter((t) => t.tag === item.tag);
    if (match.length > 0)
      return match.find((t) => t.format === item.format) ?? match[0];
  }
  let tagObj = void 0;
  let obj;
  if (isScalar(item)) {
    obj = item.value;
    let match = tags.filter((t) => t.identify?.(obj));
    if (match.length > 1) {
      const testMatch = match.filter((t) => t.test);
      if (testMatch.length > 0)
        match = testMatch;
    }
    tagObj = match.find((t) => t.format === item.format) ?? match.find((t) => !t.format);
  } else {
    obj = item;
    tagObj = tags.find((t) => t.nodeClass && obj instanceof t.nodeClass);
  }
  if (!tagObj) {
    const name = obj?.constructor?.name ?? (obj === null ? "null" : typeof obj);
    throw new Error(`Tag not resolved for ${name} value`);
  }
  return tagObj;
}
function stringifyProps(node, tagObj, { anchors, doc }) {
  if (!doc.directives)
    return "";
  const props = [];
  const anchor = (isScalar(node) || isCollection(node)) && node.anchor;
  if (anchor && anchorIsValid(anchor)) {
    anchors.add(anchor);
    props.push(`&${anchor}`);
  }
  const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
  if (tag)
    props.push(doc.directives.tagString(tag));
  return props.join(" ");
}
function stringify(item, ctx, onComment, onChompKeep) {
  if (isPair(item))
    return item.toString(ctx, onComment, onChompKeep);
  if (isAlias(item)) {
    if (ctx.doc.directives)
      return item.toString(ctx);
    if (ctx.resolvedAliases?.has(item)) {
      throw new TypeError(`Cannot stringify circular structure without alias nodes`);
    } else {
      if (ctx.resolvedAliases)
        ctx.resolvedAliases.add(item);
      else
        ctx.resolvedAliases = /* @__PURE__ */ new Set([item]);
      item = item.resolve(ctx.doc);
    }
  }
  let tagObj = void 0;
  const node = isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o) => tagObj = o });
  tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
  const props = stringifyProps(node, tagObj, ctx);
  if (props.length > 0)
    ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
  const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : isScalar(node) ? stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
  if (!props)
    return str;
  return isScalar(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
${ctx.indent}${str}`;
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/stringify/stringifyPair.js
function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
  const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
  let keyComment = isNode(key) && key.comment || null;
  if (simpleKeys) {
    if (keyComment) {
      throw new Error("With simple keys, key nodes cannot have comments");
    }
    if (isCollection(key) || !isNode(key) && typeof key === "object") {
      const msg = "With simple keys, collection cannot be used as a key value";
      throw new Error(msg);
    }
  }
  let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || isCollection(key) || (isScalar(key) ? key.type === Scalar.BLOCK_FOLDED || key.type === Scalar.BLOCK_LITERAL : typeof key === "object"));
  ctx = Object.assign({}, ctx, {
    allNullValues: false,
    implicitKey: !explicitKey && (simpleKeys || !allNullValues),
    indent: indent + indentStep
  });
  let keyCommentDone = false;
  let chompKeep = false;
  let str = stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
  if (!explicitKey && !ctx.inFlow && str.length > 1024) {
    if (simpleKeys)
      throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
    explicitKey = true;
  }
  if (ctx.inFlow) {
    if (allNullValues || value == null) {
      if (keyCommentDone && onComment)
        onComment();
      return str === "" ? "?" : explicitKey ? `? ${str}` : str;
    }
  } else if (allNullValues && !simpleKeys || value == null && explicitKey) {
    str = `? ${str}`;
    if (keyComment && !keyCommentDone) {
      str += lineComment(str, ctx.indent, commentString(keyComment));
    } else if (chompKeep && onChompKeep)
      onChompKeep();
    return str;
  }
  if (keyCommentDone)
    keyComment = null;
  if (explicitKey) {
    if (keyComment)
      str += lineComment(str, ctx.indent, commentString(keyComment));
    str = `? ${str}
${indent}:`;
  } else {
    str = `${str}:`;
    if (keyComment)
      str += lineComment(str, ctx.indent, commentString(keyComment));
  }
  let vsb, vcb, valueComment;
  if (isNode(value)) {
    vsb = !!value.spaceBefore;
    vcb = value.commentBefore;
    valueComment = value.comment;
  } else {
    vsb = false;
    vcb = null;
    valueComment = null;
    if (value && typeof value === "object")
      value = doc.createNode(value);
  }
  ctx.implicitKey = false;
  if (!explicitKey && !keyComment && isScalar(value))
    ctx.indentAtStart = str.length + 1;
  chompKeep = false;
  if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && isSeq(value) && !value.flow && !value.tag && !value.anchor) {
    ctx.indent = ctx.indent.substring(2);
  }
  let valueCommentDone = false;
  const valueStr = stringify(value, ctx, () => valueCommentDone = true, () => chompKeep = true);
  let ws = " ";
  if (keyComment || vsb || vcb) {
    ws = vsb ? "\n" : "";
    if (vcb) {
      const cs = commentString(vcb);
      ws += `
${indentComment(cs, ctx.indent)}`;
    }
    if (valueStr === "" && !ctx.inFlow) {
      if (ws === "\n")
        ws = "\n\n";
    } else {
      ws += `
${ctx.indent}`;
    }
  } else if (!explicitKey && isCollection(value)) {
    const vs0 = valueStr[0];
    const nl0 = valueStr.indexOf("\n");
    const hasNewline = nl0 !== -1;
    const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0;
    if (hasNewline || !flow) {
      let hasPropsLine = false;
      if (hasNewline && (vs0 === "&" || vs0 === "!")) {
        let sp0 = valueStr.indexOf(" ");
        if (vs0 === "&" && sp0 !== -1 && sp0 < nl0 && valueStr[sp0 + 1] === "!") {
          sp0 = valueStr.indexOf(" ", sp0 + 1);
        }
        if (sp0 === -1 || nl0 < sp0)
          hasPropsLine = true;
      }
      if (!hasPropsLine)
        ws = `
${ctx.indent}`;
    }
  } else if (valueStr === "" || valueStr[0] === "\n") {
    ws = "";
  }
  str += ws + valueStr;
  if (ctx.inFlow) {
    if (valueCommentDone && onComment)
      onComment();
  } else if (valueComment && !valueCommentDone) {
    str += lineComment(str, ctx.indent, commentString(valueComment));
  } else if (chompKeep && onChompKeep) {
    onChompKeep();
  }
  return str;
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/log.js
function warn(logLevel, warning) {
  if (logLevel === "debug" || logLevel === "warn") {
    console.warn(warning);
  }
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js
var MERGE_KEY = "<<";
var merge = {
  identify: (value) => value === MERGE_KEY || typeof value === "symbol" && value.description === MERGE_KEY,
  default: "key",
  tag: "tag:yaml.org,2002:merge",
  test: /^<<$/,
  resolve: () => Object.assign(new Scalar(Symbol(MERGE_KEY)), {
    addToJSMap: addMergeToJSMap
  }),
  stringify: () => MERGE_KEY
};
var isMergeKey = (ctx, key) => (merge.identify(key) || isScalar(key) && (!key.type || key.type === Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
function addMergeToJSMap(ctx, map2, value) {
  value = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
  if (isSeq(value))
    for (const it of value.items)
      mergeValue(ctx, map2, it);
  else if (Array.isArray(value))
    for (const it of value)
      mergeValue(ctx, map2, it);
  else
    mergeValue(ctx, map2, value);
}
function mergeValue(ctx, map2, value) {
  const source = ctx && isAlias(value) ? value.resolve(ctx.doc) : value;
  if (!isMap(source))
    throw new Error("Merge sources must be maps or map aliases");
  const srcMap = source.toJSON(null, ctx, Map);
  for (const [key, value2] of srcMap) {
    if (map2 instanceof Map) {
      if (!map2.has(key))
        map2.set(key, value2);
    } else if (map2 instanceof Set) {
      map2.add(key);
    } else if (!Object.prototype.hasOwnProperty.call(map2, key)) {
      Object.defineProperty(map2, key, {
        value: value2,
        writable: true,
        enumerable: true,
        configurable: true
      });
    }
  }
  return map2;
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js
function addPairToJSMap(ctx, map2, { key, value }) {
  if (isNode(key) && key.addToJSMap)
    key.addToJSMap(ctx, map2, value);
  else if (isMergeKey(ctx, key))
    addMergeToJSMap(ctx, map2, value);
  else {
    const jsKey = toJS(key, "", ctx);
    if (map2 instanceof Map) {
      map2.set(jsKey, toJS(value, jsKey, ctx));
    } else if (map2 instanceof Set) {
      map2.add(jsKey);
    } else {
      const stringKey = stringifyKey(key, jsKey, ctx);
      const jsValue = toJS(value, stringKey, ctx);
      if (stringKey in map2)
        Object.defineProperty(map2, stringKey, {
          value: jsValue,
          writable: true,
          enumerable: true,
          configurable: true
        });
      else
        map2[stringKey] = jsValue;
    }
  }
  return map2;
}
function stringifyKey(key, jsKey, ctx) {
  if (jsKey === null)
    return "";
  if (typeof jsKey !== "object")
    return String(jsKey);
  if (isNode(key) && ctx?.doc) {
    const strCtx = createStringifyContext(ctx.doc, {});
    strCtx.anchors = /* @__PURE__ */ new Set();
    for (const node of ctx.anchors.keys())
      strCtx.anchors.add(node.anchor);
    strCtx.inFlow = true;
    strCtx.inStringifyKey = true;
    const strKey = key.toString(strCtx);
    if (!ctx.mapKeyWarned) {
      let jsonStr = JSON.stringify(strKey);
      if (jsonStr.length > 40)
        jsonStr = jsonStr.substring(0, 36) + '..."';
      warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);
      ctx.mapKeyWarned = true;
    }
    return strKey;
  }
  return JSON.stringify(jsKey);
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/nodes/Pair.js
function createPair(key, value, ctx) {
  const k = createNode(key, void 0, ctx);
  const v = createNode(value, void 0, ctx);
  return new Pair(k, v);
}
var Pair = class _Pair {
  constructor(key, value = null) {
    Object.defineProperty(this, NODE_TYPE, { value: PAIR });
    this.key = key;
    this.value = value;
  }
  clone(schema4) {
    let { key, value } = this;
    if (isNode(key))
      key = key.clone(schema4);
    if (isNode(value))
      value = value.clone(schema4);
    return new _Pair(key, value);
  }
  toJSON(_, ctx) {
    const pair = ctx?.mapAsMap ? /* @__PURE__ */ new Map() : {};
    return addPairToJSMap(ctx, pair, this);
  }
  toString(ctx, onComment, onChompKeep) {
    return ctx?.doc ? stringifyPair(this, ctx, onComment, onChompKeep) : JSON.stringify(this);
  }
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/stringify/stringifyCollection.js
function stringifyCollection(collection, ctx, options) {
  const flow = ctx.inFlow ?? collection.flow;
  const stringify4 = flow ? stringifyFlowCollection : stringifyBlockCollection;
  return stringify4(collection, ctx, options);
}
function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
  const { indent, options: { commentString } } = ctx;
  const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });
  let chompKeep = false;
  const lines = [];
  for (let i = 0; i < items.length; ++i) {
    const item = items[i];
    let comment2 = null;
    if (isNode(item)) {
      if (!chompKeep && item.spaceBefore)
        lines.push("");
      addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
      if (item.comment)
        comment2 = item.comment;
    } else if (isPair(item)) {
      const ik = isNode(item.key) ? item.key : null;
      if (ik) {
        if (!chompKeep && ik.spaceBefore)
          lines.push("");
        addCommentBefore(ctx, lines, ik.commentBefore, chompKeep);
      }
    }
    chompKeep = false;
    let str2 = stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
    if (comment2)
      str2 += lineComment(str2, itemIndent, commentString(comment2));
    if (chompKeep && comment2)
      chompKeep = false;
    lines.push(blockItemPrefix + str2);
  }
  let str;
  if (lines.length === 0) {
    str = flowChars.start + flowChars.end;
  } else {
    str = lines[0];
    for (let i = 1; i < lines.length; ++i) {
      const line = lines[i];
      str += line ? `
${indent}${line}` : "\n";
    }
  }
  if (comment) {
    str += "\n" + indentComment(commentString(comment), indent);
    if (onComment)
      onComment();
  } else if (chompKeep && onChompKeep)
    onChompKeep();
  return str;
}
function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
  const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
  itemIndent += indentStep;
  const itemCtx = Object.assign({}, ctx, {
    indent: itemIndent,
    inFlow: true,
    type: null
  });
  let reqNewline = false;
  let linesAtValue = 0;
  const lines = [];
  for (let i = 0; i < items.length; ++i) {
    const item = items[i];
    let comment = null;
    if (isNode(item)) {
      if (item.spaceBefore)
        lines.push("");
      addCommentBefore(ctx, lines, item.commentBefore, false);
      if (item.comment)
        comment = item.comment;
    } else if (isPair(item)) {
      const ik = isNode(item.key) ? item.key : null;
      if (ik) {
        if (ik.spaceBefore)
          lines.push("");
        addCommentBefore(ctx, lines, ik.commentBefore, false);
        if (ik.comment)
          reqNewline = true;
      }
      const iv = isNode(item.value) ? item.value : null;
      if (iv) {
        if (iv.comment)
          comment = iv.comment;
        if (iv.commentBefore)
          reqNewline = true;
      } else if (item.value == null && ik?.comment) {
        comment = ik.comment;
      }
    }
    if (comment)
      reqNewline = true;
    let str = stringify(item, itemCtx, () => comment = null);
    if (i < items.length - 1)
      str += ",";
    if (comment)
      str += lineComment(str, itemIndent, commentString(comment));
    if (!reqNewline && (lines.length > linesAtValue || str.includes("\n")))
      reqNewline = true;
    lines.push(str);
    linesAtValue = lines.length;
  }
  const { start, end } = flowChars;
  if (lines.length === 0) {
    return start + end;
  } else {
    if (!reqNewline) {
      const len = lines.reduce((sum, line) => sum + line.length + 2, 2);
      reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
    }
    if (reqNewline) {
      let str = start;
      for (const line of lines)
        str += line ? `
${indentStep}${indent}${line}` : "\n";
      return `${str}
${indent}${end}`;
    } else {
      return `${start}${fcPadding}${lines.join(" ")}${fcPadding}${end}`;
    }
  }
}
function addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {
  if (comment && chompKeep)
    comment = comment.replace(/^\n+/, "");
  if (comment) {
    const ic = indentComment(commentString(comment), indent);
    lines.push(ic.trimStart());
  }
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/nodes/YAMLMap.js
function findPair(items, key) {
  const k = isScalar(key) ? key.value : key;
  for (const it of items) {
    if (isPair(it)) {
      if (it.key === key || it.key === k)
        return it;
      if (isScalar(it.key) && it.key.value === k)
        return it;
    }
  }
  return void 0;
}
var YAMLMap = class extends Collection {
  static get tagName() {
    return "tag:yaml.org,2002:map";
  }
  constructor(schema4) {
    super(MAP, schema4);
    this.items = [];
  }
  /**
   * A generic collection parsing method that can be extended
   * to other node classes that inherit from YAMLMap
   */
  static from(schema4, obj, ctx) {
    const { keepUndefined, replacer } = ctx;
    const map2 = new this(schema4);
    const add = (key, value) => {
      if (typeof replacer === "function")
        value = replacer.call(obj, key, value);
      else if (Array.isArray(replacer) && !replacer.includes(key))
        return;
      if (value !== void 0 || keepUndefined)
        map2.items.push(createPair(key, value, ctx));
    };
    if (obj instanceof Map) {
      for (const [key, value] of obj)
        add(key, value);
    } else if (obj && typeof obj === "object") {
      for (const key of Object.keys(obj))
        add(key, obj[key]);
    }
    if (typeof schema4.sortMapEntries === "function") {
      map2.items.sort(schema4.sortMapEntries);
    }
    return map2;
  }
  /**
   * Adds a value to the collection.
   *
   * @param overwrite - If not set `true`, using a key that is already in the
   *   collection will throw. Otherwise, overwrites the previous value.
   */
  add(pair, overwrite) {
    let _pair;
    if (isPair(pair))
      _pair = pair;
    else if (!pair || typeof pair !== "object" || !("key" in pair)) {
      _pair = new Pair(pair, pair?.value);
    } else
      _pair = new Pair(pair.key, pair.value);
    const prev = findPair(this.items, _pair.key);
    const sortEntries = this.schema?.sortMapEntries;
    if (prev) {
      if (!overwrite)
        throw new Error(`Key ${_pair.key} already set`);
      if (isScalar(prev.value) && isScalarValue(_pair.value))
        prev.value.value = _pair.value;
      else
        prev.value = _pair.value;
    } else if (sortEntries) {
      const i = this.items.findIndex((item) => sortEntries(_pair, item) < 0);
      if (i === -1)
        this.items.push(_pair);
      else
        this.items.splice(i, 0, _pair);
    } else {
      this.items.push(_pair);
    }
  }
  delete(key) {
    const it = findPair(this.items, key);
    if (!it)
      return false;
    const del = this.items.splice(this.items.indexOf(it), 1);
    return del.length > 0;
  }
  get(key, keepScalar) {
    const it = findPair(this.items, key);
    const node = it?.value;
    return (!keepScalar && isScalar(node) ? node.value : node) ?? void 0;
  }
  has(key) {
    return !!findPair(this.items, key);
  }
  set(key, value) {
    this.add(new Pair(key, value), true);
  }
  /**
   * @param ctx - Conversion context, originally set in Document#toJS()
   * @param {Class} Type - If set, forces the returned collection type
   * @returns Instance of Type, Map, or Object
   */
  toJSON(_, ctx, Type) {
    const map2 = Type ? new Type() : ctx?.mapAsMap ? /* @__PURE__ */ new Map() : {};
    if (ctx?.onCreate)
      ctx.onCreate(map2);
    for (const item of this.items)
      addPairToJSMap(ctx, map2, item);
    return map2;
  }
  toString(ctx, onComment, onChompKeep) {
    if (!ctx)
      return JSON.stringify(this);
    for (const item of this.items) {
      if (!isPair(item))
        throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
    }
    if (!ctx.allNullValues && this.hasAllNullValues(false))
      ctx = Object.assign({}, ctx, { allNullValues: true });
    return stringifyCollection(this, ctx, {
      blockItemPrefix: "",
      flowChars: { start: "{", end: "}" },
      itemIndent: ctx.indent || "",
      onChompKeep,
      onComment
    });
  }
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/common/map.js
var map = {
  collection: "map",
  default: true,
  nodeClass: YAMLMap,
  tag: "tag:yaml.org,2002:map",
  resolve(map2, onError) {
    if (!isMap(map2))
      onError("Expected a mapping for this tag");
    return map2;
  },
  createNode: (schema4, obj, ctx) => YAMLMap.from(schema4, obj, ctx)
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/nodes/YAMLSeq.js
var YAMLSeq = class extends Collection {
  static get tagName() {
    return "tag:yaml.org,2002:seq";
  }
  constructor(schema4) {
    super(SEQ, schema4);
    this.items = [];
  }
  add(value) {
    this.items.push(value);
  }
  /**
   * Removes a value from the collection.
   *
   * `key` must contain a representation of an integer for this to succeed.
   * It may be wrapped in a `Scalar`.
   *
   * @returns `true` if the item was found and removed.
   */
  delete(key) {
    const idx = asItemIndex(key);
    if (typeof idx !== "number")
      return false;
    const del = this.items.splice(idx, 1);
    return del.length > 0;
  }
  get(key, keepScalar) {
    const idx = asItemIndex(key);
    if (typeof idx !== "number")
      return void 0;
    const it = this.items[idx];
    return !keepScalar && isScalar(it) ? it.value : it;
  }
  /**
   * Checks if the collection includes a value with the key `key`.
   *
   * `key` must contain a representation of an integer for this to succeed.
   * It may be wrapped in a `Scalar`.
   */
  has(key) {
    const idx = asItemIndex(key);
    return typeof idx === "number" && idx < this.items.length;
  }
  /**
   * Sets a value in this collection. For `!!set`, `value` needs to be a
   * boolean to add/remove the item from the set.
   *
   * If `key` does not contain a representation of an integer, this will throw.
   * It may be wrapped in a `Scalar`.
   */
  set(key, value) {
    const idx = asItemIndex(key);
    if (typeof idx !== "number")
      throw new Error(`Expected a valid index, not ${key}.`);
    const prev = this.items[idx];
    if (isScalar(prev) && isScalarValue(value))
      prev.value = value;
    else
      this.items[idx] = value;
  }
  toJSON(_, ctx) {
    const seq2 = [];
    if (ctx?.onCreate)
      ctx.onCreate(seq2);
    let i = 0;
    for (const item of this.items)
      seq2.push(toJS(item, String(i++), ctx));
    return seq2;
  }
  toString(ctx, onComment, onChompKeep) {
    if (!ctx)
      return JSON.stringify(this);
    return stringifyCollection(this, ctx, {
      blockItemPrefix: "- ",
      flowChars: { start: "[", end: "]" },
      itemIndent: (ctx.indent || "") + "  ",
      onChompKeep,
      onComment
    });
  }
  static from(schema4, obj, ctx) {
    const { replacer } = ctx;
    const seq2 = new this(schema4);
    if (obj && Symbol.iterator in Object(obj)) {
      let i = 0;
      for (let it of obj) {
        if (typeof replacer === "function") {
          const key = obj instanceof Set ? it : String(i++);
          it = replacer.call(obj, key, it);
        }
        seq2.items.push(createNode(it, void 0, ctx));
      }
    }
    return seq2;
  }
};
function asItemIndex(key) {
  let idx = isScalar(key) ? key.value : key;
  if (idx && typeof idx === "string")
    idx = Number(idx);
  return typeof idx === "number" && Number.isInteger(idx) && idx >= 0 ? idx : null;
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/common/seq.js
var seq = {
  collection: "seq",
  default: true,
  nodeClass: YAMLSeq,
  tag: "tag:yaml.org,2002:seq",
  resolve(seq2, onError) {
    if (!isSeq(seq2))
      onError("Expected a sequence for this tag");
    return seq2;
  },
  createNode: (schema4, obj, ctx) => YAMLSeq.from(schema4, obj, ctx)
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/common/string.js
var string = {
  identify: (value) => typeof value === "string",
  default: true,
  tag: "tag:yaml.org,2002:str",
  resolve: (str) => str,
  stringify(item, ctx, onComment, onChompKeep) {
    ctx = Object.assign({ actualString: true }, ctx);
    return stringifyString(item, ctx, onComment, onChompKeep);
  }
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/common/null.js
var nullTag = {
  identify: (value) => value == null,
  createNode: () => new Scalar(null),
  default: true,
  tag: "tag:yaml.org,2002:null",
  test: /^(?:~|[Nn]ull|NULL)?$/,
  resolve: () => new Scalar(null),
  stringify: ({ source }, ctx) => typeof source === "string" && nullTag.test.test(source) ? source : ctx.options.nullStr
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/core/bool.js
var boolTag = {
  identify: (value) => typeof value === "boolean",
  default: true,
  tag: "tag:yaml.org,2002:bool",
  test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
  resolve: (str) => new Scalar(str[0] === "t" || str[0] === "T"),
  stringify({ source, value }, ctx) {
    if (source && boolTag.test.test(source)) {
      const sv = source[0] === "t" || source[0] === "T";
      if (value === sv)
        return source;
    }
    return value ? ctx.options.trueStr : ctx.options.falseStr;
  }
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/stringify/stringifyNumber.js
function stringifyNumber({ format: format3, minFractionDigits, tag, value }) {
  if (typeof value === "bigint")
    return String(value);
  const num = typeof value === "number" ? value : Number(value);
  if (!isFinite(num))
    return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
  let n = JSON.stringify(value);
  if (!format3 && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^\d/.test(n)) {
    let i = n.indexOf(".");
    if (i < 0) {
      i = n.length;
      n += ".";
    }
    let d = minFractionDigits - (n.length - i - 1);
    while (d-- > 0)
      n += "0";
  }
  return n;
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/core/float.js
var floatNaN = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
  resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
  stringify: stringifyNumber
};
var floatExp = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  format: "EXP",
  test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
  resolve: (str) => parseFloat(str),
  stringify(node) {
    const num = Number(node.value);
    return isFinite(num) ? num.toExponential() : stringifyNumber(node);
  }
};
var float = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
  resolve(str) {
    const node = new Scalar(parseFloat(str));
    const dot = str.indexOf(".");
    if (dot !== -1 && str[str.length - 1] === "0")
      node.minFractionDigits = str.length - dot - 1;
    return node;
  },
  stringify: stringifyNumber
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/core/int.js
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
var intResolve = (str, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix);
function intStringify(node, radix, prefix) {
  const { value } = node;
  if (intIdentify(value) && value >= 0)
    return prefix + value.toString(radix);
  return stringifyNumber(node);
}
var intOct = {
  identify: (value) => intIdentify(value) && value >= 0,
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "OCT",
  test: /^0o[0-7]+$/,
  resolve: (str, _onError, opt) => intResolve(str, 2, 8, opt),
  stringify: (node) => intStringify(node, 8, "0o")
};
var int = {
  identify: intIdentify,
  default: true,
  tag: "tag:yaml.org,2002:int",
  test: /^[-+]?[0-9]+$/,
  resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),
  stringify: stringifyNumber
};
var intHex = {
  identify: (value) => intIdentify(value) && value >= 0,
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "HEX",
  test: /^0x[0-9a-fA-F]+$/,
  resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),
  stringify: (node) => intStringify(node, 16, "0x")
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/core/schema.js
var schema = [
  map,
  seq,
  string,
  nullTag,
  boolTag,
  intOct,
  int,
  intHex,
  floatNaN,
  floatExp,
  float
];

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/json/schema.js
function intIdentify2(value) {
  return typeof value === "bigint" || Number.isInteger(value);
}
var stringifyJSON = ({ value }) => JSON.stringify(value);
var jsonScalars = [
  {
    identify: (value) => typeof value === "string",
    default: true,
    tag: "tag:yaml.org,2002:str",
    resolve: (str) => str,
    stringify: stringifyJSON
  },
  {
    identify: (value) => value == null,
    createNode: () => new Scalar(null),
    default: true,
    tag: "tag:yaml.org,2002:null",
    test: /^null$/,
    resolve: () => null,
    stringify: stringifyJSON
  },
  {
    identify: (value) => typeof value === "boolean",
    default: true,
    tag: "tag:yaml.org,2002:bool",
    test: /^true$|^false$/,
    resolve: (str) => str === "true",
    stringify: stringifyJSON
  },
  {
    identify: intIdentify2,
    default: true,
    tag: "tag:yaml.org,2002:int",
    test: /^-?(?:0|[1-9][0-9]*)$/,
    resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),
    stringify: ({ value }) => intIdentify2(value) ? value.toString() : JSON.stringify(value)
  },
  {
    identify: (value) => typeof value === "number",
    default: true,
    tag: "tag:yaml.org,2002:float",
    test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
    resolve: (str) => parseFloat(str),
    stringify: stringifyJSON
  }
];
var jsonError = {
  default: true,
  tag: "",
  test: /^/,
  resolve(str, onError) {
    onError(`Unresolved plain scalar ${JSON.stringify(str)}`);
    return str;
  }
};
var schema2 = [map, seq].concat(jsonScalars, jsonError);

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js
var binary = {
  identify: (value) => value instanceof Uint8Array,
  // Buffer inherits from Uint8Array
  default: false,
  tag: "tag:yaml.org,2002:binary",
  /**
   * Returns a Buffer in node and an Uint8Array in browsers
   *
   * To use the resulting buffer as an image, you'll want to do something like:
   *
   *   const blob = new Blob([buffer], { type: 'image/jpeg' })
   *   document.querySelector('#photo').src = URL.createObjectURL(blob)
   */
  resolve(src, onError) {
    if (typeof atob === "function") {
      const str = atob(src.replace(/[\n\r]/g, ""));
      const buffer = new Uint8Array(str.length);
      for (let i = 0; i < str.length; ++i)
        buffer[i] = str.charCodeAt(i);
      return buffer;
    } else {
      onError("This environment does not support reading binary tags; either Buffer or atob is required");
      return src;
    }
  },
  stringify({ comment, type, value }, ctx, onComment, onChompKeep) {
    if (!value)
      return "";
    const buf = value;
    let str;
    if (typeof btoa === "function") {
      let s = "";
      for (let i = 0; i < buf.length; ++i)
        s += String.fromCharCode(buf[i]);
      str = btoa(s);
    } else {
      throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
    }
    type ?? (type = Scalar.BLOCK_LITERAL);
    if (type !== Scalar.QUOTE_DOUBLE) {
      const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
      const n = Math.ceil(str.length / lineWidth);
      const lines = new Array(n);
      for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
        lines[i] = str.substr(o, lineWidth);
      }
      str = lines.join(type === Scalar.BLOCK_LITERAL ? "\n" : " ");
    }
    return stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);
  }
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js
function resolvePairs(seq2, onError) {
  if (isSeq(seq2)) {
    for (let i = 0; i < seq2.items.length; ++i) {
      let item = seq2.items[i];
      if (isPair(item))
        continue;
      else if (isMap(item)) {
        if (item.items.length > 1)
          onError("Each pair must have its own sequence indicator");
        const pair = item.items[0] || new Pair(new Scalar(null));
        if (item.commentBefore)
          pair.key.commentBefore = pair.key.commentBefore ? `${item.commentBefore}
${pair.key.commentBefore}` : item.commentBefore;
        if (item.comment) {
          const cn = pair.value ?? pair.key;
          cn.comment = cn.comment ? `${item.comment}
${cn.comment}` : item.comment;
        }
        item = pair;
      }
      seq2.items[i] = isPair(item) ? item : new Pair(item);
    }
  } else
    onError("Expected a sequence for this tag");
  return seq2;
}
function createPairs(schema4, iterable, ctx) {
  const { replacer } = ctx;
  const pairs2 = new YAMLSeq(schema4);
  pairs2.tag = "tag:yaml.org,2002:pairs";
  let i = 0;
  if (iterable && Symbol.iterator in Object(iterable))
    for (let it of iterable) {
      if (typeof replacer === "function")
        it = replacer.call(iterable, String(i++), it);
      let key, value;
      if (Array.isArray(it)) {
        if (it.length === 2) {
          key = it[0];
          value = it[1];
        } else
          throw new TypeError(`Expected [key, value] tuple: ${it}`);
      } else if (it && it instanceof Object) {
        const keys = Object.keys(it);
        if (keys.length === 1) {
          key = keys[0];
          value = it[key];
        } else {
          throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);
        }
      } else {
        key = it;
      }
      pairs2.items.push(createPair(key, value, ctx));
    }
  return pairs2;
}
var pairs = {
  collection: "seq",
  default: false,
  tag: "tag:yaml.org,2002:pairs",
  resolve: resolvePairs,
  createNode: createPairs
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js
var YAMLOMap = class _YAMLOMap extends YAMLSeq {
  constructor() {
    super();
    this.add = YAMLMap.prototype.add.bind(this);
    this.delete = YAMLMap.prototype.delete.bind(this);
    this.get = YAMLMap.prototype.get.bind(this);
    this.has = YAMLMap.prototype.has.bind(this);
    this.set = YAMLMap.prototype.set.bind(this);
    this.tag = _YAMLOMap.tag;
  }
  /**
   * If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
   * but TypeScript won't allow widening the signature of a child method.
   */
  toJSON(_, ctx) {
    if (!ctx)
      return super.toJSON(_);
    const map2 = /* @__PURE__ */ new Map();
    if (ctx?.onCreate)
      ctx.onCreate(map2);
    for (const pair of this.items) {
      let key, value;
      if (isPair(pair)) {
        key = toJS(pair.key, "", ctx);
        value = toJS(pair.value, key, ctx);
      } else {
        key = toJS(pair, "", ctx);
      }
      if (map2.has(key))
        throw new Error("Ordered maps must not include duplicate keys");
      map2.set(key, value);
    }
    return map2;
  }
  static from(schema4, iterable, ctx) {
    const pairs2 = createPairs(schema4, iterable, ctx);
    const omap2 = new this();
    omap2.items = pairs2.items;
    return omap2;
  }
};
YAMLOMap.tag = "tag:yaml.org,2002:omap";
var omap = {
  collection: "seq",
  identify: (value) => value instanceof Map,
  nodeClass: YAMLOMap,
  default: false,
  tag: "tag:yaml.org,2002:omap",
  resolve(seq2, onError) {
    const pairs2 = resolvePairs(seq2, onError);
    const seenKeys = [];
    for (const { key } of pairs2.items) {
      if (isScalar(key)) {
        if (seenKeys.includes(key.value)) {
          onError(`Ordered maps must not include duplicate keys: ${key.value}`);
        } else {
          seenKeys.push(key.value);
        }
      }
    }
    return Object.assign(new YAMLOMap(), pairs2);
  },
  createNode: (schema4, iterable, ctx) => YAMLOMap.from(schema4, iterable, ctx)
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js
function boolStringify({ value, source }, ctx) {
  const boolObj = value ? trueTag : falseTag;
  if (source && boolObj.test.test(source))
    return source;
  return value ? ctx.options.trueStr : ctx.options.falseStr;
}
var trueTag = {
  identify: (value) => value === true,
  default: true,
  tag: "tag:yaml.org,2002:bool",
  test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,
  resolve: () => new Scalar(true),
  stringify: boolStringify
};
var falseTag = {
  identify: (value) => value === false,
  default: true,
  tag: "tag:yaml.org,2002:bool",
  test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,
  resolve: () => new Scalar(false),
  stringify: boolStringify
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js
var floatNaN2 = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
  resolve: (str) => str.slice(-3).toLowerCase() === "nan" ? NaN : str[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
  stringify: stringifyNumber
};
var floatExp2 = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  format: "EXP",
  test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
  resolve: (str) => parseFloat(str.replace(/_/g, "")),
  stringify(node) {
    const num = Number(node.value);
    return isFinite(num) ? num.toExponential() : stringifyNumber(node);
  }
};
var float2 = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
  resolve(str) {
    const node = new Scalar(parseFloat(str.replace(/_/g, "")));
    const dot = str.indexOf(".");
    if (dot !== -1) {
      const f = str.substring(dot + 1).replace(/_/g, "");
      if (f[f.length - 1] === "0")
        node.minFractionDigits = f.length;
    }
    return node;
  },
  stringify: stringifyNumber
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js
var intIdentify3 = (value) => typeof value === "bigint" || Number.isInteger(value);
function intResolve2(str, offset, radix, { intAsBigInt }) {
  const sign = str[0];
  if (sign === "-" || sign === "+")
    offset += 1;
  str = str.substring(offset).replace(/_/g, "");
  if (intAsBigInt) {
    switch (radix) {
      case 2:
        str = `0b${str}`;
        break;
      case 8:
        str = `0o${str}`;
        break;
      case 16:
        str = `0x${str}`;
        break;
    }
    const n2 = BigInt(str);
    return sign === "-" ? BigInt(-1) * n2 : n2;
  }
  const n = parseInt(str, radix);
  return sign === "-" ? -1 * n : n;
}
function intStringify2(node, radix, prefix) {
  const { value } = node;
  if (intIdentify3(value)) {
    const str = value.toString(radix);
    return value < 0 ? "-" + prefix + str.substr(1) : prefix + str;
  }
  return stringifyNumber(node);
}
var intBin = {
  identify: intIdentify3,
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "BIN",
  test: /^[-+]?0b[0-1_]+$/,
  resolve: (str, _onError, opt) => intResolve2(str, 2, 2, opt),
  stringify: (node) => intStringify2(node, 2, "0b")
};
var intOct2 = {
  identify: intIdentify3,
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "OCT",
  test: /^[-+]?0[0-7_]+$/,
  resolve: (str, _onError, opt) => intResolve2(str, 1, 8, opt),
  stringify: (node) => intStringify2(node, 8, "0")
};
var int2 = {
  identify: intIdentify3,
  default: true,
  tag: "tag:yaml.org,2002:int",
  test: /^[-+]?[0-9][0-9_]*$/,
  resolve: (str, _onError, opt) => intResolve2(str, 0, 10, opt),
  stringify: stringifyNumber
};
var intHex2 = {
  identify: intIdentify3,
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "HEX",
  test: /^[-+]?0x[0-9a-fA-F_]+$/,
  resolve: (str, _onError, opt) => intResolve2(str, 2, 16, opt),
  stringify: (node) => intStringify2(node, 16, "0x")
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js
var YAMLSet = class _YAMLSet extends YAMLMap {
  constructor(schema4) {
    super(schema4);
    this.tag = _YAMLSet.tag;
  }
  add(key) {
    let pair;
    if (isPair(key))
      pair = key;
    else if (key && typeof key === "object" && "key" in key && "value" in key && key.value === null)
      pair = new Pair(key.key, null);
    else
      pair = new Pair(key, null);
    const prev = findPair(this.items, pair.key);
    if (!prev)
      this.items.push(pair);
  }
  /**
   * If `keepPair` is `true`, returns the Pair matching `key`.
   * Otherwise, returns the value of that Pair's key.
   */
  get(key, keepPair) {
    const pair = findPair(this.items, key);
    return !keepPair && isPair(pair) ? isScalar(pair.key) ? pair.key.value : pair.key : pair;
  }
  set(key, value) {
    if (typeof value !== "boolean")
      throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
    const prev = findPair(this.items, key);
    if (prev && !value) {
      this.items.splice(this.items.indexOf(prev), 1);
    } else if (!prev && value) {
      this.items.push(new Pair(key));
    }
  }
  toJSON(_, ctx) {
    return super.toJSON(_, ctx, Set);
  }
  toString(ctx, onComment, onChompKeep) {
    if (!ctx)
      return JSON.stringify(this);
    if (this.hasAllNullValues(true))
      return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);
    else
      throw new Error("Set items must all have null values");
  }
  static from(schema4, iterable, ctx) {
    const { replacer } = ctx;
    const set2 = new this(schema4);
    if (iterable && Symbol.iterator in Object(iterable))
      for (let value of iterable) {
        if (typeof replacer === "function")
          value = replacer.call(iterable, value, value);
        set2.items.push(createPair(value, null, ctx));
      }
    return set2;
  }
};
YAMLSet.tag = "tag:yaml.org,2002:set";
var set = {
  collection: "map",
  identify: (value) => value instanceof Set,
  nodeClass: YAMLSet,
  default: false,
  tag: "tag:yaml.org,2002:set",
  createNode: (schema4, iterable, ctx) => YAMLSet.from(schema4, iterable, ctx),
  resolve(map2, onError) {
    if (isMap(map2)) {
      if (map2.hasAllNullValues(true))
        return Object.assign(new YAMLSet(), map2);
      else
        onError("Set items must all have null values");
    } else
      onError("Expected a mapping for this tag");
    return map2;
  }
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js
function parseSexagesimal(str, asBigInt) {
  const sign = str[0];
  const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
  const num = (n) => asBigInt ? BigInt(n) : Number(n);
  const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num(60) + num(p), num(0));
  return sign === "-" ? num(-1) * res : res;
}
function stringifySexagesimal(node) {
  let { value } = node;
  let num = (n) => n;
  if (typeof value === "bigint")
    num = (n) => BigInt(n);
  else if (isNaN(value) || !isFinite(value))
    return stringifyNumber(node);
  let sign = "";
  if (value < 0) {
    sign = "-";
    value *= num(-1);
  }
  const _60 = num(60);
  const parts = [value % _60];
  if (value < 60) {
    parts.unshift(0);
  } else {
    value = (value - parts[0]) / _60;
    parts.unshift(value % _60);
    if (value >= 60) {
      value = (value - parts[0]) / _60;
      parts.unshift(value);
    }
  }
  return sign + parts.map((n) => String(n).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
}
var intTime = {
  identify: (value) => typeof value === "bigint" || Number.isInteger(value),
  default: true,
  tag: "tag:yaml.org,2002:int",
  format: "TIME",
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
  resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),
  stringify: stringifySexagesimal
};
var floatTime = {
  identify: (value) => typeof value === "number",
  default: true,
  tag: "tag:yaml.org,2002:float",
  format: "TIME",
  test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
  resolve: (str) => parseSexagesimal(str, false),
  stringify: stringifySexagesimal
};
var timestamp = {
  identify: (value) => value instanceof Date,
  default: true,
  tag: "tag:yaml.org,2002:timestamp",
  // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part
  // may be omitted altogether, resulting in a date format. In such a case, the time part is
  // assumed to be 00:00:00Z (start of day, UTC).
  test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
  resolve(str) {
    const match = str.match(timestamp.test);
    if (!match)
      throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
    const [, year, month, day, hour, minute, second] = match.map(Number);
    const millisec = match[7] ? Number((match[7] + "00").substr(1, 3)) : 0;
    let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);
    const tz = match[8];
    if (tz && tz !== "Z") {
      let d = parseSexagesimal(tz, false);
      if (Math.abs(d) < 30)
        d *= 60;
      date -= 6e4 * d;
    }
    return new Date(date);
  },
  stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\.000Z$/, "") ?? ""
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js
var schema3 = [
  map,
  seq,
  string,
  nullTag,
  trueTag,
  falseTag,
  intBin,
  intOct2,
  int2,
  intHex2,
  floatNaN2,
  floatExp2,
  float2,
  binary,
  merge,
  omap,
  pairs,
  set,
  intTime,
  floatTime,
  timestamp
];

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/tags.js
var schemas = /* @__PURE__ */ new Map([
  ["core", schema],
  ["failsafe", [map, seq, string]],
  ["json", schema2],
  ["yaml11", schema3],
  ["yaml-1.1", schema3]
]);
var tagsByName = {
  binary,
  bool: boolTag,
  float,
  floatExp,
  floatNaN,
  floatTime,
  int,
  intHex,
  intOct,
  intTime,
  map,
  merge,
  null: nullTag,
  omap,
  pairs,
  seq,
  set,
  timestamp
};
var coreKnownTags = {
  "tag:yaml.org,2002:binary": binary,
  "tag:yaml.org,2002:merge": merge,
  "tag:yaml.org,2002:omap": omap,
  "tag:yaml.org,2002:pairs": pairs,
  "tag:yaml.org,2002:set": set,
  "tag:yaml.org,2002:timestamp": timestamp
};
function getTags(customTags, schemaName, addMergeTag) {
  const schemaTags = schemas.get(schemaName);
  if (schemaTags && !customTags) {
    return addMergeTag && !schemaTags.includes(merge) ? schemaTags.concat(merge) : schemaTags.slice();
  }
  let tags = schemaTags;
  if (!tags) {
    if (Array.isArray(customTags))
      tags = [];
    else {
      const keys = Array.from(schemas.keys()).filter((key) => key !== "yaml11").map((key) => JSON.stringify(key)).join(", ");
      throw new Error(`Unknown schema "${schemaName}"; use one of ${keys} or define customTags array`);
    }
  }
  if (Array.isArray(customTags)) {
    for (const tag of customTags)
      tags = tags.concat(tag);
  } else if (typeof customTags === "function") {
    tags = customTags(tags.slice());
  }
  if (addMergeTag)
    tags = tags.concat(merge);
  return tags.reduce((tags2, tag) => {
    const tagObj = typeof tag === "string" ? tagsByName[tag] : tag;
    if (!tagObj) {
      const tagName = JSON.stringify(tag);
      const keys = Object.keys(tagsByName).map((key) => JSON.stringify(key)).join(", ");
      throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);
    }
    if (!tags2.includes(tagObj))
      tags2.push(tagObj);
    return tags2;
  }, []);
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/schema/Schema.js
var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
var Schema = class _Schema {
  constructor({ compat, customTags, merge: merge2, resolveKnownTags, schema: schema4, sortMapEntries, toStringDefaults }) {
    this.compat = Array.isArray(compat) ? getTags(compat, "compat") : compat ? getTags(null, compat) : null;
    this.name = typeof schema4 === "string" && schema4 || "core";
    this.knownTags = resolveKnownTags ? coreKnownTags : {};
    this.tags = getTags(customTags, this.name, merge2);
    this.toStringOptions = toStringDefaults ?? null;
    Object.defineProperty(this, MAP, { value: map });
    Object.defineProperty(this, SCALAR, { value: string });
    Object.defineProperty(this, SEQ, { value: seq });
    this.sortMapEntries = typeof sortMapEntries === "function" ? sortMapEntries : sortMapEntries === true ? sortMapEntriesByKey : null;
  }
  clone() {
    const copy = Object.create(_Schema.prototype, Object.getOwnPropertyDescriptors(this));
    copy.tags = this.tags.slice();
    return copy;
  }
};

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/stringify/stringifyDocument.js
function stringifyDocument(doc, options) {
  const lines = [];
  let hasDirectives = options.directives === true;
  if (options.directives !== false && doc.directives) {
    const dir = doc.directives.toString(doc);
    if (dir) {
      lines.push(dir);
      hasDirectives = true;
    } else if (doc.directives.docStart)
      hasDirectives = true;
  }
  if (hasDirectives)
    lines.push("---");
  const ctx = createStringifyContext(doc, options);
  const { commentString } = ctx.options;
  if (doc.commentBefore) {
    if (lines.length !== 1)
      lines.unshift("");
    const cs = commentString(doc.commentBefore);
    lines.unshift(indentComment(cs, ""));
  }
  let chompKeep = false;
  let contentComment = null;
  if (doc.contents) {
    if (isNode(doc.contents)) {
      if (doc.contents.spaceBefore && hasDirectives)
        lines.push("");
      if (doc.contents.commentBefore) {
        const cs = commentString(doc.contents.commentBefore);
        lines.push(indentComment(cs, ""));
      }
      ctx.forceBlockIndent = !!doc.comment;
      contentComment = doc.contents.comment;
    }
    const onChompKeep = contentComment ? void 0 : () => chompKeep = true;
    let body = stringify(doc.contents, ctx, () => contentComment = null, onChompKeep);
    if (contentComment)
      body += lineComment(body, "", commentString(contentComment));
    if ((body[0] === "|" || body[0] === ">") && lines[lines.length - 1] === "---") {
      lines[lines.length - 1] = `--- ${body}`;
    } else
      lines.push(body);
  } else {
    lines.push(stringify(doc.contents, ctx));
  }
  if (doc.directives?.docEnd) {
    if (doc.comment) {
      const cs = commentString(doc.comment);
      if (cs.includes("\n")) {
        lines.push("...");
        lines.push(indentComment(cs, ""));
      } else {
        lines.push(`... ${cs}`);
      }
    } else {
      lines.push("...");
    }
  } else {
    let dc = doc.comment;
    if (dc && chompKeep)
      dc = dc.replace(/^\n+/, "");
    if (dc) {
      if ((!chompKeep || contentComment) && lines[lines.length - 1] !== "")
        lines.push("");
      lines.push(indentComment(commentString(dc), ""));
    }
  }
  return lines.join("\n") + "\n";
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/doc/Document.js
var Document = class _Document {
  constructor(value, replacer, options) {
    this.commentBefore = null;
    this.comment = null;
    this.errors = [];
    this.warnings = [];
    Object.defineProperty(this, NODE_TYPE, { value: DOC });
    let _replacer = null;
    if (typeof replacer === "function" || Array.isArray(replacer)) {
      _replacer = replacer;
    } else if (options === void 0 && replacer) {
      options = replacer;
      replacer = void 0;
    }
    const opt = Object.assign({
      intAsBigInt: false,
      keepSourceTokens: false,
      logLevel: "warn",
      prettyErrors: true,
      strict: true,
      stringKeys: false,
      uniqueKeys: true,
      version: "1.2"
    }, options);
    this.options = opt;
    let { version: version3 } = opt;
    if (options?._directives) {
      this.directives = options._directives.atDocument();
      if (this.directives.yaml.explicit)
        version3 = this.directives.yaml.version;
    } else
      this.directives = new Directives({ version: version3 });
    this.setSchema(version3, options);
    this.contents = value === void 0 ? null : this.createNode(value, _replacer, options);
  }
  /**
   * Create a deep copy of this Document and its contents.
   *
   * Custom Node values that inherit from `Object` still refer to their original instances.
   */
  clone() {
    const copy = Object.create(_Document.prototype, {
      [NODE_TYPE]: { value: DOC }
    });
    copy.commentBefore = this.commentBefore;
    copy.comment = this.comment;
    copy.errors = this.errors.slice();
    copy.warnings = this.warnings.slice();
    copy.options = Object.assign({}, this.options);
    if (this.directives)
      copy.directives = this.directives.clone();
    copy.schema = this.schema.clone();
    copy.contents = isNode(this.contents) ? this.contents.clone(copy.schema) : this.contents;
    if (this.range)
      copy.range = this.range.slice();
    return copy;
  }
  /** Adds a value to the document. */
  add(value) {
    if (assertCollection(this.contents))
      this.contents.add(value);
  }
  /** Adds a value to the document. */
  addIn(path, value) {
    if (assertCollection(this.contents))
      this.contents.addIn(path, value);
  }
  /**
   * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
   *
   * If `node` already has an anchor, `name` is ignored.
   * Otherwise, the `node.anchor` value will be set to `name`,
   * or if an anchor with that name is already present in the document,
   * `name` will be used as a prefix for a new unique anchor.
   * If `name` is undefined, the generated anchor will use 'a' as a prefix.
   */
  createAlias(node, name) {
    if (!node.anchor) {
      const prev = anchorNames(this);
      node.anchor = // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
      !name || prev.has(name) ? findNewAnchor(name || "a", prev) : name;
    }
    return new Alias(node.anchor);
  }
  createNode(value, replacer, options) {
    let _replacer = void 0;
    if (typeof replacer === "function") {
      value = replacer.call({ "": value }, "", value);
      _replacer = replacer;
    } else if (Array.isArray(replacer)) {
      const keyToStr = (v) => typeof v === "number" || v instanceof String || v instanceof Number;
      const asStr = replacer.filter(keyToStr).map(String);
      if (asStr.length > 0)
        replacer = replacer.concat(asStr);
      _replacer = replacer;
    } else if (options === void 0 && replacer) {
      options = replacer;
      replacer = void 0;
    }
    const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};
    const { onAnchor, setAnchors, sourceObjects } = createNodeAnchors(
      this,
      // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
      anchorPrefix || "a"
    );
    const ctx = {
      aliasDuplicateObjects: aliasDuplicateObjects ?? true,
      keepUndefined: keepUndefined ?? false,
      onAnchor,
      onTagObj,
      replacer: _replacer,
      schema: this.schema,
      sourceObjects
    };
    const node = createNode(value, tag, ctx);
    if (flow && isCollection(node))
      node.flow = true;
    setAnchors();
    return node;
  }
  /**
   * Convert a key and a value into a `Pair` using the current schema,
   * recursively wrapping all values as `Scalar` or `Collection` nodes.
   */
  createPair(key, value, options = {}) {
    const k = this.createNode(key, null, options);
    const v = this.createNode(value, null, options);
    return new Pair(k, v);
  }
  /**
   * Removes a value from the document.
   * @returns `true` if the item was found and removed.
   */
  delete(key) {
    return assertCollection(this.contents) ? this.contents.delete(key) : false;
  }
  /**
   * Removes a value from the document.
   * @returns `true` if the item was found and removed.
   */
  deleteIn(path) {
    if (isEmptyPath(path)) {
      if (this.contents == null)
        return false;
      this.contents = null;
      return true;
    }
    return assertCollection(this.contents) ? this.contents.deleteIn(path) : false;
  }
  /**
   * Returns item at `key`, or `undefined` if not found. By default unwraps
   * scalar values from their surrounding node; to disable set `keepScalar` to
   * `true` (collections are always returned intact).
   */
  get(key, keepScalar) {
    return isCollection(this.contents) ? this.contents.get(key, keepScalar) : void 0;
  }
  /**
   * Returns item at `path`, or `undefined` if not found. By default unwraps
   * scalar values from their surrounding node; to disable set `keepScalar` to
   * `true` (collections are always returned intact).
   */
  getIn(path, keepScalar) {
    if (isEmptyPath(path))
      return !keepScalar && isScalar(this.contents) ? this.contents.value : this.contents;
    return isCollection(this.contents) ? this.contents.getIn(path, keepScalar) : void 0;
  }
  /**
   * Checks if the document includes a value with the key `key`.
   */
  has(key) {
    return isCollection(this.contents) ? this.contents.has(key) : false;
  }
  /**
   * Checks if the document includes a value at `path`.
   */
  hasIn(path) {
    if (isEmptyPath(path))
      return this.contents !== void 0;
    return isCollection(this.contents) ? this.contents.hasIn(path) : false;
  }
  /**
   * Sets a value in this document. For `!!set`, `value` needs to be a
   * boolean to add/remove the item from the set.
   */
  set(key, value) {
    if (this.contents == null) {
      this.contents = collectionFromPath(this.schema, [key], value);
    } else if (assertCollection(this.contents)) {
      this.contents.set(key, value);
    }
  }
  /**
   * Sets a value in this document. For `!!set`, `value` needs to be a
   * boolean to add/remove the item from the set.
   */
  setIn(path, value) {
    if (isEmptyPath(path)) {
      this.contents = value;
    } else if (this.contents == null) {
      this.contents = collectionFromPath(this.schema, Array.from(path), value);
    } else if (assertCollection(this.contents)) {
      this.contents.setIn(path, value);
    }
  }
  /**
   * Change the YAML version and schema used by the document.
   * A `null` version disables support for directives, explicit tags, anchors, and aliases.
   * It also requires the `schema` option to be given as a `Schema` instance value.
   *
   * Overrides all previously set schema options.
   */
  setSchema(version3, options = {}) {
    if (typeof version3 === "number")
      version3 = String(version3);
    let opt;
    switch (version3) {
      case "1.1":
        if (this.directives)
          this.directives.yaml.version = "1.1";
        else
          this.directives = new Directives({ version: "1.1" });
        opt = { resolveKnownTags: false, schema: "yaml-1.1" };
        break;
      case "1.2":
      case "next":
        if (this.directives)
          this.directives.yaml.version = version3;
        else
          this.directives = new Directives({ version: version3 });
        opt = { resolveKnownTags: true, schema: "core" };
        break;
      case null:
        if (this.directives)
          delete this.directives;
        opt = null;
        break;
      default: {
        const sv = JSON.stringify(version3);
        throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);
      }
    }
    if (options.schema instanceof Object)
      this.schema = options.schema;
    else if (opt)
      this.schema = new Schema(Object.assign(opt, options));
    else
      throw new Error(`With a null YAML version, the { schema: Schema } option is required`);
  }
  // json & jsonArg are only used from toJSON()
  toJS({ json, jsonArg, mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
    const ctx = {
      anchors: /* @__PURE__ */ new Map(),
      doc: this,
      keep: !json,
      mapAsMap: mapAsMap === true,
      mapKeyWarned: false,
      maxAliasCount: typeof maxAliasCount === "number" ? maxAliasCount : 100
    };
    const res = toJS(this.contents, jsonArg ?? "", ctx);
    if (typeof onAnchor === "function")
      for (const { count, res: res2 } of ctx.anchors.values())
        onAnchor(res2, count);
    return typeof reviver === "function" ? applyReviver(reviver, { "": res }, "", res) : res;
  }
  /**
   * A JSON representation of the document `contents`.
   *
   * @param jsonArg Used by `JSON.stringify` to indicate the array index or
   *   property name.
   */
  toJSON(jsonArg, onAnchor) {
    return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });
  }
  /** A YAML representation of the document. */
  toString(options = {}) {
    if (this.errors.length > 0)
      throw new Error("Document with errors cannot be stringified");
    if ("indent" in options && (!Number.isInteger(options.indent) || Number(options.indent) <= 0)) {
      const s = JSON.stringify(options.indent);
      throw new Error(`"indent" option must be a positive integer, not ${s}`);
    }
    return stringifyDocument(this, options);
  }
};
function assertCollection(contents) {
  if (isCollection(contents))
    return true;
  throw new Error("Expected a YAML collection as document contents");
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/parse/cst-visit.js
var BREAK2 = Symbol("break visit");
var SKIP2 = Symbol("skip children");
var REMOVE2 = Symbol("remove item");
function visit2(cst, visitor) {
  if ("type" in cst && cst.type === "document")
    cst = { start: cst.start, value: cst.value };
  _visit(Object.freeze([]), cst, visitor);
}
visit2.BREAK = BREAK2;
visit2.SKIP = SKIP2;
visit2.REMOVE = REMOVE2;
visit2.itemAtPath = (cst, path) => {
  let item = cst;
  for (const [field, index] of path) {
    const tok = item?.[field];
    if (tok && "items" in tok) {
      item = tok.items[index];
    } else
      return void 0;
  }
  return item;
};
visit2.parentCollection = (cst, path) => {
  const parent = visit2.itemAtPath(cst, path.slice(0, -1));
  const field = path[path.length - 1][0];
  const coll = parent?.[field];
  if (coll && "items" in coll)
    return coll;
  throw new Error("Parent collection not found");
};
function _visit(path, item, visitor) {
  let ctrl = visitor(item, path);
  if (typeof ctrl === "symbol")
    return ctrl;
  for (const field of ["key", "value"]) {
    const token = item[field];
    if (token && "items" in token) {
      for (let i = 0; i < token.items.length; ++i) {
        const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);
        if (typeof ci === "number")
          i = ci - 1;
        else if (ci === BREAK2)
          return BREAK2;
        else if (ci === REMOVE2) {
          token.items.splice(i, 1);
          i -= 1;
        }
      }
      if (typeof ctrl === "function" && field === "key")
        ctrl = ctrl(item, path);
    }
  }
  return typeof ctrl === "function" ? ctrl(item, path) : ctrl;
}

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/parse/lexer.js
var hexDigits = new Set("0123456789ABCDEFabcdef");
var tagChars = new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()");
var flowIndicatorChars = new Set(",[]{}");
var invalidAnchorChars = new Set(" ,[]{}\n\r	");

// src/typespec/node_modules/.pnpm/yaml@2.8.1/node_modules/yaml/browser/dist/public-api.js
function stringify3(value, replacer, options) {
  let _replacer = null;
  if (typeof replacer === "function" || Array.isArray(replacer)) {
    _replacer = replacer;
  } else if (options === void 0 && replacer) {
    options = replacer;
  }
  if (typeof options === "string")
    options = options.length;
  if (typeof options === "number") {
    const indent = Math.round(options);
    options = indent < 1 ? void 0 : indent > 8 ? { indent: 8 } : { indent };
  }
  if (value === void 0) {
    const { keepUndefined } = options ?? replacer ?? {};
    if (!keepUndefined)
      return void 0;
  }
  if (isDocument(value) && !_replacer)
    return value.toString(options);
  return new Document(value, _replacer, options).toString(options);
}

// src/typespec/core/packages/openapi3/dist/src/examples.js
import { getEncode as getEncode3, getOpExamples, ignoreDiagnostics, serializeValueAsJson as serializeValueAsJson2 } from "@typespec/compiler";
import { $ } from "@typespec/compiler/typekit";
import { isHeader } from "@typespec/http";

// src/typespec/core/packages/openapi3/dist/src/parameters.js
import { getEncode } from "@typespec/compiler";
function getParameterStyle(program, type) {
  const encode = getEncode(program, type);
  if (!encode)
    return;
  if (encode.encoding === "ArrayEncoding.pipeDelimited") {
    return "pipeDelimited";
  } else if (encode.encoding === "ArrayEncoding.spaceDelimited") {
    return "spaceDelimited";
  }
  return;
}

// src/typespec/core/packages/openapi3/dist/src/status-codes.js
import { isDefaultResponse } from "@typespec/openapi";
function getOpenAPI3StatusCodes(program, statusCodes, response) {
  if (isDefaultResponse(program, response) || statusCodes === "*") {
    return [["default"], []];
  } else if (typeof statusCodes === "number") {
    return [[String(statusCodes)], []];
  } else {
    return rangeToOpenAPI(statusCodes, response);
  }
}
function rangeToOpenAPI(range, diagnosticTarget) {
  const diagnostics = [];
  const reportInvalid = () => diagnostics.push(createDiagnostic({
    code: "unsupported-status-code-range",
    format: { start: String(range.start), end: String(range.end) },
    target: diagnosticTarget
  }));
  const codes = [];
  let start = range.start;
  let end = range.end;
  if (range.start < 100) {
    reportInvalid();
    start = 100;
    codes.push("default");
  } else if (range.end > 599) {
    reportInvalid();
    codes.push("default");
    end = 599;
  }
  const groups = [1, 2, 3, 4, 5];
  for (const group of groups) {
    if (start > end) {
      break;
    }
    const groupStart = group * 100;
    const groupEnd = groupStart + 99;
    if (start >= groupStart && start <= groupEnd) {
      codes.push(`${group}XX`);
      if (start !== groupStart || end < groupEnd) {
        reportInvalid();
      }
      start = groupStart + 100;
    }
  }
  return [codes, diagnostics];
}

// src/typespec/core/packages/openapi3/dist/src/util.js
import { getEncode as getEncode2, isTemplateDeclaration, serializeValueAsJson } from "@typespec/compiler";
function deepEquals(left, right) {
  if (left === right) {
    return true;
  }
  if (left === null || right === null || typeof left !== "object" || typeof right !== "object") {
    return false;
  }
  if (Array.isArray(left)) {
    return Array.isArray(right) ? arrayEquals(left, right, deepEquals) : false;
  }
  return mapEquals(new Map(Object.entries(left)), new Map(Object.entries(right)), deepEquals);
}
function arrayEquals(left, right, equals = (x, y) => x === y) {
  if (left === right) {
    return true;
  }
  if (left.length !== right.length) {
    return false;
  }
  for (let i = 0; i < left.length; i++) {
    if (!equals(left[i], right[i])) {
      return false;
    }
  }
  return true;
}
function mapEquals(left, right, equals = (x, y) => x === y) {
  if (left === right) {
    return true;
  }
  if (left.size !== right.size) {
    return false;
  }
  for (const [key, value] of left) {
    if (!right.has(key) || !equals(value, right.get(key))) {
      return false;
    }
  }
  return true;
}
function isSharedHttpOperation(operation) {
  return operation.kind === "shared";
}
function isStdType(program, type) {
  return program.checker.isStdType(type);
}
function isLiteralType(type) {
  return type.kind === "Boolean" || type.kind === "String" || type.kind === "Number";
}
function literalType(type) {
  switch (type.kind) {
    case "String":
      return "string";
    case "Number":
      return "number";
    case "Boolean":
      return "boolean";
  }
}
function includeDerivedModel(model) {
  return !isTemplateDeclaration(model) && (model.templateMapper?.args === void 0 || model.templateMapper.args?.length === 0 || model.derivedModels.length > 0);
}
function isScalarExtendsBytes(type) {
  if (type.kind !== "Scalar") {
    return false;
  }
  let current = type;
  while (current) {
    if (current.name === "bytes") {
      return true;
    }
    current = current.baseScalar;
  }
  return false;
}
function getDefaultValue(program, defaultType, modelProperty) {
  return serializeValueAsJson(program, defaultType, modelProperty);
}
function isBytesKeptRaw(program, type) {
  return type.kind === "Scalar" && type.name === "bytes" && getEncode2(program, type) === void 0;
}
function ensureValidComponentFixedFieldKey(program, type, oldKey) {
  if (isValidComponentFixedFieldKey(oldKey))
    return oldKey;
  reportInvalidKey(program, type, oldKey);
  return createValidKey(oldKey);
}
function isValidComponentFixedFieldKey(key) {
  const validPattern = /^[a-zA-Z0-9.\-_]+$/;
  return validPattern.test(key);
}
function reportInvalidKey(program, type, key) {
  const diagnostic = createDiagnostic({
    code: "invalid-component-fixed-field-key",
    format: {
      value: key
    },
    target: type
  });
  return program.reportDiagnostic(diagnostic);
}
function createValidKey(invalidKey) {
  return invalidKey.replace(/[^a-zA-Z0-9.\-_]/g, "_");
}
function isHttpParameterProperty(httpProperty) {
  return ["header", "query", "path", "cookie"].includes(httpProperty.kind);
}

// src/typespec/core/packages/openapi3/dist/src/examples.js
function resolveOperationExamples(program, operation, { parameterExamplesStrategy }) {
  const examples = findOperationExamples(program, operation);
  const result = { requestBody: {}, parameters: {}, responses: {} };
  if (examples.length === 0) {
    return result;
  }
  for (const [op, example] of examples) {
    if (example.parameters && op.parameters.body) {
      const contentTypeValue = getContentTypeValue(example.parameters, op.parameters.properties) ?? "application/json";
      result.requestBody[contentTypeValue] ??= [];
      const value = getBodyValue(example.parameters, op.parameters.properties);
      if (value) {
        result.requestBody[contentTypeValue].push([
          {
            value,
            title: example.title,
            description: example.description
          },
          op.parameters.body.type
        ]);
      }
    }
    if (example.parameters) {
      for (const property of op.parameters.properties) {
        if (!isHttpParameterProperty(property))
          continue;
        const value = getParameterValue(program, example.parameters, property, parameterExamplesStrategy);
        if (value) {
          const parameterName = property.options.name;
          result.parameters[parameterName] ??= [];
          result.parameters[parameterName].push([
            {
              value,
              title: example.title,
              description: example.description
            },
            property.property
          ]);
        }
      }
    }
    if (example.returnType && op.responses) {
      const match = findResponseForExample(program, example.returnType, op.responses);
      if (match) {
        const value = getBodyValue(example.returnType, match.response.properties);
        if (value) {
          for (const statusCode of match.statusCodes) {
            result.responses[statusCode] ??= {};
            result.responses[statusCode][match.contentType] ??= [];
            result.responses[statusCode][match.contentType].push([
              {
                value,
                title: example.title,
                description: example.description
              },
              match.response.body.type
            ]);
          }
        }
      }
    }
  }
  return result;
}
function findOperationExamples(program, operation) {
  if (isSharedHttpOperation(operation)) {
    return operation.operations.flatMap((op) => getOpExamples(program, op.operation).map((x) => [op, x]));
  } else {
    return getOpExamples(program, operation.operation).map((x) => [operation, x]);
  }
}
function isStatusCodeIn(exampleStatusCode, statusCodes) {
  if (statusCodes === "*") {
    return true;
  }
  if (typeof statusCodes === "number") {
    return exampleStatusCode === statusCodes;
  }
  return exampleStatusCode >= statusCodes.start && exampleStatusCode <= statusCodes.end;
}
function findResponseForExample(program, exampleValue, responses) {
  const tentatives = [];
  for (const statusCodeResponse of responses) {
    for (const response of statusCodeResponse.responses) {
      if (response.body === void 0) {
        continue;
      }
      const contentType = getContentTypeValue(exampleValue, response.properties);
      const statusCode = getStatusCodeValue(exampleValue, response.properties);
      const contentTypeProp = response.properties.find((x) => x.kind === "contentType");
      const statusCodeProp = response.properties.find((x) => x.kind === "statusCode");
      const statusCodeMatch = statusCode && statusCodeProp && isStatusCodeIn(statusCode, statusCodeResponse.statusCodes);
      const contentTypeMatch = contentType && response.body?.contentTypes.includes(contentType);
      if (statusCodeMatch && contentTypeMatch) {
        return {
          contentType,
          statusCodes: ignoreDiagnostics(getOpenAPI3StatusCodes(program, statusCodeResponse.statusCodes, statusCodeResponse.type)),
          response
        };
      } else if (statusCodeMatch && contentTypeProp === void 0) {
        tentatives.push([
          {
            response,
            statusCodes: ignoreDiagnostics(getOpenAPI3StatusCodes(program, statusCodeResponse.statusCodes, statusCodeResponse.type))
          },
          1
        ]);
      } else if (contentTypeMatch && statusCodeMatch === void 0) {
        tentatives.push([{ response, contentType }, 1]);
      } else if (contentTypeProp === void 0 && statusCodeProp === void 0) {
        tentatives.push([{ response }, 0]);
      }
    }
  }
  const tentative = tentatives.sort((a, b) => a[1] - b[1]).pop();
  if (tentative) {
    return {
      contentType: tentative[0].contentType ?? "application/json",
      statusCodes: tentative[0].statusCodes ?? ["200"],
      response: tentative[0].response
    };
  }
  return void 0;
}
function getDefaultHeaderEncodeAs(program, header) {
  const encodeData = getEncode3(program, header);
  if (encodeData)
    return;
  const tk = $(program);
  if (!tk.scalar.isUtcDateTime(header.type) && tk.scalar.isOffsetDateTime(header.type)) {
    return;
  }
  if (!tk.scalar.is(header.type))
    return;
  return {
    encoding: "rfc7231",
    type: header.type
  };
}
function getEncodeAs(program, type) {
  if (isHeader(program, type)) {
    return getDefaultHeaderEncodeAs(program, type);
  }
  return void 0;
}
function getExampleOrExamples(program, examples) {
  if (examples.length === 0) {
    return {};
  }
  if (examples.length === 1 && examples[0][0].title === void 0 && examples[0][0].description === void 0) {
    const [example, type] = examples[0];
    const encodeAs = getEncodeAs(program, type);
    return { example: serializeValueAsJson2(program, example.value, type, encodeAs) };
  } else {
    const exampleObj = {};
    for (const [index, [example, type]] of examples.entries()) {
      const encodeAs = getEncodeAs(program, type);
      exampleObj[example.title ?? `example${index}`] = {
        summary: example.title,
        description: example.description,
        value: serializeValueAsJson2(program, example.value, type, encodeAs)
      };
    }
    return { examples: exampleObj };
  }
}
function getStatusCodeValue(value, properties) {
  const statusCodeProperty = properties.find((p) => p.kind === "statusCode");
  if (statusCodeProperty === void 0) {
    return void 0;
  }
  const statusCode = getValueByPath(value, statusCodeProperty.path);
  if (statusCode?.valueKind === "NumericValue") {
    return statusCode.value.asNumber() ?? void 0;
  }
  return void 0;
}
function getContentTypeValue(value, properties) {
  const contentTypeProperty = properties.find((p) => p.kind === "contentType");
  if (contentTypeProperty === void 0) {
    return void 0;
  }
  const statusCode = getValueByPath(value, contentTypeProperty.path);
  if (statusCode?.valueKind === "StringValue") {
    return statusCode.value;
  }
  return void 0;
}
function getBodyValue(value, properties) {
  const bodyProperty = properties.find((p) => p.kind === "body" || p.kind === "bodyRoot");
  if (bodyProperty !== void 0) {
    return getValueByPath(value, bodyProperty.path);
  }
  return value;
}
function getParameterValue(program, parameterExamples, property, parameterExamplesStrategy) {
  if (!parameterExamplesStrategy) {
    return;
  }
  const value = getValueByPath(parameterExamples, property.path);
  if (!value)
    return;
  if (parameterExamplesStrategy === "data") {
    return value;
  }
  if (property.kind === "query") {
    return getQueryParameterValue(program, value, property);
  } else if (property.kind === "header") {
    return getHeaderParameterValue(program, value, property);
  } else if (property.kind === "path") {
    return getPathParameterValue(program, value, property);
  } else if (property.kind === "cookie") {
    return getCookieParameterValue(program, value, property);
  }
  return value;
}
function getQueryParameterValue(program, originalValue, property) {
  const style = getParameterStyle(program, property.property) ?? "form";
  switch (style) {
    case "form":
      return getParameterFormValue(program, originalValue, property);
    case "spaceDelimited":
      return getParameterDelimitedValue(program, originalValue, property, " ");
    case "pipeDelimited":
      return getParameterDelimitedValue(program, originalValue, property, "|");
  }
}
function getHeaderParameterValue(program, originalValue, property) {
  return getParameterSimpleValue(program, originalValue, property);
}
function getPathParameterValue(program, originalValue, property) {
  const { style } = property.options;
  if (style === "label") {
    return getParameterLabelValue(program, originalValue, property);
  } else if (style === "matrix") {
    return getParameterMatrixValue(program, originalValue, property);
  } else if (style === "simple") {
    return getParameterSimpleValue(program, originalValue, property);
  }
  return void 0;
}
function getCookieParameterValue(program, originalValue, property) {
  return getParameterFormValue(program, originalValue, property);
}
function getParameterLabelValue(program, originalValue, property) {
  const { explode } = property.options;
  const tk = $(program);
  const joiner = explode ? "." : ",";
  if (tk.value.isArray(originalValue)) {
    const pairs2 = [];
    for (const value of originalValue.values) {
      if (!isSerializableScalarValue(value))
        continue;
      pairs2.push(`${value.value}`);
    }
    return tk.value.createString(`.${pairs2.join(joiner)}`);
  }
  if (tk.value.isObject(originalValue)) {
    const pairs2 = [];
    for (const [key, { value }] of originalValue.properties) {
      if (!isSerializableScalarValue(value))
        continue;
      const sep2 = explode ? "=" : ",";
      pairs2.push(`${key}${sep2}${value.value}`);
    }
    return tk.value.createString(`.${pairs2.join(joiner)}`);
  }
  if (tk.value.isNull(originalValue)) {
    return tk.value.createString(".");
  }
  if (isSerializableScalarValue(originalValue)) {
    return tk.value.createString(`.${originalValue.value}`);
  }
  return;
}
function getParameterMatrixValue(program, originalValue, property) {
  const { explode, name } = property.options;
  const tk = $(program);
  const joiner = explode ? ";" : ",";
  const prefix = explode ? "" : `${name}=`;
  if (tk.value.isArray(originalValue)) {
    const pairs2 = [];
    for (const value of originalValue.values) {
      if (!isSerializableScalarValue(value))
        continue;
      pairs2.push(explode ? `${name}=${value.value}` : `${value.value}`);
    }
    return tk.value.createString(`;${prefix}${pairs2.join(joiner)}`);
  }
  if (tk.value.isObject(originalValue)) {
    const sep2 = explode ? "=" : ",";
    const pairs2 = [];
    for (const [key, { value }] of originalValue.properties) {
      if (!isSerializableScalarValue(value))
        continue;
      pairs2.push(`${key}${sep2}${value.value}`);
    }
    return tk.value.createString(`;${prefix}${pairs2.join(joiner)}`);
  }
  if (tk.value.isNull(originalValue)) {
    return tk.value.createString(`;${name}`);
  }
  if (isSerializableScalarValue(originalValue)) {
    return tk.value.createString(`;${name}=${originalValue.value}`);
  }
  return;
}
function getParameterDelimitedValue(program, originalValue, property, delimiter2) {
  const { explode, name } = property.options;
  if (explode)
    return void 0;
  const tk = $(program);
  if (tk.value.isArray(originalValue)) {
    const pairs2 = [];
    for (const value of originalValue.values) {
      if (!isSerializableScalarValue(value))
        continue;
      pairs2.push(`${value.value}`);
    }
    return tk.value.createString(`${name}=${encodeURIComponent(pairs2.join(delimiter2))}`);
  }
  if (tk.value.isObject(originalValue)) {
    const pairs2 = [];
    for (const [key, { value }] of originalValue.properties) {
      if (!isSerializableScalarValue(value))
        continue;
      pairs2.push(`${key}${delimiter2}${value.value}`);
    }
    return tk.value.createString(`${name}=${encodeURIComponent(pairs2.join(delimiter2))}`);
  }
  return void 0;
}
function getParameterFormValue(program, originalValue, property) {
  const { name } = property.options;
  const isCookie = property.kind === "cookie";
  const explode = isCookie ? false : property.options.explode;
  const tk = $(program);
  const prefix = explode ? "" : `${name}=`;
  if (tk.value.isArray(originalValue)) {
    const sep2 = explode ? "&" : ",";
    const pairs2 = [];
    for (const value of originalValue.values) {
      if (!isSerializableScalarValue(value))
        continue;
      pairs2.push(explode ? `${name}=${value.value}` : `${value.value}`);
    }
    return tk.value.createString(`${prefix}${pairs2.join(sep2)}`);
  }
  if (tk.value.isObject(originalValue)) {
    const sep2 = explode ? "=" : ",";
    const joiner = explode ? "&" : ",";
    const pairs2 = [];
    for (const [key, { value }] of originalValue.properties) {
      if (!isSerializableScalarValue(value))
        continue;
      pairs2.push(`${key}${sep2}${value.value}`);
    }
    return tk.value.createString(`${prefix}${pairs2.join(joiner)}`);
  }
  if (isSerializableScalarValue(originalValue)) {
    return tk.value.createString(`${name}=${originalValue.value}`);
  }
  if (tk.value.isNull(originalValue)) {
    return tk.value.createString(`${name}=`);
  }
  return;
}
function getParameterSimpleValue(program, originalValue, property) {
  const { explode } = property.options;
  const tk = $(program);
  if (tk.value.isArray(originalValue)) {
    const serializedValue = originalValue.values.filter(isSerializableScalarValue).map((v) => v.value).join(",");
    return tk.value.createString(serializedValue);
  }
  if (tk.value.isObject(originalValue)) {
    const pairs2 = [];
    for (const [key, { value }] of originalValue.properties) {
      if (!isSerializableScalarValue(value))
        continue;
      const sep2 = explode ? "=" : ",";
      pairs2.push(`${key}${sep2}${value.value}`);
    }
    return tk.value.createString(pairs2.join(","));
  }
  if (tk.value.isNull(originalValue)) {
    return tk.value.createString("");
  }
  if (isSerializableScalarValue(originalValue)) {
    return originalValue;
  }
  return;
}
function isSerializableScalarValue(value) {
  return ["BooleanValue", "NumericValue", "StringValue"].includes(value.valueKind);
}
function getValueByPath(value, path) {
  let current = value;
  for (const key of path) {
    switch (current?.valueKind) {
      case "ObjectValue":
        current = current.properties.get(key.toString())?.value;
        break;
      case "ArrayValue":
        current = current.values[key];
        break;
      default:
        return void 0;
    }
  }
  return current;
}

// src/typespec/core/packages/openapi3/dist/src/json-schema.js
async function resolveJsonSchemaModule() {
  try {
    return await import("@typespec/json-schema");
  } catch {
    return void 0;
  }
}

// src/typespec/core/packages/openapi3/dist/src/openapi-spec-mappings.js
import { getExternalDocs as getExternalDocs2, resolveInfo } from "@typespec/openapi";

// src/typespec/core/packages/asset-emitter/dist/src/asset-emitter.js
import { compilerAssert as compilerAssert2, getTypeName as getTypeName2, isTemplateDeclaration as isTemplateDeclaration3, joinPaths } from "@typespec/compiler";
import { $ as $2 } from "@typespec/compiler/typekit";

// src/typespec/core/packages/asset-emitter/dist/src/custom-key-map.js
var CustomKeyMap = class {
  #items = /* @__PURE__ */ new Map();
  #keyer;
  constructor(keyer) {
    this.#keyer = keyer;
  }
  get(items) {
    return this.#items.get(this.#keyer(items));
  }
  set(items, value) {
    const key = this.#keyer(items);
    this.#items.set(key, value);
  }
  static objectKeyer() {
    const knownKeys = /* @__PURE__ */ new WeakMap();
    let count = 0;
    return {
      getKey(o) {
        if (knownKeys.has(o)) {
          return knownKeys.get(o);
        }
        const key = count;
        count++;
        knownKeys.set(o, key);
        return key;
      }
    };
  }
};

// src/typespec/core/packages/asset-emitter/dist/src/placeholder.js
var Placeholder = class {
  #listeners = [];
  setValue(value) {
    for (const listener of this.#listeners) {
      listener(value);
    }
  }
  onValue(cb) {
    this.#listeners.push(cb);
  }
};

// src/typespec/core/packages/asset-emitter/dist/src/ref-scope.js
function scopeChain(scope) {
  const chain = [];
  while (scope) {
    chain.unshift(scope);
    scope = scope.parentScope;
  }
  return chain;
}
function resolveDeclarationReferenceScope(target, currentScope) {
  const targetScope = target.scope;
  const targetChain = scopeChain(targetScope);
  const currentChain = scopeChain(currentScope);
  let diffStart = 0;
  while (targetChain[diffStart] && currentChain[diffStart] && targetChain[diffStart] === currentChain[diffStart]) {
    diffStart++;
  }
  const pathUp = currentChain.slice(diffStart);
  const pathDown = targetChain.slice(diffStart);
  const commonScope = targetChain[diffStart - 1] ?? null;
  return { pathUp, pathDown, commonScope };
}

// src/typespec/core/packages/asset-emitter/dist/src/reference-cycle.js
import { getTypeName } from "@typespec/compiler";
var ReferenceCycle = class {
  /**
   * If this cycle contains a declaration.
   */
  containsDeclaration;
  #entries;
  constructor(entries) {
    const firstDeclarationIndex = entries.findIndex((entry) => entry.entity.kind === "declaration");
    this.containsDeclaration = firstDeclarationIndex !== -1;
    this.#entries = this.containsDeclaration ? [...entries.slice(firstDeclarationIndex), ...entries.slice(0, firstDeclarationIndex)] : entries;
  }
  get first() {
    return this.#entries[0];
  }
  [Symbol.iterator]() {
    return this.#entries[Symbol.iterator]();
  }
  [Symbol.toStringTag]() {
    return [...this.#entries, this.#entries[0]].map((x) => getTypeName(x.type)).join(" -> ");
  }
  toString() {
    return this[Symbol.toStringTag]();
  }
};

// src/typespec/core/packages/asset-emitter/dist/src/type-emitter.js
import { compilerAssert, emitFile, isTemplateDeclaration as isTemplateDeclaration2 } from "@typespec/compiler";
var TypeEmitter = class {
  emitter;
  /**
   * @private
   *
   * Constructs a TypeEmitter. Do not use this constructor directly, instead
   * call `createAssetEmitter` on the emitter context object.
   * @param emitter The asset emitter
   */
  constructor(emitter) {
    this.emitter = emitter;
  }
  /**
   * Context shared by the entire program. In cases where you are emitting to a
   * single file, use this method to establish your main source file and set the
   * `scope` property to that source file's `globalScope`.
   * @param program
   * @returns Context
   */
  programContext(program) {
    return {};
  }
  /**
   * Emit a namespace
   *
   * @param namespace
   * @returns Emitter output
   */
  namespace(namespace2) {
    for (const ns of namespace2.namespaces.values()) {
      this.emitter.emitType(ns);
    }
    for (const model of namespace2.models.values()) {
      if (!isTemplateDeclaration2(model)) {
        this.emitter.emitType(model);
      }
    }
    for (const operation of namespace2.operations.values()) {
      if (!isTemplateDeclaration2(operation)) {
        this.emitter.emitType(operation);
      }
    }
    for (const enumeration of namespace2.enums.values()) {
      this.emitter.emitType(enumeration);
    }
    for (const union of namespace2.unions.values()) {
      if (!isTemplateDeclaration2(union)) {
        this.emitter.emitType(union);
      }
    }
    for (const iface of namespace2.interfaces.values()) {
      if (!isTemplateDeclaration2(iface)) {
        this.emitter.emitType(iface);
      }
    }
    for (const scalar of namespace2.scalars.values()) {
      this.emitter.emitType(scalar);
    }
    return this.emitter.result.none();
  }
  /**
   * Set lexical context for a namespace
   *
   * @param namespace
   */
  namespaceContext(namespace2) {
    return {};
  }
  /**
   * Set reference context for a namespace.
   *
   * @param namespace
   */
  namespaceReferenceContext(namespace2) {
    return {};
  }
  /**
   * Emit a model literal (e.g. as created by `{}` syntax in TypeSpec).
   *
   * @param model
   */
  modelLiteral(model) {
    if (model.baseModel) {
      this.emitter.emitType(model.baseModel);
    }
    this.emitter.emitModelProperties(model);
    return this.emitter.result.none();
  }
  /**
   * Set lexical context for a model literal.
   * @param model
   */
  modelLiteralContext(model) {
    return {};
  }
  /**
   * Set reference context for a model literal.
   * @param model
   */
  modelLiteralReferenceContext(model) {
    return {};
  }
  /**
   * Emit a model declaration (e.g. as created by `model Foo { }` syntax in
   * TypeSpec).
   *
   * @param model
   */
  modelDeclaration(model, name) {
    if (model.baseModel) {
      this.emitter.emitType(model.baseModel);
    }
    this.emitter.emitModelProperties(model);
    return this.emitter.result.none();
  }
  /**
   * Set lexical context for a model declaration.
   *
   * @param model
   * @param name the model's declaration name as retrieved from the
   * `declarationName` method.
   */
  modelDeclarationContext(model, name) {
    return {};
  }
  /**
   * Set reference context for a model declaration.
   * @param model
   */
  modelDeclarationReferenceContext(model, name) {
    return {};
  }
  /**
   * Emit a model instantiation (e.g. as created by `Box<string>` syntax in
   * TypeSpec). In some cases, `name` is undefined because a good name could
   * not be found for the instantiation. This often occurs with for instantiations
   * involving type expressions like `Box<string | int32>`.
   *
   * @param model
   * @param name The name of the instantiation as retrieved from the
   * `declarationName` method.
   */
  modelInstantiation(model, name) {
    if (model.baseModel) {
      this.emitter.emitType(model.baseModel);
    }
    this.emitter.emitModelProperties(model);
    return this.emitter.result.none();
  }
  /**
   * Set lexical context for a model instantiation.
   * @param model
   */
  modelInstantiationContext(model, name) {
    return {};
  }
  /**
   * Set reference context for a model declaration.
   * @param model
   */
  modelInstantiationReferenceContext(model, name) {
    return {};
  }
  /**
   * Emit a model's properties. Unless overridden, this method will emit each of
   * the model's properties and return a no emit result.
   *
   * @param model
   */
  modelProperties(model) {
    for (const prop of model.properties.values()) {
      this.emitter.emitModelProperty(prop);
    }
    return this.emitter.result.none();
  }
  modelPropertiesContext(model) {
    return {};
  }
  modelPropertiesReferenceContext(model) {
    return {};
  }
  /**
   * Emit a property of a model.
   *
   * @param property
   */
  modelPropertyLiteral(property) {
    this.emitter.emitTypeReference(property.type);
    return this.emitter.result.none();
  }
  /**
   * Set lexical context for a property of a model.
   *
   * @param property
   */
  modelPropertyLiteralContext(property) {
    return {};
  }
  /**
   * Set reference context for a property of a model.
   *
   * @param property
   */
  modelPropertyLiteralReferenceContext(property) {
    return {};
  }
  /**
   * Emit a model property reference (e.g. as created by the `SomeModel.prop`
   * syntax in TypeSpec). By default, this will emit the type of the referenced
   * property and return that result. In other words, the emit will look as if
   * `SomeModel.prop` were replaced with the type of `prop`.
   *
   * @param property
   */
  modelPropertyReference(property) {
    return this.emitter.emitTypeReference(property.type);
  }
  /**
   * Emit an enum member reference (e.g. as created by the `SomeEnum.member` syntax
   * in TypeSpec). By default, this will emit nothing.
   *
   * @param property the enum member
   */
  enumMemberReference(member) {
    return this.emitter.result.none();
  }
  arrayDeclaration(array, name, elementType) {
    this.emitter.emitType(array.indexer.value);
    return this.emitter.result.none();
  }
  arrayDeclarationContext(array, name, elementType) {
    return {};
  }
  arrayDeclarationReferenceContext(array, name, elementType) {
    return {};
  }
  arrayLiteral(array, elementType) {
    return this.emitter.result.none();
  }
  arrayLiteralContext(array, elementType) {
    return {};
  }
  arrayLiteralReferenceContext(array, elementType) {
    return {};
  }
  scalarDeclaration(scalar, name) {
    if (scalar.baseScalar) {
      this.emitter.emitType(scalar.baseScalar);
    }
    return this.emitter.result.none();
  }
  scalarDeclarationContext(scalar, name) {
    return {};
  }
  scalarDeclarationReferenceContext(scalar, name) {
    return {};
  }
  scalarInstantiation(scalar, name) {
    return this.emitter.result.none();
  }
  scalarInstantiationContext(scalar, name) {
    return {};
  }
  intrinsic(intrinsic, name) {
    return this.emitter.result.none();
  }
  intrinsicContext(intrinsic, name) {
    return {};
  }
  booleanLiteralContext(boolean) {
    return {};
  }
  booleanLiteral(boolean) {
    return this.emitter.result.none();
  }
  stringTemplateContext(string2) {
    return {};
  }
  stringTemplate(stringTemplate) {
    return this.emitter.result.none();
  }
  stringLiteralContext(string2) {
    return {};
  }
  stringLiteral(string2) {
    return this.emitter.result.none();
  }
  numericLiteralContext(number) {
    return {};
  }
  numericLiteral(number) {
    return this.emitter.result.none();
  }
  operationDeclaration(operation, name) {
    this.emitter.emitOperationParameters(operation);
    this.emitter.emitOperationReturnType(operation);
    return this.emitter.result.none();
  }
  operationDeclarationContext(operation, name) {
    return {};
  }
  operationDeclarationReferenceContext(operation, name) {
    return {};
  }
  interfaceDeclarationOperationsContext(iface) {
    return {};
  }
  interfaceDeclarationOperationsReferenceContext(iface) {
    return {};
  }
  interfaceOperationDeclarationContext(operation, name) {
    return {};
  }
  interfaceOperationDeclarationReferenceContext(operation, name) {
    return {};
  }
  operationParameters(operation, parameters) {
    return this.emitter.result.none();
  }
  operationParametersContext(operation, parameters) {
    return {};
  }
  operationParametersReferenceContext(operation, parameters) {
    return {};
  }
  operationReturnType(operation, returnType) {
    return this.emitter.result.none();
  }
  operationReturnTypeContext(operation, returnType) {
    return {};
  }
  operationReturnTypeReferenceContext(operation, returnType) {
    return {};
  }
  interfaceDeclaration(iface, name) {
    this.emitter.emitInterfaceOperations(iface);
    return this.emitter.result.none();
  }
  interfaceDeclarationContext(iface, name) {
    return {};
  }
  interfaceDeclarationReferenceContext(iface, name) {
    return {};
  }
  interfaceDeclarationOperations(iface) {
    for (const op of iface.operations.values()) {
      this.emitter.emitInterfaceOperation(op);
    }
    return this.emitter.result.none();
  }
  interfaceOperationDeclaration(operation, name) {
    this.emitter.emitOperationParameters(operation);
    this.emitter.emitOperationReturnType(operation);
    return this.emitter.result.none();
  }
  enumDeclaration(en, name) {
    this.emitter.emitEnumMembers(en);
    return this.emitter.result.none();
  }
  enumDeclarationContext(en, name) {
    return {};
  }
  enumDeclarationReferenceContext(en, name) {
    return {};
  }
  enumMembers(en) {
    for (const member of en.members.values()) {
      this.emitter.emitType(member);
    }
    return this.emitter.result.none();
  }
  enumMembersContext(en) {
    return {};
  }
  enumMember(member) {
    return this.emitter.result.none();
  }
  enumMemberContext(member) {
    return {};
  }
  unionDeclaration(union, name) {
    this.emitter.emitUnionVariants(union);
    return this.emitter.result.none();
  }
  unionDeclarationContext(union) {
    return {};
  }
  unionDeclarationReferenceContext(union) {
    return {};
  }
  unionInstantiation(union, name) {
    this.emitter.emitUnionVariants(union);
    return this.emitter.result.none();
  }
  unionInstantiationContext(union, name) {
    return {};
  }
  unionInstantiationReferenceContext(union, name) {
    return {};
  }
  unionLiteral(union) {
    this.emitter.emitUnionVariants(union);
    return this.emitter.result.none();
  }
  unionLiteralContext(union) {
    return {};
  }
  unionLiteralReferenceContext(union) {
    return {};
  }
  unionVariants(union) {
    for (const variant of union.variants.values()) {
      this.emitter.emitType(variant);
    }
    return this.emitter.result.none();
  }
  unionVariantsContext() {
    return {};
  }
  unionVariantsReferenceContext() {
    return {};
  }
  unionVariant(variant) {
    this.emitter.emitTypeReference(variant.type);
    return this.emitter.result.none();
  }
  unionVariantContext(union) {
    return {};
  }
  unionVariantReferenceContext(union) {
    return {};
  }
  tupleLiteral(tuple) {
    this.emitter.emitTupleLiteralValues(tuple);
    return this.emitter.result.none();
  }
  tupleLiteralContext(tuple) {
    return {};
  }
  tupleLiteralValues(tuple) {
    for (const value of tuple.values.values()) {
      this.emitter.emitType(value);
    }
    return this.emitter.result.none();
  }
  tupleLiteralValuesContext(tuple) {
    return {};
  }
  tupleLiteralValuesReferenceContext(tuple) {
    return {};
  }
  tupleLiteralReferenceContext(tuple) {
    return {};
  }
  sourceFile(sourceFile) {
    const emittedSourceFile = {
      path: sourceFile.path,
      contents: ""
    };
    for (const decl of sourceFile.globalScope.declarations) {
      emittedSourceFile.contents += decl.value + "\n";
    }
    return emittedSourceFile;
  }
  async writeOutput(sourceFiles) {
    for (const file of sourceFiles) {
      const outputFile = await this.emitter.emitSourceFile(file);
      await emitFile(this.emitter.getProgram(), {
        path: outputFile.path,
        content: outputFile.contents
      });
    }
  }
  reference(targetDeclaration, pathUp, pathDown, commonScope) {
    return this.emitter.result.none();
  }
  /**
   * Handle circular references. When this method is called it means we are resolving a circular reference.
   * By default if the target is a declaration it will call to {@link reference} otherwise it means we have an inline reference
   * @param target Reference target.
   * @param scope Current scope.
   * @returns Resolved reference entity.
   */
  circularReference(target, scope, cycle) {
    if (!cycle.containsDeclaration) {
      throw new Error(`Circular references to non-declarations are not supported by this emitter. Cycle:
${cycle}`);
    }
    if (target.kind !== "declaration") {
      return target;
    }
    compilerAssert(scope, "Emit context must have a scope set in order to create references to declarations.");
    const { pathUp, pathDown, commonScope } = resolveDeclarationReferenceScope(target, scope);
    return this.reference(target, pathUp, pathDown, commonScope);
  }
  declarationName(declarationType) {
    compilerAssert(declarationType.name !== void 0, "Can't emit a declaration that doesn't have a name.");
    if (declarationType.kind === "Enum" || declarationType.kind === "Intrinsic") {
      return declarationType.name;
    }
    if (declarationType.kind === "Operation" && declarationType.interface) {
      return declarationType.name;
    }
    if (!declarationType.templateMapper) {
      return declarationType.name;
    }
    let unspeakable = false;
    const parameterNames = declarationType.templateMapper.args.map((t) => {
      if (t.entityKind === "Indeterminate") {
        t = t.type;
      }
      if (!("kind" in t)) {
        return void 0;
      }
      switch (t.kind) {
        case "Model":
        case "Scalar":
        case "Interface":
        case "Operation":
        case "Enum":
        case "Union":
        case "Intrinsic":
          if (!t.name) {
            unspeakable = true;
            return void 0;
          }
          const declName = this.emitter.emitDeclarationName(t);
          if (declName === void 0) {
            unspeakable = true;
            return void 0;
          }
          return declName[0].toUpperCase() + declName.slice(1);
        default:
          unspeakable = true;
          return void 0;
      }
    });
    if (unspeakable) {
      return void 0;
    }
    return declarationType.name + parameterNames.join("");
  }
};

// src/typespec/core/packages/asset-emitter/dist/src/types.js
var EmitterResult = class {
};
var Declaration = class extends EmitterResult {
  name;
  scope;
  value;
  kind = "declaration";
  meta = {};
  constructor(name, scope, value) {
    if (value instanceof Placeholder) {
      value.onValue((v) => this.value = v);
    }
    super();
    this.name = name;
    this.scope = scope;
    this.value = value;
  }
};
var RawCode = class extends EmitterResult {
  value;
  kind = "code";
  constructor(value) {
    if (value instanceof Placeholder) {
      value.onValue((v) => this.value = v);
    }
    super();
    this.value = value;
  }
};
var NoEmit = class extends EmitterResult {
  kind = "none";
};
var CircularEmit = class extends EmitterResult {
  emitEntityKey;
  kind = "circular";
  constructor(emitEntityKey) {
    super();
    this.emitEntityKey = emitEntityKey;
  }
};

// src/typespec/core/packages/asset-emitter/dist/src/asset-emitter.js
function createAssetEmitter(program, TypeEmitterClass, emitContext) {
  const sourceFiles = [];
  const options = {
    noEmit: program.compilerOptions.dryRun ?? false,
    emitterOutputDir: emitContext.emitterOutputDir,
    ...emitContext.options
  };
  const typeId = CustomKeyMap.objectKeyer();
  const contextId = CustomKeyMap.objectKeyer();
  const entryId = CustomKeyMap.objectKeyer();
  const typeToEmitEntity = new CustomKeyMap(([method, type, context2]) => {
    return `${method}-${typeId.getKey(type)}-${contextId.getKey(context2)}`;
  });
  const waitingCircularRefs = new CustomKeyMap(([method, type, context2]) => {
    return `${method}-${typeId.getKey(type)}-${contextId.getKey(context2)}`;
  });
  const knownContexts = new CustomKeyMap(([entry, context2]) => {
    return `${entryId.getKey(entry)}-${contextId.getKey(context2)}`;
  });
  let lexicalTypeStack = [];
  let referenceTypeChain = [];
  let context = {
    lexicalContext: {},
    referenceContext: {}
  };
  let programContext = null;
  let incomingReferenceContext = null;
  let incomingReferenceContextTarget = null;
  const stateInterner = createInterner();
  const stackEntryInterner = createInterner();
  const assetEmitter = {
    getContext() {
      return {
        ...context.lexicalContext,
        ...context.referenceContext
      };
    },
    getOptions() {
      return options;
    },
    getProgram() {
      return program;
    },
    result: {
      declaration(name, value) {
        const scope = currentScope();
        compilerAssert2(scope, "Emit context must have a scope set in order to create declarations. Consider setting scope to a new source file's global scope in the `programContext` method of `TypeEmitter`.");
        return new Declaration(name, scope, value);
      },
      rawCode(value) {
        return new RawCode(value);
      },
      none() {
        return new NoEmit();
      }
    },
    createScope(block, name, parentScope = null) {
      let newScope;
      if (!parentScope) {
        newScope = {
          kind: "sourceFile",
          name,
          sourceFile: block,
          parentScope,
          childScopes: [],
          declarations: []
        };
      } else {
        newScope = {
          kind: "namespace",
          name,
          namespace: block,
          childScopes: [],
          declarations: [],
          parentScope
        };
      }
      parentScope?.childScopes.push(newScope);
      return newScope;
    },
    createSourceFile(path) {
      const basePath = options.emitterOutputDir;
      const sourceFile = {
        globalScope: void 0,
        path: joinPaths(basePath, path),
        imports: /* @__PURE__ */ new Map(),
        meta: {}
      };
      sourceFile.globalScope = this.createScope(sourceFile, "");
      sourceFiles.push(sourceFile);
      return sourceFile;
    },
    emitTypeReference(target, options2) {
      return withPatchedReferenceContext(options2?.referenceContext, () => {
        const oldIncomingReferenceContext = incomingReferenceContext;
        const oldIncomingReferenceContextTarget = incomingReferenceContextTarget;
        incomingReferenceContext = context.referenceContext ?? null;
        incomingReferenceContextTarget = incomingReferenceContext ? target : null;
        let result;
        if (target.kind === "ModelProperty") {
          result = invokeTypeEmitter("modelPropertyReference", target);
        } else if (target.kind === "EnumMember") {
          result = invokeTypeEmitter("enumMemberReference", target);
        }
        if (result) {
          incomingReferenceContext = oldIncomingReferenceContext;
          incomingReferenceContextTarget = oldIncomingReferenceContextTarget;
          return result;
        }
        const entity = this.emitType(target);
        incomingReferenceContext = oldIncomingReferenceContext;
        incomingReferenceContextTarget = oldIncomingReferenceContextTarget;
        let placeholder = null;
        if (entity.kind === "circular") {
          let waiting = waitingCircularRefs.get(entity.emitEntityKey);
          if (!waiting) {
            waiting = [];
            waitingCircularRefs.set(entity.emitEntityKey, waiting);
          }
          const typeChainSnapshot = referenceTypeChain;
          waiting.push({
            state: {
              lexicalTypeStack,
              context
            },
            cb: (resolvedEntity) => invokeReference(this, resolvedEntity, true, resolveReferenceCycle(typeChainSnapshot, entity, typeToEmitEntity))
          });
          placeholder = new Placeholder();
          return this.result.rawCode(placeholder);
        } else {
          return invokeReference(this, entity, false);
        }
        function invokeReference(assetEmitter2, entity2, circular, cycle) {
          let ref;
          const scope = currentScope();
          if (circular) {
            ref = typeEmitter.circularReference(entity2, scope, cycle);
          } else {
            if (entity2.kind !== "declaration") {
              return entity2;
            }
            compilerAssert2(scope, "Emit context must have a scope set in order to create references to declarations.");
            const { pathUp, pathDown, commonScope } = resolveDeclarationReferenceScope(entity2, scope);
            ref = typeEmitter.reference(entity2, pathUp, pathDown, commonScope);
          }
          if (!(ref instanceof EmitterResult)) {
            ref = assetEmitter2.result.rawCode(ref);
          }
          if (placeholder) {
            compilerAssert2(ref.kind !== "circular", "TypeEmitter `reference` returned circular emit");
            compilerAssert2(ref.kind === "none" || !(ref.value instanceof Placeholder), "TypeEmitter's `reference` method cannot return a placeholder.");
            switch (ref.kind) {
              case "code":
              case "declaration":
                placeholder.setValue(ref.value);
                break;
              case "none":
                placeholder.setValue("");
                break;
            }
          }
          return ref;
        }
      });
    },
    emitDeclarationName(type) {
      return typeEmitter.declarationName(type);
    },
    async writeOutput() {
      return typeEmitter.writeOutput(sourceFiles);
    },
    getSourceFiles() {
      return sourceFiles;
    },
    emitType(type, context2) {
      if (context2?.referenceContext) {
        incomingReferenceContext = context2?.referenceContext ?? incomingReferenceContext;
        incomingReferenceContextTarget = type ?? incomingReferenceContextTarget;
      }
      const declName = isDeclaration(type) && type.kind !== "Namespace" ? typeEmitter.declarationName(type) : null;
      const key = typeEmitterKey(type);
      let args;
      switch (key) {
        case "scalarDeclaration":
        case "scalarInstantiation":
        case "modelDeclaration":
        case "modelInstantiation":
        case "operationDeclaration":
        case "interfaceDeclaration":
        case "interfaceOperationDeclaration":
        case "enumDeclaration":
        case "unionDeclaration":
        case "unionInstantiation":
          args = [declName];
          break;
        case "arrayDeclaration":
          const arrayDeclElement = type.indexer.value;
          args = [declName, arrayDeclElement];
          break;
        case "arrayLiteral":
          const arrayLiteralElement = type.indexer.value;
          args = [arrayLiteralElement];
          break;
        case "intrinsic":
          args = [declName];
          break;
        default:
          args = [];
      }
      const result = invokeTypeEmitter(key, type, ...args);
      return result;
    },
    emitProgram(options2) {
      const namespace2 = program.getGlobalNamespaceType();
      if (options2?.emitGlobalNamespace) {
        this.emitType(namespace2);
        return;
      }
      for (const ns of namespace2.namespaces.values()) {
        if (ns.name === "TypeSpec" && !options2?.emitTypeSpecNamespace)
          continue;
        this.emitType(ns);
      }
      for (const model of namespace2.models.values()) {
        if (!isTemplateDeclaration3(model)) {
          this.emitType(model);
        }
      }
      for (const operation of namespace2.operations.values()) {
        if (!isTemplateDeclaration3(operation)) {
          this.emitType(operation);
        }
      }
      for (const enumeration of namespace2.enums.values()) {
        this.emitType(enumeration);
      }
      for (const union of namespace2.unions.values()) {
        if (!isTemplateDeclaration3(union)) {
          this.emitType(union);
        }
      }
      for (const iface of namespace2.interfaces.values()) {
        if (!isTemplateDeclaration3(iface)) {
          this.emitType(iface);
        }
      }
      for (const scalar of namespace2.scalars.values()) {
        this.emitType(scalar);
      }
    },
    emitModelProperties(model) {
      const res = invokeTypeEmitter("modelProperties", model);
      if (res instanceof EmitterResult) {
        return res;
      } else {
        return this.result.rawCode(res);
      }
    },
    emitModelProperty(property) {
      return invokeTypeEmitter("modelPropertyLiteral", property);
    },
    emitOperationParameters(operation) {
      return invokeTypeEmitter("operationParameters", operation, operation.parameters);
    },
    emitOperationReturnType(operation) {
      return invokeTypeEmitter("operationReturnType", operation, operation.returnType);
    },
    emitInterfaceOperations(iface) {
      return invokeTypeEmitter("interfaceDeclarationOperations", iface);
    },
    emitInterfaceOperation(operation) {
      const name = typeEmitter.declarationName(operation);
      if (name === void 0) {
        compilerAssert2(false, "Unnamed operations are not supported");
      }
      return invokeTypeEmitter("interfaceOperationDeclaration", operation, name);
    },
    emitEnumMembers(en) {
      return invokeTypeEmitter("enumMembers", en);
    },
    emitUnionVariants(union) {
      return invokeTypeEmitter("unionVariants", union);
    },
    emitTupleLiteralValues(tuple) {
      return invokeTypeEmitter("tupleLiteralValues", tuple);
    },
    async emitSourceFile(sourceFile) {
      return await typeEmitter.sourceFile(sourceFile);
    }
  };
  const typeEmitter = new TypeEmitterClass(assetEmitter);
  return assetEmitter;
  function invokeTypeEmitter(method, ...args) {
    const type = args[0];
    let entity;
    let emitEntityKey;
    let cached = false;
    withTypeContext(method, args, () => {
      emitEntityKey = [method, type, context];
      const seenEmitEntity = typeToEmitEntity.get(emitEntityKey);
      if (seenEmitEntity) {
        entity = seenEmitEntity;
        cached = true;
        return;
      }
      typeToEmitEntity.set(emitEntityKey, new CircularEmit(emitEntityKey));
      compilerAssert2(typeEmitter[method], `TypeEmitter doesn't have a method named ${method}.`);
      entity = liftToRawCode(typeEmitter[method](...args));
    });
    if (cached) {
      return entity;
    }
    if (entity instanceof Placeholder) {
      entity.onValue((v) => handleCompletedEntity(v));
      return entity;
    }
    handleCompletedEntity(entity);
    return entity;
    function handleCompletedEntity(entity2) {
      typeToEmitEntity.set(emitEntityKey, entity2);
      const waitingRefCbs = waitingCircularRefs.get(emitEntityKey);
      if (waitingRefCbs) {
        for (const record of waitingRefCbs) {
          withContext(record.state, () => {
            record.cb(entity2);
          });
        }
        waitingCircularRefs.set(emitEntityKey, []);
      }
      if (entity2.kind === "declaration") {
        entity2.scope.declarations.push(entity2);
      }
    }
    function liftToRawCode(value) {
      if (value instanceof EmitterResult) {
        return value;
      }
      return assetEmitter.result.rawCode(value);
    }
  }
  function isInternalMethod(method) {
    return method === "interfaceDeclarationOperations" || method === "interfaceOperationDeclaration" || method === "operationParameters" || method === "operationReturnType" || method === "modelProperties" || method === "enumMembers" || method === "tupleLiteralValues" || method === "unionVariants";
  }
  function setContextForType(method, args) {
    const type = args[0];
    let newTypeStack;
    if (isDeclaration(type) && type.kind !== "Intrinsic" && !isInternalMethod(method)) {
      newTypeStack = [stackEntryInterner.intern({ method, args: stackEntryInterner.intern(args) })];
      let ns = type.namespace;
      while (ns) {
        if (ns.name === "")
          break;
        newTypeStack.unshift(stackEntryInterner.intern({ method: "namespace", args: stackEntryInterner.intern([ns]) }));
        ns = ns.namespace;
      }
    } else {
      newTypeStack = [
        ...lexicalTypeStack,
        stackEntryInterner.intern({ method, args: stackEntryInterner.intern(args) })
      ];
    }
    lexicalTypeStack = newTypeStack;
    if (!programContext) {
      programContext = stateInterner.intern({
        lexicalContext: typeEmitter.programContext(program),
        referenceContext: stateInterner.intern({})
      });
    }
    context = programContext;
    for (const entry of lexicalTypeStack) {
      if (incomingReferenceContext && entry.args[0] === incomingReferenceContextTarget) {
        context = stateInterner.intern({
          lexicalContext: context.lexicalContext,
          referenceContext: stateInterner.intern({
            ...context.referenceContext,
            ...incomingReferenceContext
          })
        });
      }
      const seenContext = knownContexts.get([entry, context]);
      if (seenContext) {
        context = seenContext;
        continue;
      }
      const lexicalKey = entry.method + "Context";
      const referenceKey = entry.method + "ReferenceContext";
      if (keyHasContext(entry.method)) {
        compilerAssert2(typeEmitter[lexicalKey], `TypeEmitter doesn't have a method named ${lexicalKey}`);
      }
      if (keyHasReferenceContext(entry.method)) {
        compilerAssert2(typeEmitter[referenceKey], `TypeEmitter doesn't have a method named ${referenceKey}`);
      }
      const newContext = keyHasContext(entry.method) ? typeEmitter[lexicalKey](...entry.args) : {};
      const newReferenceContext = keyHasReferenceContext(entry.method) ? typeEmitter[referenceKey](...entry.args) : {};
      const newContextState = stateInterner.intern({
        lexicalContext: stateInterner.intern({
          ...context.lexicalContext,
          ...newContext
        }),
        referenceContext: stateInterner.intern({
          ...context.referenceContext,
          ...newReferenceContext
        })
      });
      knownContexts.set([entry, context], newContextState);
      context = newContextState;
    }
    if (!isInternalMethod(method)) {
      referenceTypeChain = [
        ...referenceTypeChain,
        stackEntryInterner.intern({
          method,
          type,
          context
        })
      ];
    }
  }
  function withTypeContext(method, args, cb) {
    const oldContext = context;
    const oldTypeStack = lexicalTypeStack;
    const oldRefTypeStack = referenceTypeChain;
    setContextForType(method, args);
    cb();
    context = oldContext;
    lexicalTypeStack = oldTypeStack;
    referenceTypeChain = oldRefTypeStack;
  }
  function withPatchedReferenceContext(referenceContext, cb) {
    if (referenceContext !== void 0) {
      const oldContext = context;
      context = stateInterner.intern({
        lexicalContext: context.lexicalContext,
        referenceContext: stateInterner.intern({
          ...context.referenceContext,
          ...referenceContext
        })
      });
      const result = cb();
      context = oldContext;
      return result;
    } else {
      return cb();
    }
  }
  function withContext(newContext, cb) {
    const oldContext = context;
    const oldTypeStack = lexicalTypeStack;
    context = newContext.context;
    lexicalTypeStack = newContext.lexicalTypeStack;
    cb();
    context = oldContext;
    lexicalTypeStack = oldTypeStack;
  }
  function typeEmitterKey(type) {
    switch (type.kind) {
      case "Model":
        if ($2(program).array.is(type) && type.name === "Array") {
          return "arrayLiteral";
        }
        if (type.name === "") {
          return "modelLiteral";
        }
        if (type.templateMapper) {
          return "modelInstantiation";
        }
        if (type.indexer && type.indexer.key.name === "integer") {
          return "arrayDeclaration";
        }
        return "modelDeclaration";
      case "Namespace":
        return "namespace";
      case "ModelProperty":
        return "modelPropertyLiteral";
      case "StringTemplate":
        return "stringTemplate";
      case "Boolean":
        return "booleanLiteral";
      case "String":
        return "stringLiteral";
      case "Number":
        return "numericLiteral";
      case "Operation":
        if (type.interface) {
          return "interfaceOperationDeclaration";
        } else {
          return "operationDeclaration";
        }
      case "Interface":
        return "interfaceDeclaration";
      case "Enum":
        return "enumDeclaration";
      case "EnumMember":
        return "enumMember";
      case "Union":
        if (!type.name) {
          return "unionLiteral";
        }
        if (type.templateMapper) {
          return "unionInstantiation";
        }
        return "unionDeclaration";
      case "UnionVariant":
        return "unionVariant";
      case "Tuple":
        return "tupleLiteral";
      case "Scalar":
        if (type.templateMapper) {
          return "scalarInstantiation";
        } else {
          return "scalarDeclaration";
        }
      case "Intrinsic":
        return "intrinsic";
      default:
        compilerAssert2(false, `Encountered type ${type.kind} which we don't know how to emit.`);
    }
  }
  function currentScope() {
    return context.referenceContext?.scope ?? context.lexicalContext?.scope ?? null;
  }
}
function isDeclaration(type) {
  switch (type.kind) {
    case "Namespace":
    case "Interface":
    case "Enum":
    case "Operation":
    case "Scalar":
    case "Intrinsic":
      return true;
    case "Model":
      return type.name ? type.name !== "" && type.name !== "Array" : false;
    case "Union":
      return type.name ? type.name !== "" : false;
    default:
      return false;
  }
}
function createInterner() {
  const emptyObject = {};
  const root = /* @__PURE__ */ new Map();
  function intern(object) {
    if (object === null || typeof object !== "object")
      return object;
    const keys = Object.keys(object);
    if (keys.length === 0)
      return emptyObject;
    let node = root.get(keys.length);
    if (!node) {
      node = /* @__PURE__ */ new Map();
      root.set(keys.length, node);
    }
    const sortedKeys = keys.sort();
    let curr = node;
    for (const key of sortedKeys) {
      if (!curr.has(key))
        curr.set(key, /* @__PURE__ */ new Map());
      curr = curr.get(key);
    }
    let valueNode = curr.valueNode;
    if (!valueNode) {
      valueNode = /* @__PURE__ */ new Map();
      curr.valueNode = valueNode;
    }
    const values = sortedKeys.map((k) => object[k]);
    let leaf = valueNode;
    for (let i = 0; i < values.length; i++) {
      const v = values[i];
      const isObj = v && typeof v === "object";
      let next;
      if (isObj) {
        if (!leaf.has("obj"))
          leaf.set("obj", /* @__PURE__ */ new WeakMap());
        next = leaf.get("obj");
        if (!next.has(v))
          next.set(v, /* @__PURE__ */ new Map());
        next = next.get(v);
      } else {
        if (!leaf.has("prim"))
          leaf.set("prim", /* @__PURE__ */ new Map());
        next = leaf.get("prim");
        if (!next.has(v))
          next.set(v, /* @__PURE__ */ new Map());
        next = next.get(v);
      }
      leaf = next;
    }
    if (leaf.has("interned")) {
      return leaf.get("interned");
    }
    leaf.set("interned", object);
    return object;
  }
  return { intern };
}
var noContext = /* @__PURE__ */ new Set(["modelPropertyReference", "enumMemberReference"]);
function keyHasContext(key) {
  return !noContext.has(key);
}
var noReferenceContext = /* @__PURE__ */ new Set([
  ...noContext,
  "booleanLiteral",
  "stringTemplate",
  "stringLiteral",
  "numericLiteral",
  "scalarInstantiation",
  "enumMember",
  "enumMembers",
  "intrinsic"
]);
function keyHasReferenceContext(key) {
  return !noReferenceContext.has(key);
}
function resolveReferenceCycle(stack, entity, typeToEmitEntity) {
  for (let i = stack.length - 1; i >= 0; i--) {
    if (stack[i].type === entity.emitEntityKey[1]) {
      return new ReferenceCycle(stack.slice(i).map((x) => {
        return {
          type: x.type,
          entity: typeToEmitEntity.get([x.method, x.type, x.context])
        };
      }));
    }
  }
  throw new Error(`Couldn't resolve the circular reference stack for ${getTypeName2(entity.emitEntityKey[1])}`);
}

// src/typespec/core/packages/asset-emitter/dist/src/builders/array-builder.js
import { compilerAssert as compilerAssert3 } from "@typespec/compiler";
var ArrayBuilder = class extends Array {
  #setPlaceholderValue(p, value) {
    for (const [i, item] of this.entries()) {
      if (item === p) {
        this[i] = value;
      }
    }
  }
  push(...values) {
    for (const v of values) {
      let toPush;
      if (v instanceof EmitterResult) {
        compilerAssert3(v.kind !== "circular", "Can't push a circular emit result.");
        if (v.kind === "none") {
          toPush = void 0;
        } else {
          toPush = v.value;
        }
      } else {
        toPush = v;
      }
      if (toPush instanceof Placeholder) {
        toPush.onValue((v2) => this.#setPlaceholderValue(toPush, v2));
      }
      super.push(toPush);
    }
    return values.length;
  }
};

// src/typespec/core/packages/asset-emitter/dist/src/builders/object-builder.js
import { compilerAssert as compilerAssert4 } from "@typespec/compiler";
var placeholderSym = Symbol("placeholder");
var ObjectBuilder = class _ObjectBuilder {
  [placeholderSym];
  constructor(initializer = {}) {
    const copyProperties = (source) => {
      for (const [key, value] of Object.entries(source)) {
        this.set(key, value);
      }
    };
    const registerPlaceholder = (placeholder) => {
      placeholder.onValue(copyProperties);
    };
    if (initializer instanceof _ObjectBuilder) {
      if (initializer[placeholderSym]) {
        this[placeholderSym] = initializer[placeholderSym];
        registerPlaceholder(initializer[placeholderSym]);
      }
      copyProperties(initializer);
    } else if (initializer instanceof Placeholder) {
      this[placeholderSym] = initializer;
      registerPlaceholder(initializer);
    } else {
      copyProperties(initializer);
    }
  }
  set(key, v) {
    let value = v;
    if (v instanceof EmitterResult) {
      compilerAssert4(v.kind !== "circular", "Can't set a circular emit result.");
      if (v.kind === "none") {
        this[key] = void 0;
        return;
      } else {
        value = v.value;
      }
    }
    if (value instanceof Placeholder) {
      value.onValue((v2) => {
        this[key] = v2;
      });
    }
    this[key] = value;
  }
};

// src/typespec/core/packages/openapi3/dist/src/encoding.js
import { getEncode as getEncode4 } from "@typespec/compiler";
import { isHeader as isHeader2, isQueryParam } from "@typespec/http";

// src/typespec/core/packages/openapi3/dist/src/std-scalar-schemas.js
function getSchemaForStdScalars(scalar, options) {
  switch (scalar.name) {
    case "bytes":
      return { type: "string", format: "byte" };
    case "numeric":
      return { type: "number" };
    case "integer":
      return { type: "integer" };
    case "int8":
      return { type: "integer", format: "int8" };
    case "int16":
      return { type: "integer", format: "int16" };
    case "int32":
      return { type: "integer", format: "int32" };
    case "int64":
      return { type: "integer", format: "int64" };
    case "safeint":
      switch (options.safeintStrategy) {
        case "double-int":
          return { type: "integer", format: "double-int" };
        case "int64":
        default:
          return { type: "integer", format: "int64" };
      }
    case "uint8":
      return { type: "integer", format: "uint8" };
    case "uint16":
      return { type: "integer", format: "uint16" };
    case "uint32":
      return { type: "integer", format: "uint32" };
    case "uint64":
      return { type: "integer", format: "uint64" };
    case "float":
      return { type: "number" };
    case "float64":
      return { type: "number", format: "double" };
    case "float32":
      return { type: "number", format: "float" };
    case "decimal":
      return { type: "number", format: "decimal" };
    case "decimal128":
      return { type: "number", format: "decimal128" };
    case "string":
      return { type: "string" };
    case "boolean":
      return { type: "boolean" };
    case "plainDate":
      return { type: "string", format: "date" };
    case "utcDateTime":
    case "offsetDateTime":
      return { type: "string", format: "date-time" };
    case "plainTime":
      return { type: "string", format: "time" };
    case "duration":
      return { type: "string", format: "duration" };
    case "url":
      return { type: "string", format: "uri" };
    default:
      const _assertNever = scalar.name;
      return {};
  }
}

// src/typespec/core/packages/openapi3/dist/src/encoding.js
function isParameterStyleEncoding(encoding) {
  if (!encoding)
    return false;
  return ["ArrayEncoding.pipeDelimited", "ArrayEncoding.spaceDelimited"].includes(encoding);
}
function applyEncoding(program, typespecType, target, getEncodedFieldName, options) {
  const encodedFieldName = getEncodedFieldName(typespecType);
  const targetObject = new ObjectBuilder(target);
  const encodeData = getEncode4(program, typespecType);
  if (encodeData) {
    if (isQueryParam(program, typespecType) && isParameterStyleEncoding(encodeData.encoding)) {
      return targetObject;
    }
    const newType = getSchemaForStdScalars(encodeData.type, options);
    targetObject.type = newType.type;
    targetObject[encodedFieldName] = mergeFormatAndEncoding(targetObject[encodedFieldName], encodeData.encoding, newType.format);
    return targetObject;
  }
  if (isDateTimeHeader(program, typespecType, targetObject, encodedFieldName)) {
    targetObject[encodedFieldName] = "http-date";
    return targetObject;
  }
  return targetObject;
}
function mergeFormatAndEncoding(format3, encoding, encodeAsFormat) {
  switch (format3) {
    case void 0:
      return encodeAsFormat ?? encoding ?? format3;
    case "date-time":
      switch (encoding) {
        case "rfc3339":
          return "date-time";
        case "unixTimestamp":
          return "unixtime";
        case "rfc7231":
          return "http-date";
        default:
          return encoding;
      }
    case "duration":
      switch (encoding) {
        case "ISO8601":
          return "duration";
        default:
          return encodeAsFormat ?? encoding;
      }
    default:
      return encodeAsFormat ?? encoding ?? format3;
  }
}
function isDateTimeHeader(program, typespecType, target, encodedFieldName) {
  if (isHeader2(program, typespecType) && target[encodedFieldName] === "date-time") {
    return true;
  }
  return false;
}

// src/typespec/core/packages/openapi3/dist/src/openapi-helpers-3-0.js
function getEncodingFieldName() {
  return "format";
}
var applyEncoding2 = (program, typespecType, target, options) => {
  return applyEncoding(program, typespecType, target, getEncodingFieldName, options);
};
var getRawBinarySchema = () => {
  return { type: "string", format: "binary" };
};
var isRawBinarySchema = (schema4) => {
  return schema4.type === "string" && schema4.format === "binary";
};

// src/typespec/core/packages/openapi3/dist/src/openapi-helpers-3-1.js
function getEncodingFieldName2(typespecType) {
  const typeIsBytes = isScalarExtendsBytes(typespecType.kind === "ModelProperty" ? typespecType.type : typespecType);
  if (typeIsBytes) {
    return "contentEncoding";
  }
  return "format";
}
var applyEncoding3 = (program, typespecType, target, options) => {
  return applyEncoding(program, typespecType, target, getEncodingFieldName2, options);
};
var getRawBinarySchema2 = (contentType) => {
  if (contentType) {
    return { contentMediaType: contentType };
  }
  return {};
};
var isRawBinarySchema2 = (schema4) => {
  return schema4.type === void 0;
};

// src/typespec/core/packages/openapi3/dist/src/schema-emitter-3-0.js
import { compilerAssert as compilerAssert6, getDiscriminatedUnion, getExamples, getMaxValueExclusive, getMinValueExclusive, isNullType, serializeValueAsJson as serializeValueAsJson3 } from "@typespec/compiler";
import { $ as $4 } from "@typespec/compiler/typekit";
import { shouldInline as shouldInline2 } from "@typespec/openapi";

// src/typespec/core/packages/openapi3/dist/src/schema-emitter.js
import { compilerAssert as compilerAssert5, explainStringTemplateNotSerializable, getDeprecated, getDiscriminatedUnionFromInheritance, getDiscriminator, getDoc, getFormat, getMaxItems, getMaxLength, getMaxValue, getMinItems, getMinLength, getMinValue, getNamespaceFullName, getPattern, getSummary, getTypeName as getTypeName3, ignoreDiagnostics as ignoreDiagnostics2, isArrayModelType, isNeverType, isSecret, resolveEncodedName } from "@typespec/compiler";
import { capitalize } from "@typespec/compiler/casing";
import { $ as $3 } from "@typespec/compiler/typekit";
import { Visibility, getVisibilitySuffix } from "@typespec/http";
import { checkDuplicateTypeName, getExtensions as getExtensions3, getExternalDocs, getOpenAPITypeName, isReadonlyProperty, shouldInline } from "@typespec/openapi";

// src/typespec/core/packages/openapi3/dist/src/attach-extensions.js
import { getExtensions as getExtensions2 } from "@typespec/openapi";
function attachExtensions(program, type, emitObject) {
  const extensions = getExtensions2(program, type);
  if (extensions) {
    for (const key of extensions.keys()) {
      emitObject[key] = extensions.get(key);
    }
  }
}

// src/typespec/core/packages/openapi3/dist/src/schema-emitter.js
var OpenAPI3SchemaEmitterBase = class extends TypeEmitter {
  _metadataInfo;
  _visibilityUsage;
  _options;
  _jsonSchemaModule;
  _xmlModule;
  constructor(emitter, metadataInfo, visibilityUsage, options, optionalDependencies) {
    super(emitter);
    this._metadataInfo = metadataInfo;
    this._visibilityUsage = visibilityUsage;
    this._options = options;
    this._jsonSchemaModule = optionalDependencies.jsonSchemaModule;
    this._xmlModule = optionalDependencies.xmlModule;
  }
  modelDeclarationReferenceContext(model, name) {
    return this.reduceContext(model);
  }
  modelLiteralReferenceContext(model) {
    return this.reduceContext(model);
  }
  scalarDeclarationReferenceContext(scalar, name) {
    return this.reduceContext(scalar);
  }
  enumDeclarationReferenceContext(en, name) {
    return this.reduceContext(en);
  }
  unionDeclarationReferenceContext(union) {
    return this.reduceContext(union);
  }
  reduceContext(type) {
    const visibility = this.#getVisibilityContext();
    const patch = {};
    if (visibility !== Visibility.Read && !this._metadataInfo.isTransformed(type, visibility)) {
      patch.visibility = Visibility.Read;
    }
    const contentType = this.getContentType();
    if (contentType === "application/json") {
      patch.contentType = void 0;
    }
    return patch;
  }
  applyDiscriminator(type, schema4) {
    const program = this.emitter.getProgram();
    const discriminator = getDiscriminator(program, type);
    if (discriminator) {
      schema4.discriminator = { ...discriminator };
      const discriminatedUnion = ignoreDiagnostics2(getDiscriminatedUnionFromInheritance(type, discriminator));
      if (discriminatedUnion.variants.size > 0) {
        schema4.discriminator.mapping = this.getDiscriminatorMapping(discriminatedUnion.variants);
      }
    }
  }
  shouldSealSchema(model) {
    if (!model.indexer) {
      const derivedModels = model.derivedModels.filter(includeDerivedModel);
      return !!this._options.sealObjectSchemas && !derivedModels.length;
    }
    return isNeverType(model.indexer.value);
  }
  applyModelIndexer(schema4, model) {
    const shouldSeal = this.shouldSealSchema(model);
    if (!shouldSeal && !model.indexer)
      return;
    if (shouldSeal) {
      const props = new ObjectBuilder(schema4.properties ?? {});
      let baseModel = model.baseModel;
      while (baseModel) {
        const result = this.emitter.emitModelProperties(baseModel);
        baseModel = baseModel.baseModel;
        if (result.kind !== "code" || !(result.value instanceof ObjectBuilder))
          continue;
        const baseProperties = result.value;
        for (const key of Object.keys(baseProperties)) {
          if (key in props)
            continue;
          props.set(key, {});
        }
      }
      if (Object.keys(props).length > 0) {
        schema4.set("properties", props);
      }
    }
    const additionalPropertiesSchema = shouldSeal ? { not: {} } : this.emitter.emitTypeReference(model.indexer.value);
    schema4.set("additionalProperties", additionalPropertiesSchema);
  }
  modelDeclaration(model, _) {
    const program = this.emitter.getProgram();
    const visibility = this.#getVisibilityContext();
    const schema4 = new ObjectBuilder({
      type: "object",
      required: this.#requiredModelProperties(model, visibility),
      properties: this.emitter.emitModelProperties(model)
    });
    this.applyModelIndexer(schema4, model);
    const derivedModels = model.derivedModels.filter(includeDerivedModel);
    for (const child of derivedModels) {
      this.emitter.emitTypeReference(child);
    }
    this.applyDiscriminator(model, schema4);
    this.#applyExternalDocs(model, schema4);
    if (model.baseModel) {
      schema4.set("allOf", Builders.array([this.emitter.emitTypeReference(model.baseModel)]));
    }
    const baseName = getOpenAPITypeName(program, model, this.#typeNameOptions());
    const isMultipart = this.getContentType().startsWith("multipart/");
    const name = isMultipart ? baseName + "MultiPart" : baseName;
    return this.#createDeclaration(model, name, this.applyConstraints(model, schema4));
  }
  #applyExternalDocs(typespecType, target) {
    const externalDocs = getExternalDocs(this.emitter.getProgram(), typespecType);
    if (externalDocs) {
      target.externalDocs = externalDocs;
    }
  }
  #typeNameOptions() {
    const serviceNamespaceName = this.emitter.getContext().serviceNamespaceName;
    return {
      // shorten type names by removing TypeSpec and service namespace
      namespaceFilter(ns) {
        const name = getNamespaceFullName(ns);
        return name !== serviceNamespaceName;
      }
    };
  }
  #getVisibilityContext() {
    return this.emitter.getContext().visibility ?? Visibility.Read;
  }
  #ignoreMetadataAnnotations() {
    return this.emitter.getContext().ignoreMetadataAnnotations;
  }
  getContentType() {
    return this.emitter.getContext().contentType ?? "application/json";
  }
  modelLiteral(model) {
    const schema4 = new ObjectBuilder({
      type: "object",
      properties: this.emitter.emitModelProperties(model),
      required: this.#requiredModelProperties(model, this.#getVisibilityContext())
    });
    this.applyModelIndexer(schema4, model);
    return schema4;
  }
  modelInstantiation(model, name) {
    name = name ?? getOpenAPITypeName(this.emitter.getProgram(), model, this.#typeNameOptions());
    if (!name) {
      return this.modelLiteral(model);
    }
    return this.modelDeclaration(model, name);
  }
  unionInstantiation(union, name) {
    if (!name) {
      return this.unionLiteral(union);
    }
    return this.unionDeclaration(union, name);
  }
  arrayDeclaration(array, _, elementType) {
    const schema4 = new ObjectBuilder({
      type: "array",
      items: this.emitter.emitTypeReference(elementType)
    });
    const name = getOpenAPITypeName(this.emitter.getProgram(), array, this.#typeNameOptions());
    return this.#createDeclaration(array, name, this.applyConstraints(array, schema4));
  }
  arrayLiteral(array, elementType) {
    return this.#inlineType(array, new ObjectBuilder({
      type: "array",
      items: this.emitter.emitTypeReference(elementType)
    }));
  }
  arrayLiteralReferenceContext(array, elementType) {
    return {
      visibility: this.#getVisibilityContext() | Visibility.Item
    };
  }
  #requiredModelProperties(model, visibility) {
    const requiredProps = [];
    for (const prop of model.properties.values()) {
      if (isNeverType(prop.type)) {
        continue;
      }
      if (!this._metadataInfo.isPayloadProperty(prop, visibility, this.#ignoreMetadataAnnotations())) {
        continue;
      }
      if (!this._metadataInfo.isOptional(prop, visibility)) {
        const encodedName = resolveEncodedName(this.emitter.getProgram(), prop, this.getContentType());
        requiredProps.push(encodedName);
      }
    }
    const discriminator = getDiscriminator(this.emitter.getProgram(), model);
    if (discriminator) {
      if (!requiredProps.includes(discriminator.propertyName)) {
        requiredProps.push(discriminator.propertyName);
      }
    }
    return requiredProps.length > 0 ? requiredProps : void 0;
  }
  modelProperties(model) {
    const program = this.emitter.getProgram();
    const props = new ObjectBuilder();
    const visibility = this.emitter.getContext().visibility;
    const contentType = this.getContentType();
    for (const prop of model.properties.values()) {
      if (isNeverType(prop.type)) {
        continue;
      }
      if (!this._metadataInfo.isPayloadProperty(prop, visibility, this.#ignoreMetadataAnnotations())) {
        continue;
      }
      const result = this.emitter.emitModelProperty(prop);
      const encodedName = resolveEncodedName(program, prop, contentType);
      props.set(encodedName, result);
    }
    const discriminator = getDiscriminator(program, model);
    if (discriminator && !(discriminator.propertyName in props)) {
      props.set(discriminator.propertyName, {
        type: "string",
        description: `Discriminator property for ${model.name}.`
      });
    }
    if (Object.keys(props).length === 0) {
      return this.emitter.result.none();
    }
    return props;
  }
  getRawBinarySchema() {
    throw new Error("Method not implemented.");
  }
  modelPropertyLiteral(prop) {
    const program = this.emitter.getProgram();
    const refSchema = this.emitter.emitTypeReference(prop.type, {
      referenceContext: {}
    });
    if (refSchema.kind !== "code") {
      reportDiagnostic(program, {
        code: "invalid-model-property",
        format: {
          type: prop.type.kind
        },
        target: prop
      });
      return {};
    }
    const isRef = refSchema.value instanceof Placeholder || "$ref" in refSchema.value;
    const schema4 = this.applyEncoding(prop, refSchema.value);
    const additionalProps = this.applyConstraints(prop, {}, schema4);
    if (prop.defaultValue) {
      additionalProps.default = getDefaultValue(program, prop.defaultValue, prop);
    }
    if (isReadonlyProperty(program, prop)) {
      additionalProps.readOnly = true;
    }
    attachExtensions(program, prop, additionalProps);
    const contentType = this.getContentType();
    if (contentType && contentType.startsWith("multipart/") && !isRef && schema4) {
      const extensions = getExtensions3(program, prop);
      for (const [key, value] of extensions) {
        schema4[key] = value;
      }
    }
    if (schema4 && isRef && !(prop.type.kind === "Model" && isArrayModelType(program, prop.type))) {
      if (Object.keys(additionalProps).length === 0) {
        return schema4;
      } else {
        if (additionalProps.xml?.attribute) {
          return additionalProps;
        } else {
          return {
            allOf: [schema4],
            ...additionalProps
          };
        }
      }
    } else {
      if (getOneOf(program, prop) && schema4.anyOf) {
        schema4.oneOf = schema4.anyOf;
        delete schema4.anyOf;
      }
      const merged = new ObjectBuilder(schema4);
      for (const [key, value] of Object.entries(additionalProps)) {
        merged.set(key, value);
      }
      return merged;
    }
  }
  booleanLiteral(boolean) {
    return { type: "boolean", enum: [boolean.value] };
  }
  stringLiteral(string2) {
    return { type: "string", enum: [string2.value] };
  }
  stringTemplate(string2) {
    if (string2.stringValue !== void 0) {
      return { type: "string", enum: [string2.stringValue] };
    }
    const diagnostics = explainStringTemplateNotSerializable(string2);
    this.emitter.getProgram().reportDiagnostics(diagnostics.map((x) => ({ ...x, severity: "warning" })));
    return { type: "string" };
  }
  numericLiteral(number) {
    return { type: "number", enum: [number.value] };
  }
  enumDeclaration(en, name) {
    const baseName = getOpenAPITypeName(this.emitter.getProgram(), en, this.#typeNameOptions());
    return this.#createDeclaration(en, baseName, new ObjectBuilder(this.enumSchema(en)));
  }
  enumSchema(en) {
    throw new Error("Method not implemented.");
  }
  enumMember(member) {
    return this.enumMemberReference(member);
  }
  enumMemberReference(member) {
    switch (typeof member.value) {
      case "undefined":
        return { type: "string", enum: [member.name] };
      case "string":
        return { type: "string", enum: [member.value] };
      case "number":
        return { type: "number", enum: [member.value] };
    }
  }
  unionDeclaration(union, name) {
    const schema4 = this.unionSchema(union);
    const baseName = getOpenAPITypeName(this.emitter.getProgram(), union, this.#typeNameOptions());
    return this.#createDeclaration(union, baseName, schema4);
  }
  unionSchema(union) {
    throw new Error("Method not implemented.");
  }
  discriminatedUnion(union) {
    const tk = $3(this.emitter.getProgram());
    let schema4;
    if (union.options.envelope === "none") {
      const items = new ArrayBuilder();
      for (const variant of union.variants.values()) {
        items.push(this.emitter.emitTypeReference(variant));
      }
      schema4 = {
        type: "object",
        oneOf: items,
        discriminator: {
          propertyName: union.options.discriminatorPropertyName,
          mapping: this.getDiscriminatorMapping(union.variants)
        }
      };
    } else {
      const envelopeVariants = /* @__PURE__ */ new Map();
      for (const [name, variant] of union.variants) {
        const envelopeModel = tk.model.create({
          name: union.type.name + capitalize(name),
          properties: {
            [union.options.discriminatorPropertyName]: tk.modelProperty.create({
              name: union.options.discriminatorPropertyName,
              type: tk.literal.createString(name)
            }),
            [union.options.envelopePropertyName]: tk.modelProperty.create({
              name: union.options.envelopePropertyName,
              type: variant
            })
          }
        });
        envelopeVariants.set(name, envelopeModel);
      }
      const items = new ArrayBuilder();
      for (const variant of envelopeVariants.values()) {
        items.push(this.emitter.emitTypeReference(variant));
      }
      schema4 = {
        type: "object",
        oneOf: items,
        discriminator: {
          propertyName: union.options.discriminatorPropertyName,
          mapping: this.getDiscriminatorMapping(envelopeVariants)
        }
      };
    }
    return this.applyConstraints(union.type, schema4);
  }
  getDiscriminatorMapping(variants) {
    const mapping = {};
    for (const [key, model] of variants.entries()) {
      const ref = this.emitter.emitTypeReference(model);
      compilerAssert5(ref.kind === "code", "Unexpected ref schema. Should be kind: code");
      mapping[key] = ref.value.$ref;
    }
    return mapping;
  }
  unionLiteral(union) {
    return this.unionSchema(union);
  }
  unionVariants(union) {
    const variants = new ArrayBuilder();
    for (const variant of union.variants.values()) {
      variants.push(this.emitter.emitType(variant));
    }
    return variants;
  }
  unionVariant(variant) {
    return this.emitter.emitTypeReference(variant.type);
  }
  modelPropertyReference(prop) {
    return this.modelPropertyLiteral(prop);
  }
  reference(targetDeclaration, pathUp, pathDown, commonScope) {
    if (targetDeclaration.value instanceof Placeholder) {
      throw new Error("Can't form reference to declaration that hasn't been created yet");
    }
    const currentSfScope = pathUp[pathUp.length - 1];
    const targetSfScope = pathDown[0];
    if (targetSfScope && currentSfScope && !targetSfScope.sourceFile.meta.shouldEmit) {
      currentSfScope.sourceFile.meta.bundledRefs.push(targetDeclaration);
    }
    return { $ref: `#/components/schemas/${targetDeclaration.name}` };
  }
  circularReference(target, scope, cycle) {
    if (!cycle.containsDeclaration) {
      reportDiagnostic(this.emitter.getProgram(), {
        code: "inline-cycle",
        format: {
          type: cycle.toString()
        },
        target: cycle.first.type
      });
      return {};
    }
    return super.circularReference(target, scope, cycle);
  }
  scalarDeclaration(scalar, name) {
    const isStd = isStdType(this.emitter.getProgram(), scalar);
    const schema4 = this.#getSchemaForScalar(scalar);
    const baseName = getOpenAPITypeName(this.emitter.getProgram(), scalar, this.#typeNameOptions());
    return isStd ? schema4 : this.#createDeclaration(scalar, baseName, new ObjectBuilder(schema4));
  }
  scalarInstantiation(scalar, name) {
    return this.#getSchemaForScalar(scalar);
  }
  tupleLiteral(tuple) {
    return { type: "array", items: {} };
  }
  #getSchemaForScalar(scalar) {
    let result = {};
    const isStd = isStdType(this.emitter.getProgram(), scalar);
    if (isStd) {
      result = this.getSchemaForStdScalars(scalar);
    } else if (scalar.baseScalar) {
      result = this.#getSchemaForScalar(scalar.baseScalar);
    }
    const withDecorators = this.applyEncoding(scalar, this.applyConstraints(scalar, result));
    if (isStd) {
      delete withDecorators.description;
    }
    return withDecorators;
  }
  getSchemaForStdScalars(scalar) {
    return getSchemaForStdScalars(scalar, this._options);
  }
  applyCustomConstraints(type, target, refSchema) {
  }
  applyConstraints(type, original, refSchema) {
    const schema4 = new ObjectBuilder(original);
    const program = this.emitter.getProgram();
    const applyConstraint = (fn, key) => {
      const value = fn(program, type);
      if (value !== void 0) {
        schema4[key] = value;
      }
    };
    applyConstraint(getMinLength, "minLength");
    applyConstraint(getMaxLength, "maxLength");
    applyConstraint(getMinValue, "minimum");
    applyConstraint(getMaxValue, "maximum");
    applyConstraint(getPattern, "pattern");
    applyConstraint(getMinItems, "minItems");
    applyConstraint(getMaxItems, "maxItems");
    const jsonSchemaModule = this._jsonSchemaModule;
    if (jsonSchemaModule) {
      applyConstraint(jsonSchemaModule.getMultipleOf, "multipleOf");
      applyConstraint(jsonSchemaModule.getUniqueItems, "uniqueItems");
      applyConstraint(jsonSchemaModule.getMinProperties, "minProperties");
      applyConstraint(jsonSchemaModule.getMaxProperties, "maxProperties");
    }
    if (isSecret(program, type)) {
      schema4.format = "password";
    }
    if (!isStdType(program, type) || type.name !== "url") {
      applyConstraint(getFormat, "format");
    }
    applyConstraint(getDoc, "description");
    applyConstraint(getSummary, "title");
    applyConstraint((p, t) => getDeprecated(p, t) !== void 0 ? true : void 0, "deprecated");
    this.applyCustomConstraints(type, schema4, refSchema);
    this.applyXml(type, schema4, refSchema);
    attachExtensions(program, type, schema4);
    return new ObjectBuilder(schema4);
  }
  applyXml(type, schema4, refSchema) {
    const program = this.emitter.getProgram();
    if (this._xmlModule) {
      switch (type.kind) {
        case "Scalar":
        case "Model":
          this._xmlModule.attachXmlObjectForScalarOrModel(program, type, schema4);
          break;
        case "ModelProperty":
          this._xmlModule.attachXmlObjectForModelProperty(program, this._options, type, schema4, refSchema);
          break;
      }
    }
  }
  #inlineType(type, schema4) {
    if (this._options.includeXTypeSpecName !== "never") {
      schema4.set("x-typespec-name", getTypeName3(type, this.#typeNameOptions()));
    }
    return schema4;
  }
  #createDeclaration(type, name, schema4) {
    const skipNameValidation = type.kind === "Model" && type.templateMapper !== void 0;
    if (!skipNameValidation) {
      name = ensureValidComponentFixedFieldKey(this.emitter.getProgram(), type, name);
    }
    const refUrl = getRef(this.emitter.getProgram(), type);
    if (refUrl) {
      return {
        $ref: refUrl
      };
    }
    if (shouldInline(this.emitter.getProgram(), type)) {
      return this.#inlineType(type, schema4);
    }
    const title3 = getSummary(this.emitter.getProgram(), type);
    if (title3) {
      schema4.set("title", title3);
    }
    const usage = this._visibilityUsage.getUsage(type);
    const shouldAddSuffix = usage !== void 0 && usage.size > 1;
    const visibility = this.#getVisibilityContext();
    const fullName = name + (shouldAddSuffix ? getVisibilitySuffix(visibility, Visibility.Read) : "");
    const decl = this.emitter.result.declaration(fullName, schema4);
    checkDuplicateTypeName(this.emitter.getProgram(), type, fullName, Object.fromEntries(decl.scope.declarations.map((x) => [x.name, true])));
    return decl;
  }
  applyEncoding(typespecType, target) {
    throw new Error("Method not implemented.");
  }
  programContext(program) {
    const sourceFile = this.emitter.createSourceFile("openapi");
    return { scope: sourceFile.globalScope };
  }
};
var Builders = {
  array: (items) => {
    const builder = new ArrayBuilder();
    for (const item of items) {
      builder.push(item);
    }
    return builder;
  },
  object: (obj) => {
    const builder = new ObjectBuilder();
    for (const [key, value] of Object.entries(obj)) {
      builder.set(key, value);
    }
    return builder;
  }
};

// src/typespec/core/packages/openapi3/dist/src/schema-emitter-3-0.js
function createWrappedSchemaEmitterClass(metadataInfo, visibilityUsage, options, optionalDependencies) {
  return class extends OpenAPI3SchemaEmitter {
    constructor(emitter) {
      super(emitter, metadataInfo, visibilityUsage, options, optionalDependencies);
    }
  };
}
var createSchemaEmitter3_0 = ({ program, context, ...rest }) => {
  return createAssetEmitter(program, createWrappedSchemaEmitterClass(rest.metadataInfo, rest.visibilityUsage, rest.options, rest.optionalDependencies), context);
};
var OpenAPI3SchemaEmitter = class extends OpenAPI3SchemaEmitterBase {
  #applySchemaExamples(type, target) {
    const program = this.emitter.getProgram();
    const examples = getExamples(program, type);
    if (examples.length > 0) {
      target.set("example", serializeValueAsJson3(program, examples[0].value, type));
    }
  }
  applyCustomConstraints(type, target, refSchema) {
    const program = this.emitter.getProgram();
    const minValueExclusive = getMinValueExclusive(program, type);
    if (minValueExclusive !== void 0) {
      target.minimum = minValueExclusive;
      target.exclusiveMinimum = true;
    }
    const maxValueExclusive = getMaxValueExclusive(program, type);
    if (maxValueExclusive !== void 0) {
      target.maximum = maxValueExclusive;
      target.exclusiveMaximum = true;
    }
    this.#applySchemaExamples(type, target);
  }
  applyEncoding(typespecType, target) {
    return applyEncoding2(this.emitter.getProgram(), typespecType, target, this._options);
  }
  getRawBinarySchema() {
    return getRawBinarySchema();
  }
  enumSchema(en) {
    const program = this.emitter.getProgram();
    if (en.members.size === 0) {
      reportDiagnostic(program, { code: "empty-enum", target: en });
      return {};
    }
    const enumTypes = /* @__PURE__ */ new Set();
    const enumValues = /* @__PURE__ */ new Set();
    for (const member of en.members.values()) {
      enumTypes.add(typeof member.value === "number" ? "number" : "string");
      enumValues.add(member.value ?? member.name);
    }
    if (enumTypes.size > 1) {
      reportDiagnostic(program, { code: "enum-unique-type", target: en });
    }
    const schema4 = {
      type: enumTypes.values().next().value,
      enum: [...enumValues]
    };
    return this.applyConstraints(en, schema4);
  }
  unionSchema(union) {
    const program = this.emitter.getProgram();
    const [discriminated] = getDiscriminatedUnion(program, union);
    if (discriminated) {
      return this.discriminatedUnion(discriminated);
    }
    if (union.variants.size === 0) {
      reportDiagnostic(program, { code: "empty-union", target: union });
      return new ObjectBuilder({});
    }
    const variants = Array.from(union.variants.values());
    const literalVariantEnumByType = {};
    const ofType = getOneOf(program, union) ? "oneOf" : "anyOf";
    const schemaMembers = [];
    let nullable = false;
    const isMultipart = this.getContentType().startsWith("multipart/");
    for (const variant of variants) {
      if (isNullType(variant.type)) {
        nullable = true;
        continue;
      }
      if (isMultipart && isBytesKeptRaw(program, variant.type)) {
        schemaMembers.push({ schema: this.getRawBinarySchema(), type: variant.type });
        continue;
      }
      if (isLiteralType(variant.type)) {
        if (!literalVariantEnumByType[variant.type.kind]) {
          const enumValue = [variant.type.value];
          literalVariantEnumByType[variant.type.kind] = enumValue;
          schemaMembers.push({
            schema: { type: literalType(variant.type), enum: enumValue },
            type: null
          });
        } else {
          literalVariantEnumByType[variant.type.kind].push(variant.type.value);
        }
      } else {
        const enumSchema = this.emitter.emitTypeReference(variant.type, {
          referenceContext: isMultipart ? { contentType: "application/json" } : {}
        });
        compilerAssert6(enumSchema.kind === "code", "Unexpected enum schema. Should be kind: code");
        schemaMembers.push({ schema: enumSchema.value, type: variant.type });
      }
    }
    const wrapWithObjectBuilder = (schemaMember, { mergeUnionWideConstraints }) => {
      const schema5 = schemaMember.schema;
      const type = schemaMember.type;
      const additionalProps = mergeUnionWideConstraints ? this.applyConstraints(union, {}) : {};
      if (mergeUnionWideConstraints && nullable) {
        additionalProps.nullable = true;
      }
      if (Object.keys(additionalProps).length === 0) {
        return new ObjectBuilder(schema5);
      } else {
        if ((schema5 instanceof Placeholder || "$ref" in schema5) && !(type && shouldInline2(program, type))) {
          if (type && type.kind === "Model") {
            return new ObjectBuilder({
              type: "object",
              allOf: Builders.array([schema5]),
              ...additionalProps
            });
          } else if (type && type.kind === "Scalar") {
            const stdType = $4(program).scalar.getStdBase(type);
            const outputType = stdType ? this.getSchemaForStdScalars(stdType).type : void 0;
            return new ObjectBuilder({
              type: outputType,
              allOf: Builders.array([schema5]),
              ...additionalProps
            });
          } else {
            return new ObjectBuilder({ allOf: Builders.array([schema5]), ...additionalProps });
          }
        } else {
          const merged = new ObjectBuilder(schema5);
          for (const [key, value] of Object.entries(additionalProps)) {
            merged.set(key, value);
          }
          return merged;
        }
      }
    };
    const checkMerge = (schemaMembers2) => {
      if (nullable) {
        for (const m of schemaMembers2) {
          if (m.schema instanceof Placeholder || "$ref" in m.schema) {
            return true;
          }
        }
      }
      return false;
    };
    if (schemaMembers.length === 0) {
      if (nullable) {
        reportDiagnostic(program, { code: "union-null", target: union });
        return new ObjectBuilder({});
      } else {
        compilerAssert6(false, "Attempting to emit an empty union");
      }
    }
    if (schemaMembers.length === 1) {
      return wrapWithObjectBuilder(schemaMembers[0], { mergeUnionWideConstraints: true });
    }
    const isMerge = checkMerge(schemaMembers);
    const schema4 = {
      [ofType]: schemaMembers.map((m) => wrapWithObjectBuilder(m, { mergeUnionWideConstraints: isMerge }))
    };
    if (!isMerge && nullable) {
      schema4.nullable = true;
    }
    return this.applyConstraints(union, schema4);
  }
  intrinsic(intrinsic, name) {
    switch (name) {
      case "unknown":
        return {};
      case "null":
        return { nullable: true };
    }
    reportDiagnostic(this.emitter.getProgram(), {
      code: "invalid-schema",
      format: { type: name },
      target: intrinsic
    });
    return {};
  }
};

// src/typespec/core/packages/openapi3/dist/src/schema-emitter-3-1.js
import { compilerAssert as compilerAssert7, getDiscriminatedUnion as getDiscriminatedUnion2, getExamples as getExamples2, getMaxValueExclusive as getMaxValueExclusive2, getMinValueExclusive as getMinValueExclusive2, serializeValueAsJson as serializeValueAsJson4 } from "@typespec/compiler";
import { shouldInline as shouldInline3 } from "@typespec/openapi";
function createWrappedSchemaEmitterClass2(metadataInfo, visibilityUsage, options, optionalDependencies) {
  return class extends OpenAPI31SchemaEmitter {
    constructor(emitter) {
      super(emitter, metadataInfo, visibilityUsage, options, optionalDependencies);
    }
  };
}
var createSchemaEmitter3_1 = ({ program, context, ...rest }) => {
  return createAssetEmitter(program, createWrappedSchemaEmitterClass2(rest.metadataInfo, rest.visibilityUsage, rest.options, rest.optionalDependencies), context);
};
var OpenAPI31SchemaEmitter = class extends OpenAPI3SchemaEmitterBase {
  #applySchemaExamples(program, type, target) {
    const examples = getExamples2(program, type);
    if (examples.length > 0) {
      target.set("examples", examples.map((example) => serializeValueAsJson4(program, example.value, type)));
    }
  }
  applyCustomConstraints(type, target, refSchema) {
    const applyConstraint = (fn, key) => {
      const value = fn(program, type);
      if (value !== void 0) {
        target[key] = value;
      }
    };
    const applyTypeConstraint = (fn, key) => {
      const constraintType = fn(this.emitter.getProgram(), type);
      if (constraintType) {
        const ref = this.emitter.emitTypeReference(constraintType);
        compilerAssert7(ref.kind === "code", "Unexpected non-code result from emit reference");
        target.set(key, ref.value);
      }
    };
    const program = this.emitter.getProgram();
    const minValueExclusive = getMinValueExclusive2(program, type);
    if (minValueExclusive !== void 0) {
      target.minimum = void 0;
      target.exclusiveMinimum = minValueExclusive;
    }
    const maxValueExclusive = getMaxValueExclusive2(program, type);
    if (maxValueExclusive !== void 0) {
      target.maximum = void 0;
      target.exclusiveMaximum = maxValueExclusive;
    }
    const jsonSchemaModule = this._jsonSchemaModule;
    if (jsonSchemaModule) {
      applyTypeConstraint(jsonSchemaModule.getContains, "contains");
      applyConstraint(jsonSchemaModule.getMinContains, "minContains");
      applyConstraint(jsonSchemaModule.getMaxContains, "maxContains");
      applyConstraint(jsonSchemaModule.getContentEncoding, "contentEncoding");
      applyConstraint(jsonSchemaModule.getContentMediaType, "contentMediaType");
      applyTypeConstraint(jsonSchemaModule.getContentSchema, "contentSchema");
      const prefixItems = jsonSchemaModule.getPrefixItems(program, type);
      if (prefixItems) {
        const prefixItemsSchema = new ArrayBuilder();
        for (const item of prefixItems.values) {
          prefixItemsSchema.push(this.emitter.emitTypeReference(item));
        }
        target.set("prefixItems", prefixItemsSchema);
      }
    }
    this.#applySchemaExamples(program, type, target);
  }
  applyEncoding(typespecType, target) {
    return applyEncoding3(this.emitter.getProgram(), typespecType, target, this._options);
  }
  applyModelIndexer(schema4, model) {
    const shouldSeal = this.shouldSealSchema(model);
    if (!shouldSeal && !model.indexer)
      return;
    const unevaluatedPropertiesSchema = shouldSeal ? { not: {} } : this.emitter.emitTypeReference(model.indexer.value);
    schema4.set("unevaluatedProperties", unevaluatedPropertiesSchema);
  }
  getRawBinarySchema() {
    return getRawBinarySchema2();
  }
  getSchemaForStdScalars(scalar) {
    if (scalar.name === "bytes") {
      const contentType = this.emitter.getContext().contentType;
      return { type: "string", contentMediaType: contentType, contentEncoding: "base64" };
    }
    return super.getSchemaForStdScalars(scalar);
  }
  enumSchema(en) {
    const program = this.emitter.getProgram();
    if (en.members.size === 0) {
      reportDiagnostic(program, { code: "empty-enum", target: en });
      return {};
    }
    const enumTypes = /* @__PURE__ */ new Set();
    const enumValues = /* @__PURE__ */ new Set();
    for (const member of en.members.values()) {
      enumTypes.add(typeof member.value === "number" ? "number" : "string");
      enumValues.add(member.value ?? member.name);
    }
    const enumTypesArray = [...enumTypes];
    const schema4 = {
      type: enumTypesArray.length === 1 ? enumTypesArray[0] : enumTypesArray,
      enum: [...enumValues]
    };
    return this.applyConstraints(en, schema4);
  }
  unionSchema(union) {
    const program = this.emitter.getProgram();
    const [discriminated] = getDiscriminatedUnion2(program, union);
    if (discriminated) {
      return this.discriminatedUnion(discriminated);
    }
    if (union.variants.size === 0) {
      reportDiagnostic(program, { code: "empty-union", target: union });
      return new ObjectBuilder({});
    }
    const variants = Array.from(union.variants.values());
    const literalVariantEnumByType = {};
    const ofType = getOneOf(program, union) ? "oneOf" : "anyOf";
    const schemaMembers = [];
    const isMultipart = this.getContentType().startsWith("multipart/");
    for (const variant of variants) {
      if (isMultipart && isBytesKeptRaw(program, variant.type)) {
        schemaMembers.push({ schema: this.getRawBinarySchema(), type: variant.type });
        continue;
      }
      if (isLiteralType(variant.type)) {
        if (!literalVariantEnumByType[variant.type.kind]) {
          const enumValue = [variant.type.value];
          literalVariantEnumByType[variant.type.kind] = enumValue;
          schemaMembers.push({
            schema: { type: literalType(variant.type), enum: enumValue },
            type: null
          });
        } else {
          literalVariantEnumByType[variant.type.kind].push(variant.type.value);
        }
      } else {
        const enumSchema = this.emitter.emitTypeReference(variant.type, {
          referenceContext: isMultipart ? { contentType: "application/json" } : {}
        });
        compilerAssert7(enumSchema.kind === "code", "Unexpected enum schema. Should be kind: code");
        schemaMembers.push({ schema: enumSchema.value, type: variant.type });
      }
    }
    const wrapWithObjectBuilder = (schemaMember, { mergeUnionWideConstraints }) => {
      const schema5 = schemaMember.schema;
      const type = schemaMember.type;
      const additionalProps = mergeUnionWideConstraints ? this.applyConstraints(union, {}) : {};
      if (Object.keys(additionalProps).length === 0) {
        return new ObjectBuilder(schema5);
      } else {
        if ((schema5 instanceof Placeholder || "$ref" in schema5) && !(type && shouldInline3(program, type))) {
          if (type && (type.kind === "Model" || type.kind === "Scalar")) {
            return new ObjectBuilder({
              type: "object",
              allOf: Builders.array([schema5]),
              ...additionalProps
            });
          } else {
            return new ObjectBuilder({ allOf: Builders.array([schema5]), ...additionalProps });
          }
        } else {
          const merged = new ObjectBuilder(schema5);
          for (const [key, value] of Object.entries(additionalProps)) {
            merged.set(key, value);
          }
          return merged;
        }
      }
    };
    if (schemaMembers.length === 0) {
      compilerAssert7(false, "Attempting to emit an empty union");
    }
    if (schemaMembers.length === 1) {
      return wrapWithObjectBuilder(schemaMembers[0], { mergeUnionWideConstraints: true });
    }
    const schema4 = {
      [ofType]: schemaMembers.map((m) => wrapWithObjectBuilder(m, { mergeUnionWideConstraints: false }))
    };
    return this.applyConstraints(union, schema4);
  }
  intrinsic(intrinsic, name) {
    switch (name) {
      case "unknown":
        return {};
      case "null":
        return { type: "null" };
    }
    reportDiagnostic(this.emitter.getProgram(), {
      code: "invalid-schema",
      format: { type: name },
      target: intrinsic
    });
    return {};
  }
  tupleLiteral(tuple) {
    return new ObjectBuilder({
      type: "array",
      prefixItems: this.emitter.emitTupleLiteralValues(tuple)
    });
  }
  tupleLiteralValues(tuple) {
    const values = new ArrayBuilder();
    for (const value of tuple.values.values()) {
      values.push(this.emitter.emitType(value));
    }
    return values;
  }
};

// src/typespec/core/packages/openapi3/dist/src/openapi-spec-mappings.js
function getOpenApiSpecProps(specVersion) {
  switch (specVersion) {
    case "3.0.0":
      return {
        applyEncoding: applyEncoding2,
        createRootDoc(program, serviceType, serviceVersion) {
          return createRoot(program, serviceType, specVersion, serviceVersion);
        },
        createSchemaEmitter: createSchemaEmitter3_0,
        getRawBinarySchema,
        isRawBinarySchema
      };
    case "3.1.0":
      return {
        applyEncoding: applyEncoding3,
        createRootDoc(program, serviceType, serviceVersion) {
          return createRoot(program, serviceType, specVersion, serviceVersion);
        },
        createSchemaEmitter: createSchemaEmitter3_1,
        getRawBinarySchema: getRawBinarySchema2,
        isRawBinarySchema: isRawBinarySchema2
      };
  }
}
function createRoot(program, serviceType, specVersion, serviceVersion) {
  const info = resolveInfo(program, serviceType);
  return {
    openapi: specVersion,
    info: {
      title: "(title)",
      ...info,
      version: serviceVersion ?? info?.version ?? "0.0.0"
    },
    externalDocs: getExternalDocs2(program, serviceType),
    tags: [],
    paths: {},
    security: void 0,
    components: {
      parameters: {},
      requestBodies: {},
      responses: {},
      schemas: {},
      examples: {},
      securitySchemes: {}
    }
  };
}

// src/typespec/core/packages/openapi3/dist/src/versioning-module.js
async function resolveVersioningModule() {
  try {
    return await import("@typespec/versioning");
  } catch {
    return void 0;
  }
}

// src/typespec/core/packages/openapi3/dist/src/visibility-usage.js
import { ignoreDiagnostics as ignoreDiagnostics3, navigateTypesInNamespace } from "@typespec/compiler";
import { TwoLevelMap } from "@typespec/compiler/utils";
import { Visibility as Visibility2, getHttpOperation, resolveRequestVisibility } from "@typespec/http";
function resolveVisibilityUsage(program, metadataInfo, root, omitUnreachableTypes) {
  const usages = /* @__PURE__ */ new Map();
  addUsagesInContainer(program, metadataInfo, root, usages);
  const reachableTypes = new Set(usages.keys());
  if (!omitUnreachableTypes) {
    const trackType = (type) => {
      if (!usages.has(type)) {
        navigateReferencedTypes(type, Visibility2.All, (type2, vis) => trackUsageExact(usages, type2, vis));
      }
    };
    navigateTypesInNamespace(root, {
      model: trackType,
      scalar: trackType,
      enum: trackType,
      union: trackType
    });
  }
  return {
    getUsage: (type) => {
      const used = usages.get(type);
      if (used === void 0) {
        return void 0;
      }
      return usages.get(type);
    },
    isUnreachable: (type) => {
      return !reachableTypes.has(type);
    }
  };
}
function addUsagesInContainer(program, metadataInfo, type, usages) {
  switch (type.kind) {
    case "Namespace":
      addUsagesInNamespace(program, metadataInfo, type, usages);
      break;
    case "Interface":
      addUsagesInInterface(program, metadataInfo, type, usages);
      break;
    case "Operation":
      addUsagesInOperation(program, metadataInfo, type, usages);
      break;
  }
}
function trackUsage(metadataInfo, usages, type, usage) {
  const effective = metadataInfo.getEffectivePayloadType(type, usage);
  trackUsageExact(usages, type, usage);
  if (effective !== type) {
    trackUsageExact(usages, effective, usage);
  }
}
function trackUsageExact(usages, type, usage) {
  const existingFlag = usages.get(type) ?? /* @__PURE__ */ new Set();
  existingFlag.add(usage);
  usages.set(type, existingFlag);
}
function addUsagesInNamespace(program, metadataInfo, namespace2, usages) {
  for (const subNamespace of namespace2.namespaces.values()) {
    addUsagesInNamespace(program, metadataInfo, subNamespace, usages);
  }
  for (const Interface of namespace2.interfaces.values()) {
    addUsagesInInterface(program, metadataInfo, Interface, usages);
  }
  for (const operation of namespace2.operations.values()) {
    addUsagesInOperation(program, metadataInfo, operation, usages);
  }
}
function addUsagesInInterface(program, metadataInfo, Interface, usages) {
  for (const operation of Interface.operations.values()) {
    addUsagesInOperation(program, metadataInfo, operation, usages);
  }
}
function addUsagesInOperation(program, metadataInfo, operation, usages) {
  const httpOperation = ignoreDiagnostics3(getHttpOperation(program, operation));
  const visibility = resolveRequestVisibility(program, operation, httpOperation.verb);
  if (httpOperation.parameters.body) {
    navigateReferencedTypes(httpOperation.parameters.body.type, visibility, (type, vis) => trackUsage(metadataInfo, usages, type, vis));
  }
  for (const param of httpOperation.parameters.parameters) {
    navigateReferencedTypes(param.param, visibility, (type, vis) => trackUsage(metadataInfo, usages, type, vis));
  }
  navigateReferencedTypes(operation.returnType, Visibility2.Read, (type, vis) => trackUsage(metadataInfo, usages, type, vis));
}
function navigateReferencedTypes(type, usage, callback, visited = new TwoLevelMap()) {
  if (visited.get(type)?.get(usage)) {
    return;
  }
  visited.getOrAdd(type, usage, () => true);
  switch (type.kind) {
    case "Model":
      callback(type, usage);
      navigateIterable(type.properties, usage, callback, visited);
      if (type.baseModel) {
        navigateReferencedTypes(type.baseModel, usage, callback, visited);
      }
      navigateIterable(type.derivedModels, usage, callback, visited);
      if (type.baseModel) {
        navigateReferencedTypes(type.baseModel, usage, callback, visited);
      }
      if (type.indexer) {
        if (type.indexer.key.name === "integer") {
          navigateReferencedTypes(type.indexer.value, usage | Visibility2.Item, callback, visited);
        } else {
          navigateReferencedTypes(type.indexer.value, usage, callback, visited);
        }
      }
      break;
    case "ModelProperty":
      navigateReferencedTypes(type.type, usage, callback, visited);
      break;
    case "Union":
      callback(type, usage);
      navigateIterable(type.variants, usage, callback, visited);
      break;
    case "UnionVariant":
      navigateReferencedTypes(type.type, usage, callback, visited);
      break;
    default:
      callback(type, usage);
      break;
  }
}
function navigateIterable(map2, usage, callback, visited) {
  for (const type of map2.values()) {
    navigateReferencedTypes(type, usage, callback, visited);
  }
}

// src/typespec/core/packages/openapi3/dist/src/xml-module.js
import { isArrayModelType as isArrayModelType2, resolveEncodedName as resolveEncodedName2 } from "@typespec/compiler";
import { shouldInline as shouldInline4 } from "@typespec/openapi";
async function resolveXmlModule() {
  const xml = await tryImportXml();
  if (xml === void 0)
    return void 0;
  return {
    attachXmlObjectForScalarOrModel: (program, type, emitObject) => {
      const isXmlModel = isXmlModelChecker(program, type, []);
      if (!isXmlModel) {
        return;
      }
      const xmlObject = {};
      const xmlName = resolveEncodedName2(program, type, "application/xml");
      if (xmlName !== type.name) {
        xmlObject.name = xmlName;
      }
      const currNs = xml.getNs(program, type);
      if (currNs) {
        xmlObject.prefix = currNs.prefix;
        xmlObject.namespace = currNs.namespace;
      }
      if (Object.keys(xmlObject).length !== 0) {
        emitObject.xml = xmlObject;
      }
    },
    attachXmlObjectForModelProperty: (program, options, prop, emitObject, refSchema) => {
      if (prop.model === void 0 || !isXmlModelChecker(program, prop.model, []))
        return;
      const xmlObject = {};
      const xmlName = resolveEncodedName2(program, prop, "application/xml");
      const jsonName = resolveEncodedName2(program, prop, "application/json");
      if (xmlName !== prop.name && xmlName !== jsonName) {
        xmlObject.name = xmlName;
      }
      const currNs = xml.getNs(program, prop);
      if (currNs) {
        xmlObject.prefix = currNs.prefix;
        xmlObject.namespace = currNs.namespace;
      }
      const isAttribute = xml.isAttribute(program, prop);
      if (isAttribute) {
        if (prop.type?.kind === "Model") {
          reportDiagnostic(program, {
            code: "xml-attribute-invalid-property-type",
            format: { name: prop.name },
            target: prop
          });
          emitObject.type = "string";
          delete refSchema.items;
        }
        xmlObject.attribute = true;
      }
      const hasUnwrappedDecorator = xml.isUnwrapped(program, prop);
      const isArrayProperty = prop.type?.kind === "Model" && isArrayModelType2(program, prop.type);
      if (!isArrayProperty && hasUnwrappedDecorator) {
        reportDiagnostic(program, {
          code: "xml-unwrapped-invalid-property-type",
          format: { name: prop.name },
          target: prop
        });
      }
      if (isArrayProperty && refSchema.items && !isAttribute) {
        const propValue = prop.type.indexer.value;
        const propXmlName = hasUnwrappedDecorator ? xmlName : resolveEncodedName2(program, propValue, "application/xml");
        if ((refSchema.items instanceof Placeholder || "$ref" in refSchema.items) && !(propValue && shouldInline4(program, propValue))) {
          const items = new ArrayBuilder();
          items.push(refSchema.items);
          refSchema.items = new ObjectBuilder({
            allOf: items,
            xml: { name: propXmlName }
          });
        } else {
          refSchema.items = new ObjectBuilder({
            ...refSchema.items,
            xml: { name: propXmlName }
          });
        }
        if (!hasUnwrappedDecorator) {
          xmlObject.wrapped = true;
        }
      }
      if (!isArrayProperty && !refSchema.type && !isAttribute) {
        xmlObject.name = xmlName;
        emitObject.allOf = new ArrayBuilder();
        emitObject.allOf.push(refSchema);
      }
      if (isAttribute && (refSchema instanceof Placeholder || "$ref" in refSchema) && !(prop.type && shouldInline4(program, prop.type)) && prop.type?.kind !== "Model") {
        emitObject.allOf = new ArrayBuilder();
        emitObject.allOf.push(refSchema);
      }
      if (isArrayProperty && hasUnwrappedDecorator) {
        delete xmlObject.name;
      }
      if (Object.keys(xmlObject).length !== 0) {
        emitObject.xml = xmlObject;
      }
    }
  };
}
function isXmlModelChecker(program, model, checked) {
  if (model.decorators && model.decorators.some((d) => d.definition?.namespace.name === "Xml")) {
    return true;
  }
  const xmlName = resolveEncodedName2(program, model, "application/xml");
  if (xmlName && xmlName !== model.name) {
    return true;
  }
  if (model.kind === "ModelProperty") {
    const isArrayProperty = model.type?.kind === "Model" && isArrayModelType2(program, model.type);
    if (isArrayProperty) {
      const propValue = model.type.indexer.value;
      if (propValue.kind === "Scalar") {
        if (isXmlModelChecker(program, propValue, checked)) {
          return true;
        }
      }
    } else {
      const propModel = model.type;
      if (propModel && !checked.includes(propModel.name)) {
        checked.push(propModel.name);
        if (isXmlModelChecker(program, propModel, checked)) {
          return true;
        }
      }
    }
  }
  if (model.kind === "Model") {
    for (const prop of model.properties.values()) {
      if (isXmlModelChecker(program, prop, checked)) {
        return true;
      }
      if (prop.type?.kind === "Model" && isArrayModelType2(program, prop.type)) {
        const propValue = prop.type.indexer.value;
        const propModel = propValue;
        if (propModel && !checked.includes(propModel.name)) {
          checked.push(propModel.name);
          if (isXmlModelChecker(program, propModel, checked)) {
            return true;
          }
        }
      }
    }
  }
  if (model.kind === "Scalar" && model.baseScalar) {
    if (isXmlModelChecker(program, model.baseScalar, checked)) {
      return true;
    }
  }
  return false;
}
async function tryImportXml() {
  try {
    const module = await import("./src-EKD2T6I7.js");
    return module;
  } catch {
    return void 0;
  }
}

// src/typespec/core/packages/openapi3/dist/src/openapi.js
var defaultFileType = "yaml";
var defaultOptions = {
  "new-line": "lf",
  "omit-unreachable-types": false,
  "include-x-typespec-name": "never",
  "safeint-strategy": "int64",
  "seal-object-schemas": false
};
async function $onEmit(context) {
  const options = resolveOptions(context);
  for (const specVersion of options.openapiVersions) {
    const emitter = createOAPIEmitter(context, options, specVersion);
    await emitter.emitOpenAPI();
  }
}
async function getOpenAPI3(program, options = {}) {
  const context = {
    program,
    // this value doesn't matter for getting the OpenAPI3 objects
    emitterOutputDir: "tsp-output",
    options
  };
  const resolvedOptions = resolveOptions(context);
  const serviceRecords = [];
  for (const specVersion of resolvedOptions.openapiVersions) {
    const emitter = createOAPIEmitter(context, resolvedOptions, specVersion);
    serviceRecords.push(...await emitter.getOpenAPI());
  }
  return serviceRecords;
}
function findFileTypeFromFilename(filename) {
  if (filename === void 0) {
    return defaultFileType;
  }
  switch (getAnyExtensionFromPath(filename)) {
    case ".yaml":
    case ".yml":
      return "yaml";
    case ".json":
      return "json";
    default:
      return defaultFileType;
  }
}
function resolveOptions(context) {
  const resolvedOptions = { ...defaultOptions, ...context.options };
  const fileType = resolvedOptions["file-type"] ?? findFileTypeFromFilename(resolvedOptions["output-file"]);
  const outputFile = resolvedOptions["output-file"] ?? `openapi.{service-name-if-multiple}.{version}.${fileType}`;
  const openapiVersions = resolvedOptions["openapi-versions"] ?? ["3.0.0"];
  const specDir = openapiVersions.length > 1 ? "{openapi-version}" : "";
  return {
    fileType,
    newLine: resolvedOptions["new-line"],
    omitUnreachableTypes: resolvedOptions["omit-unreachable-types"],
    includeXTypeSpecName: resolvedOptions["include-x-typespec-name"],
    safeintStrategy: resolvedOptions["safeint-strategy"],
    outputFile: resolvePath(context.emitterOutputDir, specDir, outputFile),
    openapiVersions,
    sealObjectSchemas: resolvedOptions["seal-object-schemas"],
    parameterExamplesStrategy: resolvedOptions["experimental-parameter-examples"]
  };
}
function createOAPIEmitter(context, options, specVersion = "3.0.0") {
  const { applyEncoding: applyEncoding4, createRootDoc, createSchemaEmitter, getRawBinarySchema: getRawBinarySchema3, isRawBinarySchema: isRawBinarySchema3 } = getOpenApiSpecProps(specVersion);
  const program = context.program;
  let schemaEmitter;
  let root;
  let diagnostics;
  let currentService;
  let serviceAuth;
  let serviceNamespaceName;
  let currentPath;
  let metadataInfo;
  let visibilityUsage;
  let params;
  let paramModels;
  let tags;
  const tagsMetadata = {};
  const typeNameOptions = {
    // shorten type names by removing TypeSpec and service namespace
    namespaceFilter(ns) {
      const name = getNamespaceFullName2(ns);
      return name !== serviceNamespaceName;
    }
  };
  return { emitOpenAPI, getOpenAPI };
  function isOperationDeprecated(httpOp) {
    if (isDeprecated(program, httpOp.operation)) {
      return true;
    }
    if (isDeprecated(program, httpOp.container)) {
      return true;
    }
    let current = httpOp.container.namespace;
    while (current && current.name !== "") {
      if (isDeprecated(program, current)) {
        return true;
      }
      current = current.namespace;
    }
    return false;
  }
  async function emitOpenAPI() {
    const services = await getOpenAPI();
    for (const serviceRecord of services) {
      if (serviceRecord.versioned) {
        for (const documentRecord of serviceRecord.versions) {
          program.reportDiagnostics(documentRecord.diagnostics);
        }
      } else {
        program.reportDiagnostics(serviceRecord.diagnostics);
      }
    }
    if (program.compilerOptions.dryRun || program.hasError()) {
      return;
    }
    const multipleService = services.length > 1;
    for (const serviceRecord of services) {
      if (serviceRecord.versioned) {
        for (const documentRecord of serviceRecord.versions) {
          await emitFile2(program, {
            path: resolveOutputFile(serviceRecord.service, multipleService, documentRecord.version),
            content: serializeDocument(documentRecord.document, options.fileType),
            newLine: options.newLine
          });
        }
      } else {
        await emitFile2(program, {
          path: resolveOutputFile(serviceRecord.service, multipleService),
          content: serializeDocument(serviceRecord.document, options.fileType),
          newLine: options.newLine
        });
      }
    }
  }
  function initializeEmitter(service, allHttpAuthentications, defaultAuth, optionalDependencies, version3) {
    diagnostics = createDiagnosticCollector();
    currentService = service;
    metadataInfo = createMetadataInfo(program, {
      canonicalVisibility: Visibility3.Read,
      canShareProperty: (p) => isReadonlyProperty2(program, p)
    });
    visibilityUsage = resolveVisibilityUsage(program, metadataInfo, service.type, options.omitUnreachableTypes);
    schemaEmitter = createSchemaEmitter({
      program,
      context,
      metadataInfo,
      visibilityUsage,
      options,
      optionalDependencies
    });
    const securitySchemes = getOpenAPISecuritySchemes(allHttpAuthentications);
    const security = getOpenAPISecurity(defaultAuth);
    root = createRootDoc(program, service.type, version3);
    if (security.length > 0) {
      root.security = security;
    }
    root.components.securitySchemes = securitySchemes;
    const servers = getServers(program, service.type);
    if (servers) {
      root.servers = resolveServers(servers);
    }
    attachExtensions2(program, service.type, root);
    serviceNamespaceName = getNamespaceFullName2(service.type);
    currentPath = root.paths;
    params = /* @__PURE__ */ new Map();
    paramModels = /* @__PURE__ */ new Set();
    tags = /* @__PURE__ */ new Set();
    const metadata = getTagsMetadata(program, service.type);
    if (metadata) {
      for (const [name, tag] of Object.entries(metadata)) {
        const tagData = { name, ...tag };
        tagsMetadata[name] = tagData;
      }
    }
  }
  function isValidServerVariableType(program2, type) {
    const tk = $5(program2);
    switch (type.kind) {
      case "String":
      case "Union":
      case "Scalar":
        return tk.type.isAssignableTo(type, tk.builtin.string, type);
      case "Enum":
        for (const member of type.members.values()) {
          if (member.value && typeof member.value !== "string") {
            return false;
          }
        }
        return true;
      default:
        return false;
    }
  }
  function validateValidServerVariable(program2, prop) {
    const isValid = isValidServerVariableType(program2, prop.type);
    if (!isValid) {
      diagnostics.add(createDiagnostic({
        code: "invalid-server-variable",
        format: { propName: prop.name },
        target: prop
      }));
    }
    return isValid;
  }
  function resolveServers(servers) {
    return servers.map((server) => {
      const variables = {};
      for (const [name, prop] of server.parameters) {
        if (!validateValidServerVariable(program, prop)) {
          continue;
        }
        const variable = {
          default: prop.defaultValue ? getDefaultValue(program, prop.defaultValue, prop) : "",
          description: getDoc2(program, prop)
        };
        if (prop.type.kind === "Enum") {
          variable.enum = getSchemaValue(prop.type, Visibility3.Read, "application/json").enum;
        } else if (prop.type.kind === "Union") {
          variable.enum = getSchemaValue(prop.type, Visibility3.Read, "application/json").enum;
        } else if (prop.type.kind === "String") {
          variable.enum = [prop.type.value];
        }
        attachExtensions2(program, prop, variable);
        variables[name] = variable;
      }
      return {
        url: server.url,
        description: server.description,
        variables
      };
    });
  }
  async function getOpenAPI() {
    const versioningModule = await resolveVersioningModule();
    const serviceRecords = [];
    const services = listServices(program);
    if (services.length === 0) {
      services.push({ type: program.getGlobalNamespaceType() });
    }
    for (const service of services) {
      const versions3 = versioningModule?.getVersioningMutators(program, service.type);
      if (versions3 === void 0) {
        const document2 = await getOpenApiFromVersion(service);
        if (document2 === void 0) {
          return serviceRecords;
        }
        serviceRecords.push({
          service,
          versioned: false,
          document: document2[0],
          diagnostics: document2[1]
        });
      } else if (versions3.kind === "transient") {
        const document2 = await getVersionSnapshotDocument(service, versions3.mutator);
        if (document2 === void 0) {
          return serviceRecords;
        }
        serviceRecords.push({
          service,
          versioned: false,
          document: document2[0],
          diagnostics: document2[1]
        });
      } else {
        const serviceRecord = {
          service,
          versioned: true,
          versions: []
        };
        serviceRecords.push(serviceRecord);
        for (const snapshot of versions3.snapshots) {
          const document2 = await getVersionSnapshotDocument(service, snapshot.mutator, snapshot.version?.value);
          if (document2 === void 0) {
            continue;
          }
          serviceRecord.versions.push({
            service,
            version: snapshot.version.value,
            document: document2[0],
            diagnostics: document2[1]
          });
        }
      }
    }
    return serviceRecords;
  }
  async function getVersionSnapshotDocument(service, mutator, version3) {
    const subgraph = unsafe_mutateSubgraphWithNamespace(program, [mutator], service.type);
    compilerAssert8(subgraph.type.kind === "Namespace", "Should not have mutated to another type");
    const document2 = await getOpenApiFromVersion(getService(program, subgraph.type), version3);
    return document2;
  }
  function resolveOutputFile(service, multipleService, version3) {
    return interpolatePath(options.outputFile, {
      "openapi-version": specVersion,
      "service-name-if-multiple": multipleService ? getNamespaceFullName2(service.type) : void 0,
      "service-name": getNamespaceFullName2(service.type),
      version: version3
    });
  }
  function deduplicateCommonResponses(statusCodeResponses) {
    const ref = statusCodeResponses[0];
    const sameTypeKind = statusCodeResponses.every((r) => r.type.kind === ref.type.kind);
    const sameTypeValue = statusCodeResponses.every((r) => r.type === ref.type);
    if (sameTypeKind && sameTypeValue) {
      return [ref];
    } else {
      return statusCodeResponses;
    }
  }
  function resolveSharedRouteParameters(ops) {
    const finalProps = [];
    const properties = /* @__PURE__ */ new Map();
    for (const op of ops) {
      for (const property of op.parameters.properties) {
        if (!isHttpParameterProperty2(property)) {
          continue;
        }
        const existing = properties.get(property.options.name);
        if (existing) {
          existing.push(property);
        } else {
          properties.set(property.options.name, [property]);
        }
      }
    }
    if (properties.size === 0) {
      return [];
    }
    for (const sharedParams of properties.values()) {
      const reference = sharedParams[0];
      const inAllOps = ops.length === sharedParams.length;
      const sameLocations = sharedParams.every((p) => p.kind === reference.kind);
      const sameOptionality = sharedParams.every((p) => p.property.optional === reference.property.optional);
      const sameTypeKind = sharedParams.every((p) => p.property.type.kind === reference.property.type.kind);
      const sameTypeValue = sharedParams.every((p) => p.property.type === reference.property.type);
      if (inAllOps && sameLocations && sameOptionality && sameTypeKind && sameTypeValue) {
        finalProps.push(reference);
      } else if (!inAllOps && sameLocations && sameOptionality && sameTypeKind && sameTypeValue) {
        reference.property.optional = true;
        finalProps.push(reference);
      } else if (inAllOps && !(sameLocations && sameOptionality && sameTypeKind)) {
        sharedParams.forEach((p) => {
          p.property.optional = true;
        });
        finalProps.push(...sharedParams);
      } else {
        finalProps.push(...sharedParams);
      }
    }
    return finalProps;
  }
  function buildSharedOperation(operations) {
    return {
      kind: "shared",
      operations
    };
  }
  function resolveOperations(operations) {
    const result = [];
    const pathMap = /* @__PURE__ */ new Map();
    operations.forEach((op) => {
      if (op.overloading !== void 0 && isOverloadSameEndpoint(op)) {
        return;
      }
      const opKey = `${op.verb}|${op.path}`;
      pathMap.has(opKey) ? pathMap.get(opKey).push(op) : pathMap.set(opKey, [op]);
    });
    for (const [_, ops] of pathMap) {
      if (ops.length === 1) {
        result.push(ops[0]);
      } else {
        result.push(buildSharedOperation(ops));
      }
    }
    return result;
  }
  async function getOpenApiFromVersion(service, version3) {
    try {
      const httpService = ignoreDiagnostics4(getHttpService(program, service.type));
      const auth = serviceAuth = resolveAuthentication(httpService);
      const xmlModule = await resolveXmlModule();
      const jsonSchemaModule = await resolveJsonSchemaModule();
      initializeEmitter(service, auth.schemes, auth.defaultAuth, { xmlModule, jsonSchemaModule }, version3);
      reportIfNoRoutes(program, httpService.operations);
      for (const op of resolveOperations(httpService.operations)) {
        const result = getOperationOrSharedOperation(op);
        if (result) {
          const { operation, path, verb } = result;
          currentPath[path] ??= {};
          currentPath[path][verb] = operation;
        }
      }
      emitParameters();
      emitSchemas(service.type);
      emitTags();
      if (root.components) {
        for (const elem of Object.keys(root.components)) {
          if (Object.keys(root.components[elem]).length === 0) {
            delete root.components[elem];
          }
        }
      }
      return [root, diagnostics.diagnostics];
    } catch (err) {
      if (err instanceof ErrorTypeFoundError) {
        return;
      } else {
        throw err;
      }
    }
  }
  function joinOps(operations, func, joinChar) {
    const values = operations.map((op) => func(program, op.operation)).filter((op) => op !== void 0);
    if (values.length) {
      return values.join(joinChar);
    } else {
      return void 0;
    }
  }
  function computeSharedOperationId(shared) {
    const operationIds = shared.operations.map((op) => resolveOperationId(program, op.operation));
    const uniqueOpIds = new Set(operationIds);
    if (uniqueOpIds.size === 1)
      return uniqueOpIds.values().next().value;
    return operationIds.join("_");
  }
  function getOperationOrSharedOperation(operation) {
    if (isSharedHttpOperation(operation)) {
      return getSharedOperation(operation);
    } else {
      return getOperation(operation);
    }
  }
  function getSharedOperation(shared) {
    const operations = shared.operations;
    const verb = operations[0].verb;
    const path = operations[0].path;
    const examples = resolveOperationExamples(program, shared, {
      parameterExamplesStrategy: options.parameterExamplesStrategy
    });
    const oai3Operation = {
      operationId: computeSharedOperationId(shared),
      parameters: [],
      description: joinOps(operations, getDoc2, " "),
      summary: joinOps(operations, getSummary2, " "),
      responses: getSharedResponses(shared, examples)
    };
    for (const op of operations) {
      applyExternalDocs(op.operation, oai3Operation);
      attachExtensions2(program, op.operation, oai3Operation);
      if (isOperationDeprecated(op)) {
        oai3Operation.deprecated = true;
      }
    }
    for (const op of operations) {
      const opTags = getAllTags(program, op.operation);
      if (opTags) {
        const currentTags = oai3Operation.tags;
        if (currentTags) {
          oai3Operation.tags = [.../* @__PURE__ */ new Set([...currentTags, ...opTags])];
        } else {
          oai3Operation.tags = opTags;
        }
        for (const tag of opTags) {
          tags.add(tag);
        }
      }
    }
    const visibilities = operations.map((op) => resolveRequestVisibility2(program, op.operation, verb));
    if (visibilities.some((v) => v !== visibilities[0])) {
      diagnostics.add(createDiagnostic({
        code: "inconsistent-shared-route-request-visibility",
        target: operations[0].operation
      }));
    }
    const visibility = visibilities[0];
    oai3Operation.parameters = getEndpointParameters(resolveSharedRouteParameters(operations), visibility, examples);
    const bodies = [
      ...new Set(operations.map((op) => op.parameters.body).filter((x) => x !== void 0))
    ];
    if (bodies) {
      oai3Operation.requestBody = getRequestBody(bodies, visibility, examples);
    }
    const authReference = serviceAuth.operationsAuth.get(shared.operations[0].operation);
    if (authReference) {
      oai3Operation.security = getEndpointSecurity(authReference);
    }
    return { operation: oai3Operation, verb, path };
  }
  function getOperation(operation) {
    const { path: fullPath, operation: op, verb, parameters } = operation;
    if (fullPath.indexOf("?") > 0) {
      diagnostics.add(createDiagnostic({ code: "path-query", target: op }));
      return void 0;
    }
    const visibility = resolveRequestVisibility2(program, operation.operation, verb);
    const examples = resolveOperationExamples(program, operation, {
      parameterExamplesStrategy: options.parameterExamplesStrategy
    });
    const oai3Operation = {
      operationId: resolveOperationId(program, operation.operation),
      summary: getSummary2(program, operation.operation),
      description: getDoc2(program, operation.operation),
      parameters: getEndpointParameters(parameters.properties, visibility, examples),
      responses: getResponses(operation, operation.responses, examples)
    };
    const currentTags = getAllTags(program, op);
    if (currentTags) {
      oai3Operation.tags = currentTags;
      for (const tag of currentTags) {
        tags.add(tag);
      }
    }
    applyExternalDocs(op, oai3Operation);
    if (parameters.body) {
      oai3Operation.requestBody = getRequestBody(parameters.body && [parameters.body], visibility, examples);
    }
    const authReference = serviceAuth.operationsAuth.get(operation.operation);
    if (authReference) {
      oai3Operation.security = getEndpointSecurity(authReference);
    }
    if (isOperationDeprecated(operation)) {
      oai3Operation.deprecated = true;
    }
    attachExtensions2(program, op, oai3Operation);
    return { operation: oai3Operation, path: fullPath, verb };
  }
  function getSharedResponses(operation, examples) {
    const responseMap = /* @__PURE__ */ new Map();
    for (const op of operation.operations) {
      for (const response of op.responses) {
        const statusCodes = diagnostics.pipe(getOpenAPI3StatusCodes(program, response.statusCodes, op.operation));
        for (const statusCode of statusCodes) {
          if (responseMap.has(statusCode)) {
            responseMap.get(statusCode).push(response);
          } else {
            responseMap.set(statusCode, [response]);
          }
        }
      }
    }
    const result = {};
    for (const [statusCode, statusCodeResponses] of responseMap) {
      const dedupeResponses = deduplicateCommonResponses(statusCodeResponses);
      result[statusCode] = getResponseForStatusCode(operation, statusCode, dedupeResponses, examples);
    }
    return result;
  }
  function getResponses(operation, responses, examples) {
    const result = {};
    for (const response of responses) {
      for (const statusCode of diagnostics.pipe(getOpenAPI3StatusCodes(program, response.statusCodes, response.type))) {
        result[statusCode] = getResponseForStatusCode(operation, statusCode, [response], examples);
      }
    }
    return result;
  }
  function isBinaryPayload(body, contentType) {
    return body.kind === "Scalar" && body.name === "bytes" && contentType !== "application/json" && contentType !== "text/plain";
  }
  function getResponseForStatusCode(operation, statusCode, responses, examples) {
    const openApiResponse = {
      description: ""
    };
    const schemaMap = /* @__PURE__ */ new Map();
    for (const response of responses) {
      const refUrl = getRef(program, response.type);
      if (refUrl) {
        return { $ref: refUrl };
      }
      if (response.description && response.description !== openApiResponse.description) {
        openApiResponse.description = openApiResponse.description ? `${openApiResponse.description} ${response.description}` : response.description;
      }
      emitResponseHeaders(openApiResponse, response.responses, response.type);
      emitResponseContent(operation, openApiResponse, response.responses, statusCode, examples, schemaMap);
      if (!openApiResponse.description) {
        openApiResponse.description = getResponseDescriptionForStatusCode(statusCode);
      }
    }
    return openApiResponse;
  }
  function emitResponseHeaders(obj, responses, target) {
    for (const data of responses) {
      if (data.headers && Object.keys(data.headers).length > 0) {
        obj.headers ??= {};
        for (const [key, value] of Object.entries(data.headers)) {
          const headerVal = getResponseHeader(value);
          const existing = obj.headers[key];
          if (existing) {
            if (!deepEquals(existing, headerVal)) {
              diagnostics.add(createDiagnostic({
                code: "duplicate-header",
                format: { header: key },
                target
              }));
            }
            continue;
          }
          obj.headers[key] = headerVal;
        }
      }
    }
  }
  function emitResponseContent(operation, obj, responses, statusCode, examples, schemaMap = void 0) {
    schemaMap ??= /* @__PURE__ */ new Map();
    for (const data of responses) {
      if (data.body === void 0 || isVoidType(data.body.type)) {
        continue;
      }
      obj.content ??= {};
      for (const contentType of data.body.contentTypes) {
        const contents = getBodyContentEntry(data.body, Visibility3.Read, contentType, examples.responses[statusCode]?.[contentType]);
        if (schemaMap.has(contentType)) {
          schemaMap.get(contentType).push(contents);
        } else {
          schemaMap.set(contentType, [contents]);
        }
      }
      for (const [contentType, contents] of schemaMap) {
        if (contents.length === 1) {
          obj.content[contentType] = contents[0];
        } else {
          obj.content[contentType] = {
            schema: { anyOf: contents.map((x) => x.schema) }
          };
        }
      }
    }
  }
  function getResponseDescriptionForStatusCode(statusCode) {
    if (statusCode === "default") {
      return "An unexpected error response.";
    }
    return getStatusCodeDescription(statusCode) ?? "unknown";
  }
  function getResponseHeader(prop) {
    return getOpenAPIParameterBase(prop, Visibility3.Read);
  }
  function callSchemaEmitter(type, visibility, ignoreMetadataAnnotations, contentType) {
    const result = emitTypeWithSchemaEmitter(type, visibility, ignoreMetadataAnnotations, contentType);
    switch (result.kind) {
      case "code":
        return result.value;
      case "declaration":
        return { $ref: `#/components/schemas/${result.name}` };
      case "circular":
        diagnostics.add(createDiagnostic({
          code: "inline-cycle",
          format: { type: getOpenAPITypeName2(program, type, typeNameOptions) },
          target: type
        }));
        return {};
      case "none":
        return {};
    }
  }
  function getSchemaValue(type, visibility, contentType) {
    const result = emitTypeWithSchemaEmitter(type, visibility, false, contentType);
    switch (result.kind) {
      case "code":
      case "declaration":
        return result.value;
      case "circular":
        diagnostics.add(createDiagnostic({
          code: "inline-cycle",
          format: { type: getOpenAPITypeName2(program, type, typeNameOptions) },
          target: type
        }));
        return {};
      case "none":
        return {};
    }
  }
  function emitTypeWithSchemaEmitter(type, visibility, ignoreMetadataAnnotations, contentType) {
    if (!metadataInfo.isTransformed(type, visibility)) {
      visibility = Visibility3.Read;
    }
    contentType = contentType === "application/json" ? void 0 : contentType;
    return schemaEmitter.emitType(type, {
      referenceContext: {
        visibility,
        serviceNamespaceName,
        ignoreMetadataAnnotations: ignoreMetadataAnnotations ?? false,
        contentType
      }
    });
  }
  function getBodyContentEntry(body, visibility, contentType, examples) {
    const isBinary = isBinaryPayload(body.type, contentType);
    if (isBinary) {
      return { schema: getRawBinarySchema3(contentType) };
    }
    const oai3Examples = examples && getExampleOrExamples(program, examples);
    switch (body.bodyKind) {
      case "single":
        return {
          schema: getSchemaForSingleBody(body.type, visibility, body.isExplicit && body.containsMetadataAnnotations, void 0),
          ...oai3Examples
        };
      case "multipart":
        return {
          ...getBodyContentForMultipartBody(body, visibility, contentType),
          ...oai3Examples
        };
      case "file":
        return {
          schema: getRawBinarySchema3(contentType)
        };
    }
  }
  function getSchemaForSingleBody(type, visibility, ignoreMetadataAnnotations, multipart) {
    const effectiveType = metadataInfo.getEffectivePayloadType(type, visibility);
    return callSchemaEmitter(effectiveType, visibility, ignoreMetadataAnnotations, multipart ?? "application/json");
  }
  function getBodyContentForMultipartBody(body, visibility, contentType) {
    const properties = {};
    const requiredProperties = [];
    const encodings = {};
    for (const [partIndex, part] of body.parts.entries()) {
      const partName = part.name ?? `part${partIndex}`;
      let schema5 = part.body.bodyKind === "file" ? getRawBinarySchema3() : isBytesKeptRaw(program, part.body.type) ? getRawBinarySchema3() : getSchemaForSingleBody(part.body.type, visibility, part.body.isExplicit && part.body.containsMetadataAnnotations, part.body.type.kind === "Union" && [...part.body.type.variants.values()].some((x) => isBinaryPayload(x.type, contentType)) ? contentType : void 0);
      if (part.multi) {
        schema5 = {
          type: "array",
          items: schema5
        };
      }
      if (part.property) {
        const doc = getDoc2(program, part.property);
        if (doc) {
          if (schema5.$ref) {
            schema5 = { allOf: [{ $ref: schema5.$ref }], description: doc };
          } else {
            schema5 = { ...schema5, description: doc };
          }
        }
        attachExtensions2(program, part.property, schema5);
      }
      properties[partName] = schema5;
      const encoding = resolveEncodingForMultipartPart(part, visibility, schema5);
      if (encoding) {
        encodings[partName] = encoding;
      }
      if (!part.optional) {
        requiredProperties.push(partName);
      }
    }
    const schema4 = {
      type: "object",
      properties,
      required: requiredProperties
    };
    const name = "name" in body.type && body.type.name !== "" ? getOpenAPITypeName2(program, body.type, typeNameOptions) : void 0;
    if (name) {
      root.components.schemas[name] = schema4;
    }
    const result = {
      schema: name ? { $ref: "#/components/schemas/" + name } : schema4
    };
    if (Object.keys(encodings).length > 0) {
      result.encoding = encodings;
    }
    return result;
  }
  function resolveEncodingForMultipartPart(part, visibility, schema4) {
    const encoding = {};
    if (!isDefaultContentTypeForOpenAPI3(part.body.contentTypes, schema4)) {
      encoding.contentType = part.body.contentTypes.join(", ");
    }
    const headers = part.headers;
    if (headers.length > 0) {
      encoding.headers = {};
      for (const header of headers) {
        const schema5 = getOpenAPIParameterBase(header.property, visibility);
        if (schema5 !== void 0) {
          encoding.headers[header.options.name] = schema5;
        }
      }
    }
    if (Object.keys(encoding).length === 0) {
      return void 0;
    }
    return encoding;
  }
  function isDefaultContentTypeForOpenAPI3(contentTypes, schema4) {
    if (contentTypes.length === 0) {
      return false;
    }
    if (contentTypes.length > 1) {
      return false;
    }
    const contentType = contentTypes[0];
    switch (contentType) {
      case "text/plain":
        return schema4.type === "string" || schema4.type === "number";
      case "application/octet-stream":
        return isRawBinarySchema3(schema4) || schema4.type === "array" && !!schema4.items && isRawBinarySchema3(schema4.items);
      case "application/json":
        return schema4.type === "object";
    }
    return false;
  }
  function getParameter(httpProperty, visibility, examples) {
    const param = {
      name: httpProperty.options.name,
      in: httpProperty.kind,
      ...getOpenAPIParameterBase(httpProperty.property, visibility)
    };
    const attributes = getParameterAttributes(httpProperty);
    if (attributes === void 0) {
      param.schema = {
        type: "string"
      };
    } else {
      Object.assign(param, attributes);
    }
    if (isDeprecated(program, httpProperty.property)) {
      param.deprecated = true;
    }
    const paramExamples = getExampleOrExamples(program, examples);
    Object.assign(param, paramExamples);
    return param;
  }
  function getEndpointParameters(properties, visibility, examples) {
    const result = [];
    for (const httpProp of properties) {
      if (params.has(httpProp.property)) {
        result.push(params.get(httpProp.property));
        continue;
      }
      if (!isHttpParameterProperty2(httpProp)) {
        continue;
      }
      const param = getParameterOrRef(httpProp, visibility, examples.parameters[httpProp.options.name] ?? []);
      if (param) {
        const existing = result.find((x) => !("$ref" in param) && !("$ref" in x) && x.name === param.name && x.in === param.in);
        if (existing && !("$ref" in param) && !("$ref" in existing)) {
          mergeOpenApiParameters(existing, param);
        } else {
          result.push(param);
        }
      }
    }
    return result;
  }
  function getRequestBody(bodies, visibility, examples) {
    if (bodies === void 0 || bodies.every((x) => isVoidType(x.type))) {
      return void 0;
    }
    const requestBody = {
      required: bodies.every((body) => body.property ? !body.property.optional : true),
      content: {}
    };
    const schemaMap = /* @__PURE__ */ new Map();
    for (const body of bodies.filter((x) => !isVoidType(x.type))) {
      const desc = body.property ? getDoc2(program, body.property) : void 0;
      if (desc) {
        requestBody.description = requestBody.description ? `${requestBody.description} ${desc}` : desc;
      }
      const contentTypes = body.contentTypes.length > 0 ? body.contentTypes : ["application/json"];
      for (const contentType of contentTypes) {
        const existing = schemaMap.get(contentType);
        const entry = getBodyContentEntry(body, visibility, contentType, examples.requestBody[contentType]);
        if (existing) {
          existing.push(entry);
        } else {
          schemaMap.set(contentType, [entry]);
        }
      }
    }
    for (const [contentType, schemaArray] of schemaMap) {
      if (schemaArray.length === 1) {
        requestBody.content[contentType] = schemaArray[0];
      } else {
        requestBody.content[contentType] = {
          schema: { anyOf: schemaArray.map((x) => x.schema).filter((x) => x !== void 0) },
          encoding: schemaArray.find((x) => x.encoding)?.encoding
        };
      }
    }
    return requestBody;
  }
  function getParameterOrRef(httpProperty, visibility, examples) {
    if (isNeverType2(httpProperty.property.type)) {
      return void 0;
    }
    let spreadParam = false;
    let property = httpProperty.property;
    if (property.sourceProperty) {
      spreadParam = true;
      property = property.sourceProperty;
      while (property.sourceProperty) {
        property = property.sourceProperty;
      }
    }
    const refUrl = getRef(program, property);
    if (refUrl) {
      return {
        $ref: refUrl
      };
    }
    if (params.has(property)) {
      return params.get(property);
    }
    const param = getParameter(httpProperty, visibility, examples);
    if (spreadParam && property.model && !shouldInline5(program, property.model)) {
      params.set(property, param);
      paramModels.add(property.model);
    }
    return param;
  }
  function getOpenAPIParameterBase(param, visibility) {
    const typeSchema = getSchemaForType(param.type, visibility);
    if (!typeSchema) {
      return void 0;
    }
    const schema4 = applyEncoding4(program, param, applyIntrinsicDecorators(param, typeSchema), options);
    if (param.defaultValue) {
      schema4.default = getDefaultValue(program, param.defaultValue, param);
    }
    delete schema4.description;
    const oaiParam = {
      required: !param.optional,
      description: getDoc2(program, param),
      schema: schema4
    };
    attachExtensions2(program, param, oaiParam);
    return oaiParam;
  }
  function mergeOpenApiParameters(target, apply) {
    if (target.schema) {
      const schema4 = target.schema;
      if (schema4.enum && apply.schema.enum) {
        schema4.enum = [.../* @__PURE__ */ new Set([...schema4.enum, ...apply.schema.enum])];
      }
      target.schema = schema4;
    } else {
      Object.assign(target, apply);
    }
    return target;
  }
  function getParameterAttributes(httpProperty) {
    switch (httpProperty.kind) {
      case "header":
        return getHeaderParameterAttributes(httpProperty);
      case "cookie":
        return { explode: false };
      case "query":
        return getQueryParameterAttributes(httpProperty);
      case "path":
        return getPathParameterAttributes(httpProperty);
    }
  }
  function getPathParameterAttributes(httpProperty) {
    if (httpProperty.options.allowReserved) {
      diagnostics.add(createDiagnostic({
        code: "path-reserved-expansion",
        target: httpProperty.property
      }));
    }
    const attributes = {};
    if (httpProperty.options.explode) {
      attributes.explode = true;
    }
    switch (httpProperty.options.style) {
      case "label":
        attributes.style = "label";
        break;
      case "matrix":
        attributes.style = "matrix";
        break;
      case "simple":
        break;
      case "path":
        diagnostics.add(createDiagnostic({
          code: "invalid-style",
          messageId: httpProperty.property.optional ? "optionalPath" : "default",
          format: { style: httpProperty.options.style, paramType: "path" },
          target: httpProperty.property
        }));
        break;
      default:
        diagnostics.add(createDiagnostic({
          code: "invalid-style",
          format: { style: httpProperty.options.style, paramType: "path" },
          target: httpProperty.property
        }));
    }
    return attributes;
  }
  function getQueryParameterAttributes(httpProperty) {
    const attributes = {};
    if (httpProperty.options.explode !== true) {
      attributes.explode = false;
    }
    const style = getParameterStyle(program, httpProperty.property);
    if (style) {
      attributes.style = style;
    }
    return attributes;
  }
  function getHeaderParameterAttributes(httpProperty) {
    const attributes = {};
    if (httpProperty.options.explode) {
      attributes.explode = true;
    }
    return attributes;
  }
  function emitParameters() {
    for (const [property, param] of params) {
      const key = getParameterKey(program, property, param, root.components.parameters, typeNameOptions);
      const validKey = ensureValidComponentFixedFieldKey(program, property, key);
      root.components.parameters[validKey] = { ...param };
      for (const key2 of Object.keys(param)) {
        delete param[key2];
      }
      param.$ref = "#/components/parameters/" + encodeURIComponent(validKey);
    }
  }
  function emitSchemas(serviceNamespace) {
    if (!options.omitUnreachableTypes) {
      processUnreferencedSchemas();
    }
    const files = schemaEmitter.getSourceFiles();
    if (files.length > 0) {
      compilerAssert8(files.length === 1, `Should only have a single file for now but got ${files.length}`);
      const schemas2 = root.components.schemas;
      const declarations = files[0].globalScope.declarations;
      for (const declaration of declarations) {
        schemas2[declaration.name] = declaration.value;
      }
    }
    function processUnreferencedSchemas() {
      const addSchema = (type) => {
        if (isOrExtendsHttpFile(program, type)) {
          return;
        }
        if (visibilityUsage.isUnreachable(type) && !paramModels.has(type) && !shouldInline5(program, type)) {
          callSchemaEmitter(type, Visibility3.All);
        }
      };
      const skipSubNamespaces = isGlobalNamespace(program, serviceNamespace);
      navigateTypesInNamespace2(serviceNamespace, {
        model: addSchema,
        scalar: addSchema,
        enum: addSchema,
        union: addSchema
      }, { skipSubNamespaces });
    }
  }
  function emitTags() {
    for (const tag of tags) {
      if (!tagsMetadata[tag]) {
        root.tags.push({ name: tag });
      }
    }
    for (const key in tagsMetadata) {
      root.tags.push(tagsMetadata[key]);
    }
  }
  function getSchemaForType(type, visibility) {
    return callSchemaEmitter(type, visibility);
  }
  function attachExtensions2(program2, type, emitObject) {
    const extensions = getExtensions4(program2, type);
    if (extensions) {
      for (const key of extensions.keys()) {
        emitObject[key] = extensions.get(key);
      }
    }
  }
  function applyIntrinsicDecorators(typespecType, target) {
    const newTarget = { ...target };
    const docStr = getDoc2(program, typespecType);
    if (docStr) {
      newTarget.description = docStr;
    }
    const formatStr = getFormat2(program, typespecType);
    if (formatStr) {
      newTarget.format = formatStr;
    }
    const pattern = getPattern2(program, typespecType);
    if (pattern) {
      newTarget.pattern = pattern;
    }
    const minLength = getMinLength2(program, typespecType);
    if (minLength !== void 0) {
      newTarget.minLength = minLength;
    }
    const maxLength = getMaxLength2(program, typespecType);
    if (maxLength !== void 0) {
      newTarget.maxLength = maxLength;
    }
    const minValue = getMinValue2(program, typespecType);
    if (minValue !== void 0) {
      newTarget.minimum = minValue;
    }
    const minValueExclusive = getMinValueExclusive3(program, typespecType);
    if (minValueExclusive !== void 0) {
      newTarget.minimum = minValueExclusive;
      newTarget.exclusiveMinimum = true;
    }
    const maxValue = getMaxValue2(program, typespecType);
    if (maxValue !== void 0) {
      newTarget.maximum = maxValue;
    }
    const maxValueExclusive = getMaxValueExclusive3(program, typespecType);
    if (maxValueExclusive !== void 0) {
      newTarget.maximum = maxValueExclusive;
      newTarget.exclusiveMaximum = true;
    }
    const minItems = getMinItems2(program, typespecType);
    if (!target.minItems && minItems !== void 0) {
      newTarget.minItems = minItems;
    }
    const maxItems = getMaxItems2(program, typespecType);
    if (!target.maxItems && maxItems !== void 0) {
      newTarget.maxItems = maxItems;
    }
    if (isSecret2(program, typespecType)) {
      newTarget.format = "password";
    }
    const title3 = getSummary2(program, typespecType);
    if (title3) {
      newTarget.title = title3;
    }
    attachExtensions2(program, typespecType, newTarget);
    return newTarget;
  }
  function applyExternalDocs(typespecType, target) {
    const externalDocs = getExternalDocs3(program, typespecType);
    if (externalDocs) {
      target.externalDocs = externalDocs;
    }
  }
  function getOpenAPISecuritySchemes(httpAuthentications) {
    const schemes = {};
    for (const httpAuth of httpAuthentications) {
      const scheme = getOpenAPI3Scheme(httpAuth);
      if (scheme) {
        schemes[httpAuth.id] = scheme;
      }
    }
    return schemes;
  }
  function getOpenAPISecurity(authReference) {
    const security = authReference.options.map((authOption) => {
      const securityOption = {};
      for (const httpAuthRef of authOption.all) {
        switch (httpAuthRef.kind) {
          case "noAuth":
            continue;
          case "oauth2":
            securityOption[httpAuthRef.auth.id] = httpAuthRef.scopes;
            continue;
          default:
            securityOption[httpAuthRef.auth.id] = [];
        }
      }
      return securityOption;
    });
    return security;
  }
  function getEndpointSecurity(authReference) {
    const security = getOpenAPISecurity(authReference);
    if (deepEquals(security, root.security)) {
      return void 0;
    }
    if (security.length > 0) {
      return security;
    }
    return void 0;
  }
  function getOpenAPI3Scheme(auth) {
    const scheme = getOpenAPI3SchemeInternal(auth);
    if (scheme) {
      attachExtensions2(program, auth.model, scheme);
    }
    return scheme;
  }
  function getOpenAPI3SchemeInternal(auth) {
    switch (auth.type) {
      case "http":
        return { type: "http", scheme: auth.scheme, description: auth.description };
      case "apiKey":
        return { type: "apiKey", in: auth.in, name: auth.name, description: auth.description };
      case "oauth2":
        const flows = {};
        const scopes = [];
        for (const flow of auth.flows) {
          scopes.push(...flow.scopes.map((x) => x.value));
          flows[flow.type] = {
            authorizationUrl: flow.authorizationUrl,
            tokenUrl: flow.tokenUrl,
            refreshUrl: flow.refreshUrl,
            scopes: Object.fromEntries(flow.scopes.map((x) => [x.value, x.description ?? ""]))
          };
        }
        return { type: "oauth2", flows, description: auth.description };
      case "openIdConnect":
        return {
          type: "openIdConnect",
          openIdConnectUrl: auth.openIdConnectUrl,
          description: auth.description
        };
      case "noAuth":
        return void 0;
      default:
        diagnostics.add(createDiagnostic({
          code: "unsupported-auth",
          format: { authType: auth.type },
          target: currentService.type
        }));
        return void 0;
    }
  }
}
function serializeDocument(root, fileType) {
  sortOpenAPIDocument(root);
  switch (fileType) {
    case "json":
      return prettierOutput(JSON.stringify(root, null, 2));
    case "yaml":
      return stringify3(root, {
        singleQuote: true,
        aliasDuplicateObjects: false,
        lineWidth: 0,
        compat: "yaml-1.1"
      });
  }
}
function prettierOutput(output) {
  return output + "\n";
}
var ErrorTypeFoundError = class extends Error {
  constructor() {
    super("Error type found in evaluated TypeSpec output");
  }
};
function sortObjectByKeys(obj) {
  return Object.keys(obj).sort().reduce((sortedObj, key) => {
    sortedObj[key] = obj[key];
    return sortedObj;
  }, {});
}
function sortOpenAPIDocument(doc) {
  doc.paths = sortObjectByKeys(doc.paths);
  if (doc.components?.schemas) {
    doc.components.schemas = sortObjectByKeys(doc.components.schemas);
  }
  if (doc.components?.parameters) {
    doc.components.parameters = sortObjectByKeys(doc.components.parameters);
  }
}
function isHttpParameterProperty2(httpProperty) {
  return ["header", "query", "path", "cookie"].includes(httpProperty.kind);
}

// src/typespec/core/packages/openapi3/dist/src/tsp-index.js
var tsp_index_exports = {};
__export(tsp_index_exports, {
  $decorators: () => $decorators,
  $lib: () => $lib
});
var $decorators = {
  "TypeSpec.OpenAPI": {
    useRef: $useRef,
    oneOf: $oneOf
  }
};

// src/typespec/core/packages/openapi3/dist/src/index.js
var namespace = "TypeSpec.OpenAPI";

// virtual:virtual:entry.js
var TypeSpecJSSources = {
  "dist/src/index.js": src_exports,
  "dist/src/tsp-index.js": tsp_index_exports
};
var TypeSpecSources = {
  "package.json": '{"name":"@typespec/openapi3","version":"1.4.0","author":"Microsoft Corporation","description":"TypeSpec library for emitting OpenAPI 3.0 and OpenAPI 3.1 from the TypeSpec REST protocol binding and converting OpenAPI3 to TypeSpec","homepage":"https://typespec.io","readme":"https://github.com/microsoft/typespec/blob/main/README.md","license":"MIT","repository":{"type":"git","url":"git+https://github.com/microsoft/typespec.git"},"bugs":{"url":"https://github.com/microsoft/typespec/issues"},"keywords":["typespec"],"bin":{"tsp-openapi3":"cmd/tsp-openapi3.js"},"type":"module","main":"dist/src/index.js","tspMain":"lib/main.tsp","exports":{".":{"typespec":"./lib/main.tsp","types":"./dist/src/index.d.ts","default":"./dist/src/index.js"},"./testing":{"types":"./dist/src/testing/index.d.ts","default":"./dist/src/testing/index.js"}},"engines":{"node":">=20.0.0"},"scripts":{"clean":"rimraf ./dist ./temp","build":"pnpm gen-version && pnpm gen-extern-signature && tsc -p . && pnpm lint-typespec-library","watch":"tsc -p . --watch","gen-extern-signature":"tspd --enable-experimental gen-extern-signature .","lint-typespec-library":"tsp compile . --warn-as-error --import @typespec/library-linter --no-emit","test":"vitest run","test:watch":"vitest -w","test:ui":"vitest --ui","test:ci":"vitest run --coverage --reporter=junit --reporter=default","lint":"eslint . --max-warnings=0","lint:fix":"eslint . --fix","regen-docs":"tspd doc .  --enable-experimental --llmstxt --output-dir ../../website/src/content/docs/docs/emitters/openapi3/reference","regen-specs":"cross-env RECORD=true vitest run","gen-version":"node scripts/generate-version.js","api-extractor":"api-extractor run --local --verbose"},"files":["lib/*.tsp","dist/**","!dist/test/**"],"dependencies":{"@apidevtools/swagger-parser":"~12.0.0","@typespec/asset-emitter":"workspace:^","openapi-types":"~12.1.3","yaml":"~2.8.0"},"peerDependencies":{"@typespec/compiler":"workspace:^","@typespec/http":"workspace:^","@typespec/json-schema":"workspace:^","@typespec/openapi":"workspace:^","@typespec/versioning":"workspace:^"},"peerDependenciesMeta":{"@typespec/json-schema":{"optional":true},"@typespec/xml":{"optional":true},"@typespec/versioning":{"optional":true}},"devDependencies":{"@types/node":"~24.3.0","@types/yargs":"~17.0.33","@typespec/compiler":"workspace:^","@typespec/http":"workspace:^","@typespec/json-schema":"workspace:^","@typespec/library-linter":"workspace:^","@typespec/openapi":"workspace:^","@typespec/rest":"workspace:^","@typespec/tspd":"workspace:^","@typespec/versioning":"workspace:^","@typespec/xml":"workspace:^","@vitest/coverage-v8":"^3.1.2","@vitest/ui":"^3.1.2","c8":"^10.1.3","cross-env":"~10.0.0","rimraf":"~6.0.1","typescript":"~5.9.2","vitest":"^3.1.2"}}',
  "../compiler/lib/intrinsics.tsp": 'import "../dist/src/lib/intrinsic/tsp-index.js";\nimport "./prototypes.tsp";\n\n// This file contains all the intrinsic types of typespec. Everything here will always be loaded\nnamespace TypeSpec;\n\n/**\n * Represent a byte array\n */\nscalar bytes;\n\n/**\n * A numeric type\n */\nscalar numeric;\n\n/**\n * A whole number. This represent any `integer` value possible.\n * It is commonly represented as `BigInteger` in some languages.\n */\nscalar integer extends numeric;\n\n/**\n * A number with decimal value\n */\nscalar float extends numeric;\n\n/**\n * A 64-bit integer. (`-9,223,372,036,854,775,808` to `9,223,372,036,854,775,807`)\n */\nscalar int64 extends integer;\n\n/**\n * A 32-bit integer. (`-2,147,483,648` to `2,147,483,647`)\n */\nscalar int32 extends int64;\n\n/**\n * A 16-bit integer. (`-32,768` to `32,767`)\n */\nscalar int16 extends int32;\n\n/**\n * A 8-bit integer. (`-128` to `127`)\n */\nscalar int8 extends int16;\n\n/**\n * A 64-bit unsigned integer (`0` to `18,446,744,073,709,551,615`)\n */\nscalar uint64 extends integer;\n\n/**\n * A 32-bit unsigned integer (`0` to `4,294,967,295`)\n */\nscalar uint32 extends uint64;\n\n/**\n * A 16-bit unsigned integer (`0` to `65,535`)\n */\nscalar uint16 extends uint32;\n\n/**\n * A 8-bit unsigned integer (`0` to `255`)\n */\nscalar uint8 extends uint16;\n\n/**\n * An integer that can be serialized to JSON (`\u22129007199254740991 (\u2212(2^53 \u2212 1))` to `9007199254740991 (2^53 \u2212 1)` )\n */\nscalar safeint extends int64;\n\n/**\n * A 64 bit floating point number. (`\xB15.0 \xD7 10^\u2212324` to `\xB11.7 \xD7 10^308`)\n */\nscalar float64 extends float;\n\n/**\n * A 32 bit floating point number. (`\xB11.5 x 10^\u221245` to `\xB13.4 x 10^38`)\n */\nscalar float32 extends float64;\n\n/**\n * A decimal number with any length and precision. This represent any `decimal` value possible.\n * It is commonly represented as `BigDecimal` in some languages.\n */\nscalar decimal extends numeric;\n\n/**\n * A 128-bit decimal number.\n */\nscalar decimal128 extends decimal;\n\n/**\n * A sequence of textual characters.\n */\nscalar string;\n\n/**\n * A date on a calendar without a time zone, e.g. "April 10th"\n */\nscalar plainDate {\n  /**\n   * Create a plain date from an ISO 8601 string.\n   * @example\n   *\n   * ```tsp\n   * const date = plainDate.fromISO("2024-05-06");\n   * ```\n   */\n  init fromISO(value: string);\n}\n\n/**\n * A time on a clock without a time zone, e.g. "3:00 am"\n */\nscalar plainTime {\n  /**\n   * Create a plain time from an ISO 8601 string.\n   * @example\n   *\n   * ```tsp\n   * const time = plainTime.fromISO("12:34");\n   * ```\n   */\n  init fromISO(value: string);\n}\n\n/**\n * An instant in coordinated universal time (UTC)"\n */\nscalar utcDateTime {\n  /**\n   * Create a date from an ISO 8601 string.\n   * @example\n   *\n   * ```tsp\n   * const time = utcDateTime.fromISO("2024-05-06T12:20-12Z");\n   * ```\n   */\n  init fromISO(value: string);\n}\n\n/**\n * A date and time in a particular time zone, e.g. "April 10th at 3:00am in PST"\n */\nscalar offsetDateTime {\n  /**\n   * Create a date from an ISO 8601 string.\n   * @example\n   *\n   * ```tsp\n   * const time = offsetDateTime.fromISO("2024-05-06T12:20-12-0700");\n   * ```\n   */\n  init fromISO(value: string);\n}\n\n/**\n * A duration/time period. e.g 5s, 10h\n */\nscalar duration {\n  /**\n   * Create a duration from an ISO 8601 string.\n   * @example\n   *\n   * ```tsp\n   * const time = duration.fromISO("P1Y1D");\n   * ```\n   */\n  init fromISO(value: string);\n}\n\n/**\n * Boolean with `true` and `false` values.\n */\nscalar boolean;\n\n/**\n * @dev Array model type, equivalent to `Element[]`\n * @template Element The type of the array elements\n */\n@indexer(integer, Element)\nmodel Array<Element> {}\n\n/**\n * @dev Model with string properties where all the properties have type `Property`\n * @template Element The type of the properties\n */\n@indexer(string, Element)\nmodel Record<Element> {}\n',
  "../compiler/lib/prototypes.tsp": "namespace TypeSpec.Prototypes;\n\nextern dec getter(target: unknown);\n\nnamespace Types {\n  interface ModelProperty {\n    @getter type(): unknown;\n  }\n\n  interface Operation {\n    @getter returnType(): unknown;\n    @getter parameters(): unknown;\n  }\n\n  interface Array<TElementType> {\n    @getter elementType(): TElementType;\n  }\n}\n",
  "../compiler/lib/std/main.tsp": '// TypeSpec standard library. Everything in here can be omitted by using `--nostdlib` cli flag or `nostdlib` in the config.\nimport "./types.tsp";\nimport "./decorators.tsp";\nimport "./reflection.tsp";\nimport "./visibility.tsp";\n',
  "../compiler/lib/std/types.tsp": 'namespace TypeSpec;\n\n/**\n * Represent a 32-bit unix timestamp datetime with 1s of granularity.\n * It measures time by the number of seconds that have elapsed since 00:00:00 UTC on 1 January 1970.\n */\n@encode("unixTimestamp", int32)\nscalar unixTimestamp32 extends utcDateTime;\n\n/**\n * Represent a URL string as described by https://url.spec.whatwg.org/\n */\nscalar url extends string;\n\n/**\n * Represents a collection of optional properties.\n *\n * @template Source An object whose spread properties are all optional.\n */\n@doc("The template for adding optional properties.")\n@withOptionalProperties\nmodel OptionalProperties<Source> {\n  ...Source;\n}\n\n/**\n * Represents a collection of updateable properties.\n *\n * @template Source An object whose spread properties are all updateable.\n */\n@doc("The template for adding updateable properties.")\n@withUpdateableProperties\nmodel UpdateableProperties<Source> {\n  ...Source;\n}\n\n/**\n * Represents a collection of omitted properties.\n *\n * @template Source An object whose properties are spread.\n * @template Keys The property keys to omit.\n */\n@doc("The template for omitting properties.")\n@withoutOmittedProperties(Keys)\nmodel OmitProperties<Source, Keys extends string> {\n  ...Source;\n}\n\n/**\n * Represents a collection of properties with only the specified keys included.\n *\n * @template Source An object whose properties are spread.\n * @template Keys The property keys to include.\n */\n@doc("The template for picking properties.")\n@withPickedProperties(Keys)\nmodel PickProperties<Source, Keys extends string> {\n  ...Source;\n}\n\n/**\n * Represents a collection of properties with default values omitted.\n *\n * @template Source An object whose spread property defaults are all omitted.\n */\n@withoutDefaultValues\nmodel OmitDefaults<Source> {\n  ...Source;\n}\n\n/**\n * Applies a visibility setting to a collection of properties.\n *\n * @template Source An object whose properties are spread.\n * @template Visibility The visibility to apply to all properties.\n */\n@doc("The template for setting the default visibility of key properties.")\n@withDefaultKeyVisibility(Visibility)\nmodel DefaultKeyVisibility<Source, Visibility extends valueof Reflection.EnumMember> {\n  ...Source;\n}\n',
  "../compiler/lib/std/decorators.tsp": 'import "../../dist/src/lib/tsp-index.js";\n\nusing TypeSpec.Reflection;\n\nnamespace TypeSpec;\n\n/**\n * Typically a short, single-line description.\n * @param summary Summary string.\n *\n * @example\n * ```typespec\n * @summary("This is a pet")\n * model Pet {}\n * ```\n */\nextern dec summary(target: unknown, summary: valueof string);\n\n/**\n * Attach a documentation string. Content support CommonMark markdown formatting.\n * @param doc Documentation string\n * @param formatArgs Record with key value pair that can be interpolated in the doc.\n *\n * @example\n * ```typespec\n * @doc("Represent a Pet available in the PetStore")\n * model Pet {}\n * ```\n */\nextern dec doc(target: unknown, doc: valueof string, formatArgs?: {});\n\n/**\n * Attach a documentation string to describe the successful return types of an operation.\n * If an operation returns a union of success and errors it only describes the success. See `@errorsDoc` for error documentation.\n * @param doc Documentation string\n *\n * @example\n * ```typespec\n * @returnsDoc("Returns doc")\n * op get(): Pet | NotFound;\n * ```\n */\nextern dec returnsDoc(target: Operation, doc: valueof string);\n\n/**\n * Attach a documentation string to describe the error return types of an operation.\n * If an operation returns a union of success and errors it only describes the errors. See `@returnsDoc` for success documentation.\n * @param doc Documentation string\n *\n * @example\n * ```typespec\n * @errorsDoc("Errors doc")\n * op get(): Pet | NotFound;\n * ```\n */\nextern dec errorsDoc(target: Operation, doc: valueof string);\n\n/**\n * Service options.\n */\nmodel ServiceOptions {\n  /**\n   * Title of the service.\n   */\n  title?: string;\n}\n\n/**\n * Mark this namespace as describing a service and configure service properties.\n * @param options Optional configuration for the service.\n *\n * @example\n * ```typespec\n * @service\n * namespace PetStore;\n * ```\n *\n * @example Setting service title\n * ```typespec\n * @service(#{title: "Pet store"})\n * namespace PetStore;\n * ```\n */\nextern dec service(target: Namespace, options?: valueof ServiceOptions);\n\n/**\n * Specify that this model is an error type. Operations return error types when the operation has failed.\n *\n * @example\n * ```typespec\n * @error\n * model PetStoreError {\n *   code: string;\n *   message: string;\n * }\n * ```\n */\nextern dec error(target: Model);\n\n/**\n * Applies a media type hint to a TypeSpec type. Emitters and libraries may choose to use this hint to determine how a\n * type should be serialized. For example, the `@typespec/http` library will use the media type hint of the response\n * body type as a default `Content-Type` if one is not explicitly specified in the operation.\n *\n * Media types (also known as MIME types) are defined by RFC 6838. The media type hint should be a valid media type\n * string as defined by the RFC, but the decorator does not enforce or validate this constraint.\n *\n * Notes: the applied media type is _only_ a hint. It may be overridden or not used at all. Media type hints are\n * inherited by subtypes. If a media type hint is applied to a model, it will be inherited by all other models that\n * `extend` it unless they delcare their own media type hint.\n *\n * @param mediaType The media type hint to apply to the target type.\n *\n * @example create a model that serializes as XML by default\n *\n * ```tsp\n * @mediaTypeHint("application/xml")\n * model Example {\n *   @visibility(Lifecycle.Read)\n *   id: string;\n *\n *   name: string;\n * }\n * ```\n */\nextern dec mediaTypeHint(target: Model | Scalar | Enum | Union, mediaType: valueof string);\n\n// Cannot apply this to the scalar itself. Needs to be applied here so that we don\'t crash nostdlib scenarios\n@@mediaTypeHint(TypeSpec.bytes, "application/octet-stream");\n\n// @@mediaTypeHint(TypeSpec.string "text/plain") -- This is hardcoded in the compiler to avoid circularity\n// between the initialization of the string scalar and the `valueof string` required to call the\n// `mediaTypeHint` decorator.\n\n/**\n * Specify a known data format hint for this string type. For example `uuid`, `uri`, etc.\n * This differs from the `@pattern` decorator which is meant to specify a regular expression while `@format` accepts a known format name.\n * The format names are open ended and are left to emitter to interpret.\n *\n * @param format format name.\n *\n * @example\n * ```typespec\n * @format("uuid")\n * scalar uuid extends string;\n * ```\n */\nextern dec format(target: string | ModelProperty, format: valueof string);\n\n/**\n * Specify the the pattern this string should respect using simple regular expression syntax.\n * The following syntax is allowed: alternations (`|`), quantifiers (`?`, `*`, `+`, and `{ }`), wildcard (`.`), and grouping parentheses.\n * Advanced features like look-around, capture groups, and references are not supported.\n *\n * This decorator may optionally provide a custom validation _message_. Emitters may choose to use the message to provide\n * context when pattern validation fails. For the sake of consistency, the message should be a phrase that describes in\n * plain language what sort of content the pattern attempts to validate. For example, a complex regular expression that\n * validates a GUID string might have a message like "Must be a valid GUID."\n *\n * @param pattern Regular expression.\n * @param validationMessage Optional validation message that may provide context when validation fails.\n *\n * @example\n * ```typespec\n * @pattern("[a-z]+", "Must be a string consisting of only lower case letters and of at least one character.")\n * scalar LowerAlpha extends string;\n * ```\n */\nextern dec pattern(\n  target: string | bytes | ModelProperty,\n  pattern: valueof string,\n  validationMessage?: valueof string\n);\n\n/**\n * Specify the minimum length this string type should be.\n * @param value Minimum length\n *\n * @example\n * ```typespec\n * @minLength(2)\n * scalar Username extends string;\n * ```\n */\nextern dec minLength(target: string | ModelProperty, value: valueof integer);\n\n/**\n * Specify the maximum length this string type should be.\n * @param value Maximum length\n *\n * @example\n * ```typespec\n * @maxLength(20)\n * scalar Username extends string;\n * ```\n */\nextern dec maxLength(target: string | ModelProperty, value: valueof integer);\n\n/**\n * Specify the minimum number of items this array should have.\n * @param value Minimum number\n *\n * @example\n * ```typespec\n * @minItems(1)\n * model Endpoints is string[];\n * ```\n */\nextern dec minItems(target: unknown[] | ModelProperty, value: valueof integer);\n\n/**\n * Specify the maximum number of items this array should have.\n * @param value Maximum number\n *\n * @example\n * ```typespec\n * @maxItems(5)\n * model Endpoints is string[];\n * ```\n */\nextern dec maxItems(target: unknown[] | ModelProperty, value: valueof integer);\n\n/**\n * Specify the minimum value this numeric type should be.\n * @param value Minimum value\n *\n * @example\n * ```typespec\n * @minValue(18)\n * scalar Age is int32;\n * ```\n */\nextern dec minValue(target: numeric | ModelProperty, value: valueof numeric);\n\n/**\n * Specify the maximum value this numeric type should be.\n * @param value Maximum value\n *\n * @example\n * ```typespec\n * @maxValue(200)\n * scalar Age is int32;\n * ```\n */\nextern dec maxValue(target: numeric | ModelProperty, value: valueof numeric);\n\n/**\n * Specify the minimum value this numeric type should be, exclusive of the given\n * value.\n * @param value Minimum value\n *\n * @example\n * ```typespec\n * @minValueExclusive(0)\n * scalar distance is float64;\n * ```\n */\nextern dec minValueExclusive(target: numeric | ModelProperty, value: valueof numeric);\n\n/**\n * Specify the maximum value this numeric type should be, exclusive of the given\n * value.\n * @param value Maximum value\n *\n * @example\n * ```typespec\n * @maxValueExclusive(50)\n * scalar distance is float64;\n * ```\n */\nextern dec maxValueExclusive(target: numeric | ModelProperty, value: valueof numeric);\n\n/**\n * Mark this string as a secret value that should be treated carefully to avoid exposure\n *\n * @example\n * ```typespec\n * @secret\n * scalar Password is string;\n * ```\n */\nextern dec secret(target: string | ModelProperty);\n\n/**\n * Attaches a tag to an operation, interface, or namespace. Multiple `@tag` decorators can be specified to attach multiple tags to a TypeSpec element.\n * @param tag Tag value\n */\nextern dec tag(target: Namespace | Interface | Operation, tag: valueof string);\n\n/**\n * Specifies how a templated type should name their instances.\n * @param name name the template instance should take\n * @param formatArgs Model with key value used to interpolate the name\n *\n * @example\n * ```typespec\n * @friendlyName("{name}List", T)\n * model List<Item> {\n *   value: Item[];\n *   nextLink: string;\n * }\n * ```\n */\nextern dec friendlyName(target: unknown, name: valueof string, formatArgs?: unknown);\n\n/**\n * Mark a model property as the key to identify instances of that type\n * @param altName Name of the property. If not specified, the decorated property name is used.\n *\n * @example\n * ```typespec\n * model Pet {\n *   @key id: string;\n * }\n * ```\n */\nextern dec key(target: ModelProperty, altName?: valueof string);\n\n/**\n * Specify this operation is an overload of the given operation.\n * @param overloadbase Base operation that should be a union of all overloads\n *\n * @example\n * ```typespec\n * op upload(data: string | bytes, @header contentType: "text/plain" | "application/octet-stream"): void;\n * @overload(upload)\n * op uploadString(data: string, @header contentType: "text/plain" ): void;\n * @overload(upload)\n * op uploadBytes(data: bytes, @header contentType: "application/octet-stream"): void;\n * ```\n */\nextern dec overload(target: Operation, overloadbase: Operation);\n\n/**\n * Provide an alternative name for this type when serialized to the given mime type.\n * @param mimeType Mime type this should apply to. The mime type should be a known mime type as described here https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types without any suffix (e.g. `+json`)\n * @param name Alternative name\n *\n * @example\n *\n * ```typespec\n * model Certificate {\n *   @encodedName("application/json", "exp")\n *   @encodedName("application/xml", "expiry")\n *   expireAt: int32;\n * }\n * ```\n *\n * @example Invalid values\n *\n * ```typespec\n * @encodedName("application/merge-patch+json", "exp")\n *              ^ error cannot use subtype\n * ```\n */\nextern dec encodedName(target: unknown, mimeType: valueof string, name: valueof string);\n\n/**\n * Options for `@discriminated` decorator.\n */\nmodel DiscriminatedOptions {\n  /**\n   * How is the discriminated union serialized.\n   * @default object\n   */\n  envelope?: "object" | "none";\n\n  /** Name of the discriminator property */\n  discriminatorPropertyName?: string;\n\n  /** Name of the property envelopping the data */\n  envelopePropertyName?: string;\n}\n\n/**\n * Specify that this union is discriminated.\n * @param options Options to configure the serialization of the discriminated union.\n *\n * @example\n *\n * ```typespec\n * @discriminated\n * union Pet{ cat: Cat, dog: Dog }\n *\n * model Cat { name: string, meow: boolean }\n * model Dog { name: string, bark: boolean }\n * ```\n * Serialized as:\n * ```json\n * {\n *   "kind": "cat",\n *   "value": {\n *     "name": "Whiskers",\n *     "meow": true\n *   }\n * },\n * {\n *   "kind": "dog",\n *   "value": {\n *     "name": "Rex",\n *     "bark": false\n *   }\n * }\n * ```\n *\n * @example Custom property names\n *\n * ```typespec\n * @discriminated(#{discriminatorPropertyName: "dataKind", envelopePropertyName: "data"})\n * union Pet{ cat: Cat, dog: Dog }\n *\n * model Cat { name: string, meow: boolean }\n * model Dog { name: string, bark: boolean }\n * ```\n * Serialized as:\n * ```json\n * {\n *   "dataKind": "cat",\n *   "data": {\n *     "name": "Whiskers",\n *     "meow": true\n *   }\n * },\n * {\n *   "dataKind": "dog",\n *   "data": {\n *     "name": "Rex",\n *     "bark": false\n *   }\n * }\n * ```\n */\nextern dec discriminated(target: Union, options?: valueof DiscriminatedOptions);\n\n/**\n * Specify the property to be used to discriminate this type.\n * @param propertyName The property name to use for discrimination\n *\n * @example\n *\n * ```typespec\n * @discriminator("kind")\n * model Pet{ kind: string }\n *\n * model Cat extends Pet {kind: "cat", meow: boolean}\n * model Dog extends Pet  {kind: "dog", bark: boolean}\n * ```\n */\nextern dec discriminator(target: Model, propertyName: valueof string);\n\n/**\n * Known encoding to use on utcDateTime or offsetDateTime\n */\nenum DateTimeKnownEncoding {\n  /**\n   * RFC 3339 standard. https://www.ietf.org/rfc/rfc3339.txt\n   * Encode to string.\n   */\n  rfc3339: "rfc3339",\n\n  /**\n   * RFC 7231 standard. https://www.ietf.org/rfc/rfc7231.txt\n   * Encode to string.\n   */\n  rfc7231: "rfc7231",\n\n  /**\n   * Encode a datetime to a unix timestamp.\n   * Unix timestamps are represented as an integer number of seconds since the Unix epoch and usually encoded as an int32.\n   */\n  unixTimestamp: "unixTimestamp",\n}\n\n/**\n * Known encoding to use on duration\n */\nenum DurationKnownEncoding {\n  /**\n   * ISO8601 duration\n   */\n  ISO8601: "ISO8601",\n\n  /**\n   * Encode to integer or float\n   */\n  seconds: "seconds",\n}\n\n/**\n * Known encoding to use on bytes\n */\nenum BytesKnownEncoding {\n  /**\n   * Encode to Base64\n   */\n  base64: "base64",\n\n  /**\n   * Encode to Base64 Url\n   */\n  base64url: "base64url",\n}\n\n/**\n * Encoding for serializing arrays\n */\nenum ArrayEncoding {\n  /** Each values of the array is separated by a | */\n  pipeDelimited,\n\n  /** Each values of the array is separated by a <space> */\n  spaceDelimited,\n}\n\n/**\n * Specify how to encode the target type.\n * @param encodingOrEncodeAs Known name of an encoding or a scalar type to encode as(Only for numeric types to encode as string).\n * @param encodedAs What target type is this being encoded as. Default to string.\n *\n * @example offsetDateTime encoded with rfc7231\n *\n * ```tsp\n * @encode("rfc7231")\n * scalar myDateTime extends offsetDateTime;\n * ```\n *\n * @example utcDateTime encoded with unixTimestamp\n *\n * ```tsp\n * @encode("unixTimestamp", int32)\n * scalar myDateTime extends unixTimestamp;\n * ```\n *\n * @example encode numeric type to string\n *\n * ```tsp\n * model Pet {\n *   @encode(string) id: int64;\n * }\n * ```\n */\nextern dec encode(\n  target: Scalar | ModelProperty,\n  encodingOrEncodeAs: (valueof string | EnumMember) | Scalar,\n  encodedAs?: Scalar\n);\n\n/** Options for example decorators */\nmodel ExampleOptions {\n  /** The title of the example */\n  title?: string;\n\n  /** Description of the example */\n  description?: string;\n}\n\n/**\n * Provide an example value for a data type.\n *\n * @param example Example value.\n * @param options Optional metadata for the example.\n *\n * @example\n *\n * ```tsp\n * @example(#{name: "Fluffy", age: 2})\n * model Pet {\n *  name: string;\n *  age: int32;\n * }\n * ```\n */\nextern dec example(\n  target: Model | Enum | Scalar | Union | ModelProperty | UnionVariant,\n  example: valueof unknown,\n  options?: valueof ExampleOptions\n);\n\n/**\n * Operation example configuration.\n */\nmodel OperationExample {\n  /** Example request body. */\n  parameters?: unknown;\n\n  /** Example response body. */\n  returnType?: unknown;\n}\n\n/**\n * Provide example values for an operation\'s parameters and corresponding return type.\n *\n * @param example Example value.\n * @param options Optional metadata for the example.\n *\n * @example\n *\n * ```tsp\n * @opExample(#{parameters: #{name: "Fluffy", age: 2}, returnType: #{name: "Fluffy", age: 2, id: "abc"})\n * op createPet(pet: Pet): Pet;\n * ```\n */\nextern dec opExample(\n  target: Operation,\n  example: valueof OperationExample,\n  options?: valueof ExampleOptions\n);\n\n/**\n * Returns the model with required properties removed.\n */\nextern dec withOptionalProperties(target: Model);\n\n/**\n * Returns the model with any default values removed.\n */\nextern dec withoutDefaultValues(target: Model);\n\n/**\n * Returns the model with the given properties omitted.\n * @param omit List of properties to omit\n */\nextern dec withoutOmittedProperties(target: Model, omit: string | Union);\n\n/**\n * Returns the model with only the given properties included.\n * @param pick List of properties to include\n */\nextern dec withPickedProperties(target: Model, pick: string | Union);\n\n//---------------------------------------------------------------------------\n// Paging\n//---------------------------------------------------------------------------\n\n/**\n * Mark this operation as a `list` operation that returns a paginated list of items.\n */\nextern dec list(target: Operation);\n\n/**\n * Pagination property defining the number of items to skip.\n * @example\n * ```tsp\n * model Page<T> {\n *   @pageItems items: T[];\n * }\n * @list op listPets(@offset skip: int32, @pageSize pageSize: int8): Page<Pet>;\n * ```\n */\nextern dec offset(target: ModelProperty);\n\n/**\n * Pagination property defining the page index.\n *\n * @example\n * ```tsp\n * model Page<T> {\n *   @pageItems items: T[];\n * }\n * @list op listPets(@pageIndex page: int32, @pageSize pageSize: int8): Page<Pet>;\n * ```\n */\nextern dec pageIndex(target: ModelProperty);\n\n/**\n * Specify the pagination parameter that controls the maximum number of items to include in a page.\n *\n * @example\n * ```tsp\n * model Page<T> {\n *   @pageItems items: T[];\n * }\n * @list op listPets(@pageIndex page: int32, @pageSize pageSize: int8): Page<Pet>;\n * ```\n */\nextern dec pageSize(target: ModelProperty);\n\n/**\n * Specify the the property that contains the array of page items.\n *\n * @example\n * ```tsp\n * model Page<T> {\n *   @pageItems items: T[];\n * }\n * @list op listPets(@pageIndex page: int32, @pageSize pageSize: int8): Page<Pet>;\n * ```\n */\nextern dec pageItems(target: ModelProperty);\n\n/**\n * Pagination property defining the token to get to the next page.\n * It MUST be specified both on the request parameter and the response.\n *\n * @example\n * ```tsp\n * model Page<T> {\n *   @pageItems items: T[];\n *   @continuationToken continuationToken: string;\n * }\n * @list op listPets(@continuationToken continuationToken: string): Page<Pet>;\n * ```\n */\nextern dec continuationToken(target: ModelProperty);\n\n/**\n * Pagination property defining a link to the next page.\n *\n * It is expected that navigating to the link will return the same set of responses as the operation that returned the current page.\n *\n * @example\n * ```tsp\n * model Page<T> {\n *   @pageItems items: T[];\n *   @nextLink next: url;\n *   @prevLink prev: url;\n *   @firstLink first: url;\n *   @lastLink last: url;\n * }\n * @list op listPets(): Page<Pet>;\n * ```\n */\nextern dec nextLink(target: ModelProperty);\n\n/**\n * Pagination property defining a link to the previous page.\n *\n * It is expected that navigating to the link will return the same set of responses as the operation that returned the current page.\n *\n * @example\n * ```tsp\n * model Page<T> {\n *   @pageItems items: T[];\n *   @nextLink next: url;\n *   @prevLink prev: url;\n *   @firstLink first: url;\n *   @lastLink last: url;\n * }\n * @list op listPets(): Page<Pet>;\n * ```\n */\nextern dec prevLink(target: ModelProperty);\n\n/**\n * Pagination property defining a link to the first page.\n *\n * It is expected that navigating to the link will return the same set of responses as the operation that returned the current page.\n *\n * @example\n * ```tsp\n * model Page<T> {\n *   @pageItems items: T[];\n *   @nextLink next: url;\n *   @prevLink prev: url;\n *   @firstLink first: url;\n *   @lastLink last: url;\n * }\n * @list op listPets(): Page<Pet>;\n * ```\n */\nextern dec firstLink(target: ModelProperty);\n\n/**\n * Pagination property defining a link to the last page.\n *\n * It is expected that navigating to the link will return the same set of responses as the operation that returned the current page.\n *\n * @example\n * ```tsp\n * model Page<T> {\n *   @pageItems items: T[];\n *   @nextLink next: url;\n *   @prevLink prev: url;\n *   @firstLink first: url;\n *   @lastLink last: url;\n * }\n * @list op listPets(): Page<Pet>;\n * ```\n */\nextern dec lastLink(target: ModelProperty);\n\n//---------------------------------------------------------------------------\n// Debugging\n//---------------------------------------------------------------------------\n\n/**\n * A debugging decorator used to inspect a type.\n * @param text Custom text to log\n */\nextern dec inspectType(target: unknown, text: valueof string);\n\n/**\n * A debugging decorator used to inspect a type name.\n * @param text Custom text to log\n */\nextern dec inspectTypeName(target: unknown, text: valueof string);\n',
  "../compiler/lib/std/reflection.tsp": "namespace TypeSpec.Reflection;\n\nmodel Enum {}\nmodel EnumMember {}\nmodel Interface {}\nmodel Model {}\nmodel ModelProperty {}\nmodel Namespace {}\nmodel Operation {}\nmodel Scalar {}\nmodel Union {}\nmodel UnionVariant {}\nmodel StringTemplate {}\n",
  "../compiler/lib/std/visibility.tsp": '// Copyright (c) Microsoft Corporation\n// Licensed under the MIT license.\n\nimport "../../dist/src/lib/tsp-index.js";\n\nusing TypeSpec.Reflection;\n\nnamespace TypeSpec;\n\n/**\n * Sets the visibility modifiers that are active on a property, indicating that it is only considered to be present\n * (or "visible") in contexts that select for the given modifiers.\n *\n * A property without any visibility settings applied for any visibility class (e.g. `Lifecycle`) is considered to have\n * the default visibility settings for that class.\n *\n * If visibility for the property has already been set for a visibility class (for example, using `@invisible` or\n * `@removeVisibility`), this decorator will **add** the specified visibility modifiers to the property.\n *\n * See: [Visibility](https://typespec.io/docs/language-basics/visibility)\n *\n * The `@typespec/http` library uses `Lifecycle` visibility to determine which properties are included in the request or\n * response bodies of HTTP operations. By default, it uses the following visibility settings:\n *\n * - For the return type of operations, properties are included if they have `Lifecycle.Read` visibility.\n * - For POST operation parameters, properties are included if they have `Lifecycle.Create` visibility.\n * - For PUT operation parameters, properties are included if they have `Lifecycle.Create` or `Lifecycle.Update` visibility.\n * - For PATCH operation parameters, properties are included if they have `Lifecycle.Update` visibility.\n * - For DELETE operation parameters, properties are included if they have `Lifecycle.Delete` visibility.\n * - For GET or HEAD operation parameters, properties are included if they have `Lifecycle.Query` visibility.\n *\n * By default, properties have all five Lifecycle visibility modifiers enabled, so a property is visible in all contexts\n * by default.\n *\n * The default settings may be overridden using the `@returnTypeVisibility` and `@parameterVisibility` decorators.\n *\n * See also: [Automatic visibility](https://typespec.io/docs/libraries/http/operations#automatic-visibility)\n *\n * @param visibilities List of visibilities which apply to this property.\n *\n * @example\n *\n * ```typespec\n * model Dog {\n *   // The service will generate an ID, so you don\'t need to send it.\n *   @visibility(Lifecycle.Read)\n *   id: int32;\n *\n *   // The service will store this secret name, but won\'t ever return it.\n *   @visibility(Lifecycle.Create, Lifecycle.Update)\n *   secretName: string;\n *\n *   // The regular name has all vi\n *   name: string;\n * }\n * ```\n */\nextern dec visibility(target: ModelProperty, ...visibilities: valueof EnumMember[]);\n\n/**\n * Indicates that a property is not visible in the given visibility class.\n *\n * This decorator removes all active visibility modifiers from the property within\n * the given visibility class, making it invisible to any context that selects for\n * visibility modifiers within that class.\n *\n * @param visibilityClass The visibility class to make the property invisible within.\n *\n * @example\n * ```typespec\n * model Example {\n *   @invisible(Lifecycle)\n *   hidden_property: string;\n * }\n * ```\n */\nextern dec invisible(target: ModelProperty, visibilityClass: Enum);\n\n/**\n * Removes visibility modifiers from a property.\n *\n * If the visibility modifiers for a visibility class have not been initialized,\n * this decorator will use the default visibility modifiers for the visibility\n * class as the default modifier set.\n *\n * @param target The property to remove visibility from.\n * @param visibilities The visibility modifiers to remove from the target property.\n *\n * @example\n * ```typespec\n * model Example {\n *   // This property will have all Lifecycle visibilities except the Read\n *   // visibility, since it is removed.\n *   @removeVisibility(Lifecycle.Read)\n *   secret_property: string;\n * }\n * ```\n */\nextern dec removeVisibility(target: ModelProperty, ...visibilities: valueof EnumMember[]);\n\n/**\n * Removes properties that do not have at least one of the given visibility modifiers\n * active.\n *\n * If no visibility modifiers are supplied, this decorator has no effect.\n *\n * See also: [Automatic visibility](https://typespec.io/docs/libraries/http/operations#automatic-visibility)\n *\n * When using an emitter that applies visibility automatically, it is generally\n * not necessary to use this decorator.\n *\n * @param visibilities List of visibilities that apply to this property.\n *\n * @example\n * ```typespec\n * model Dog {\n *   @visibility(Lifecycle.Read)\n *   id: int32;\n *\n *   @visibility(Lifecycle.Create, Lifecycle.Update)\n *   secretName: string;\n *\n *   name: string;\n * }\n *\n * // The spread operator will copy all the properties of Dog into DogRead,\n * // and @withVisibility will then remove those that are not visible with\n * // create or update visibility.\n * //\n * // In this case, the id property is removed, and the name and secretName\n * // properties are kept.\n * @withVisibility(Lifecycle.Create, Lifecycle.Update)\n * model DogCreateOrUpdate {\n *   ...Dog;\n * }\n *\n * // In this case the id and name properties are kept and the secretName property\n * // is removed.\n * @withVisibility(Lifecycle.Read)\n * model DogRead {\n *   ...Dog;\n * }\n * ```\n */\nextern dec withVisibility(target: Model, ...visibilities: valueof EnumMember[]);\n\n/**\n * Set the visibility of key properties in a model if not already set.\n *\n * This will set the visibility modifiers of all key properties in the model if the visibility is not already _explicitly_ set,\n * but will not change the visibility of any properties that have visibility set _explicitly_, even if the visibility\n * is the same as the default visibility.\n *\n * Visibility may be set explicitly using any of the following decorators:\n *\n * - `@visibility`\n * - `@removeVisibility`\n * - `@invisible`\n *\n * @param visibility The desired default visibility value. If a key property already has visibility set, it will not be changed.\n */\nextern dec withDefaultKeyVisibility(target: Model, visibility: valueof EnumMember);\n\n/**\n * Declares the visibility constraint of the parameters of a given operation.\n *\n * A parameter or property nested within a parameter will be visible if it has _any_ of the visibilities\n * in the list.\n *\n * It is invalid to call this decorator with no visibility modifiers.\n *\n * @param visibilities List of visibility modifiers that apply to the parameters of this operation.\n */\nextern dec parameterVisibility(target: Operation, ...visibilities: valueof EnumMember[]);\n\n/**\n * Declares the visibility constraint of the return type of a given operation.\n *\n * A property within the return type of the operation will be visible if it has _any_ of the visibilities\n * in the list.\n *\n * It is invalid to call this decorator with no visibility modifiers.\n *\n * @param visibilities List of visibility modifiers that apply to the return type of this operation.\n */\nextern dec returnTypeVisibility(target: Operation, ...visibilities: valueof EnumMember[]);\n\n/**\n * Returns the model with non-updateable properties removed.\n */\nextern dec withUpdateableProperties(target: Model);\n\n/**\n * Declares the default visibility modifiers for a visibility class.\n *\n * The default modifiers are used when a property does not have any visibility decorators\n * applied to it.\n *\n * The modifiers passed to this decorator _MUST_ be members of the target Enum.\n *\n * @param visibilities the list of modifiers to use as the default visibility modifiers.\n */\nextern dec defaultVisibility(target: Enum, ...visibilities: valueof EnumMember[]);\n\n/**\n * A visibility class for resource lifecycle phases.\n *\n * These visibilities control whether a property is visible during the various phases of a resource\'s lifecycle.\n *\n * @example\n * ```typespec\n * model Dog {\n *  @visibility(Lifecycle.Read)\n *  id: int32;\n *\n *  @visibility(Lifecycle.Create, Lifecycle.Update)\n *  secretName: string;\n *\n *  name: string;\n * }\n * ```\n *\n * In this example, the `id` property is only visible during the read phase, and the `secretName` property is only visible\n * during the create and update phases. This means that the server will return the `id` property when returning a `Dog`,\n * but the client will not be able to set or update it. In contrast, the `secretName` property can be set when creating\n * or updating a `Dog`, but the server will never return it. The `name` property has no visibility modifiers and is\n * therefore visible in all phases.\n */\nenum Lifecycle {\n  /**\n   * The property is visible when a resource is being created.\n   */\n  Create,\n\n  /**\n   * The property is visible when a resource is being read.\n   */\n  Read,\n\n  /**\n   * The property is visible when a resource is being updated.\n   */\n  Update,\n\n  /**\n   * The property is visible when a resource is being deleted.\n   */\n  Delete,\n\n  /**\n   * The property is visible when a resource is being queried.\n   *\n   * In HTTP APIs, this visibility applies to parameters of GET or HEAD operations.\n   */\n  Query,\n}\n\n/**\n * A visibility filter, used to specify which properties should be included when\n * using the `withVisibilityFilter` decorator.\n *\n * The filter matches any property with ALL of the following:\n * - If the `any` key is present, the property must have at least one of the specified visibilities.\n * - If the `all` key is present, the property must have all of the specified visibilities.\n * - If the `none` key is present, the property must have none of the specified visibilities.\n */\nmodel VisibilityFilter {\n  any?: EnumMember[];\n  all?: EnumMember[];\n  none?: EnumMember[];\n}\n\n/**\n * Applies the given visibility filter to the properties of the target model.\n *\n * This transformation is recursive, so it will also apply the filter to any nested\n * or referenced models that are the types of any properties in the `target`.\n *\n * If a `nameTemplate` is provided, newly-created type instances will be named according\n * to the template. See the `@friendlyName` decorator for more information on the template\n * syntax. The transformed type is provided as the argument to the template.\n *\n * @param target The model to apply the visibility filter to.\n * @param filter The visibility filter to apply to the properties of the target model.\n * @param nameTemplate The name template to use when renaming new model instances.\n *\n * @example\n * ```typespec\n * model Dog {\n *   @visibility(Lifecycle.Read)\n *   id: int32;\n *\n *   name: string;\n * }\n *\n * @withVisibilityFilter(#{ all: #[Lifecycle.Read] })\n * model DogRead {\n *  ...Dog\n * }\n * ```\n */\nextern dec withVisibilityFilter(\n  target: Model,\n  filter: valueof VisibilityFilter,\n  nameTemplate?: valueof string\n);\n\n/**\n * Transforms the `target` model to include only properties that are visible during the\n * "Update" lifecycle phase.\n *\n * Any nested models of optional properties will be transformed into the "CreateOrUpdate"\n * lifecycle phase instead of the "Update" lifecycle phase, so that nested models may be\n * fully updated.\n *\n * If a `nameTemplate` is provided, newly-created type instances will be named according\n * to the template. See the `@friendlyName` decorator for more information on the template\n * syntax. The transformed type is provided as the argument to the template.\n *\n * @param target The model to apply the transformation to.\n * @param nameTemplate The name template to use when renaming new model instances.\n *\n * @example\n * ```typespec\n * model Dog {\n *   @visibility(Lifecycle.Read)\n *   id: int32;\n *\n *   @visibility(Lifecycle.Create, Lifecycle.Update)\n *   secretName: string;\n *\n *   name: string;\n * }\n *\n * @withLifecycleUpdate\n * model DogUpdate {\n *   ...Dog\n * }\n * ```\n */\nextern dec withLifecycleUpdate(target: Model, nameTemplate?: valueof string);\n\n/**\n * A copy of the input model `T` with only the properties that are visible during the\n * "Create" resource lifecycle phase.\n *\n * This transformation is recursive, and will include only properties that have the\n * `Lifecycle.Create` visibility modifier.\n *\n * If a `NameTemplate` is provided, the new model will be named according to the template.\n * The template uses the same syntax as the `@friendlyName` decorator.\n *\n * @template T The model to transform.\n * @template NameTemplate The name template to use for the new model.\n *\n *  * @example\n * ```typespec\n * model Dog {\n *   @visibility(Lifecycle.Read)\n *   id: int32;\n *\n *   name: string;\n * }\n *\n * // This model has only the `name` field.\n * model CreateDog is Create<Dog>;\n * ```\n */\n@doc("")\n@friendlyName(NameTemplate, T)\n@withVisibilityFilter(#{ all: #[Lifecycle.Create] }, NameTemplate)\nmodel Create<T extends Reflection.Model, NameTemplate extends valueof string = "Create{name}"> {\n  ...T;\n}\n\n/**\n * A copy of the input model `T` with only the properties that are visible during the\n * "Read" resource lifecycle phase.\n *\n * The "Read" lifecycle phase is used for properties returned by operations that read data, like\n * HTTP GET operations.\n *\n * This transformation is recursive, and will include only properties that have the\n * `Lifecycle.Read` visibility modifier.\n *\n * If a `NameTemplate` is provided, the new model will be named according to the template.\n * The template uses the same syntax as the `@friendlyName` decorator.\n *\n * @template T The model to transform.\n * @template NameTemplate The name template to use for the new model.\n *\n *  * @example\n * ```typespec\n * model Dog {\n *   @visibility(Lifecycle.Read)\n *   id: int32;\n *\n *   @visibility(Lifecycle.Create, Lifecycle.Update)\n *   secretName: string;\n *\n *   name: string;\n * }\n *\n * // This model has the `id` and `name` fields, but not `secretName`.\n * model ReadDog is Read<Dog>;\n * ```\n */\n@doc("")\n@friendlyName(NameTemplate, T)\n@withVisibilityFilter(#{ all: #[Lifecycle.Read] }, NameTemplate)\nmodel Read<T extends Reflection.Model, NameTemplate extends valueof string = "Read{name}"> {\n  ...T;\n}\n\n/**\n * A copy of the input model `T` with only the properties that are visible during the\n * "Update" resource lifecycle phase.\n *\n * The "Update" lifecycle phase is used for properties passed as parameters to operations\n * that update data, like HTTP PATCH operations.\n *\n * This transformation will include only the properties that have the `Lifecycle.Update`\n * visibility modifier, and the types of all properties will be replaced with the\n * equivalent `CreateOrUpdate` transformation.\n *\n * If a `NameTemplate` is provided, the new model will be named according to the template.\n * The template uses the same syntax as the `@friendlyName` decorator.\n *\n * @template T The model to transform.\n * @template NameTemplate The name template to use for the new model.\n *\n *  * @example\n * ```typespec\n * model Dog {\n *   @visibility(Lifecycle.Read)\n *   id: int32;\n *\n *   @visibility(Lifecycle.Create, Lifecycle.Update)\n *   secretName: string;\n *\n *   name: string;\n * }\n *\n * // This model will have the `secretName` and `name` fields, but not the `id` field.\n * model UpdateDog is Update<Dog>;\n * ```\n */\n@doc("")\n@friendlyName(NameTemplate, T)\n@withLifecycleUpdate(NameTemplate)\nmodel Update<T extends Reflection.Model, NameTemplate extends valueof string = "Update{name}"> {\n  ...T;\n}\n\n/**\n * A copy of the input model `T` with only the properties that are visible during the\n * "Create" or "Update" resource lifecycle phases.\n *\n * The "CreateOrUpdate" lifecycle phase is used by default for properties passed as parameters to operations\n * that can create _or_ update data, like HTTP PUT operations.\n *\n * This transformation is recursive, and will include only properties that have the\n * `Lifecycle.Create` or `Lifecycle.Update` visibility modifier.\n *\n * If a `NameTemplate` is provided, the new model will be named according to the template.\n * The template uses the same syntax as the `@friendlyName` decorator.\n *\n * @template T The model to transform.\n * @template NameTemplate The name template to use for the new model.\n *\n *  * @example\n * ```typespec\n * model Dog {\n *   @visibility(Lifecycle.Read)\n *   id: int32;\n *\n *   @visibility(Lifecycle.Create)\n *   immutableSecret: string;\n *\n *   @visibility(Lifecycle.Create, Lifecycle.Update)\n *   secretName: string;\n *\n *   name: string;\n * }\n *\n * // This model will have the `immutableSecret`, `secretName`, and `name` fields, but not the `id` field.\n * model CreateOrUpdateDog is CreateOrUpdate<Dog>;\n * ```\n */\n@doc("")\n@friendlyName(NameTemplate, T)\n@withVisibilityFilter(#{ any: #[Lifecycle.Create, Lifecycle.Update] }, NameTemplate)\nmodel CreateOrUpdate<\n  T extends Reflection.Model,\n  NameTemplate extends valueof string = "CreateOrUpdate{name}"\n> {\n  ...T;\n}\n\n/**\n * A copy of the input model `T` with only the properties that are visible during the\n * "Delete" resource lifecycle phase.\n *\n * The "Delete" lifecycle phase is used for properties passed as parameters to operations\n * that delete data, like HTTP DELETE operations.\n *\n * This transformation is recursive, and will include only properties that have the\n * `Lifecycle.Delete` visibility modifier.\n *\n * If a `NameTemplate` is provided, the new model will be named according to the template.\n * The template uses the same syntax as the `@friendlyName` decorator.\n *\n * @template T The model to transform.\n * @template NameTemplate The name template to use for the new model.\n *\n *  * @example\n * ```typespec\n * model Dog {\n *   @visibility(Lifecycle.Read)\n *   id: int32;\n *\n *   // Set when the Dog is removed from our data store. This happens when the\n *   // Dog is re-homed to a new owner.\n *   @visibility(Lifecycle.Delete)\n *   nextOwner: string;\n *\n *   name: string;\n * }\n *\n * // This model will have the `nextOwner` and `name` fields, but not the `id` field.\n * model DeleteDog is Delete<Dog>;\n * ```\n */\n@doc("")\n@friendlyName(NameTemplate, T)\n@withVisibilityFilter(#{ all: #[Lifecycle.Delete] }, NameTemplate)\nmodel Delete<T extends Reflection.Model, NameTemplate extends valueof string = "Delete{name}"> {\n  ...T;\n}\n\n/**\n * A copy of the input model `T` with only the properties that are visible during the\n * "Query" resource lifecycle phase.\n *\n * The "Query" lifecycle phase is used for properties passed as parameters to operations\n * that read data, like HTTP GET or HEAD operations. This should not be confused for\n * the `@query` decorator, which specifies that the property is transmitted in the\n * query string of an HTTP request.\n *\n * This transformation is recursive, and will include only properties that have the\n * `Lifecycle.Query` visibility modifier.\n *\n * If a `NameTemplate` is provided, the new model will be named according to the template.\n * The template uses the same syntax as the `@friendlyName` decorator.\n *\n * @template T The model to transform.\n * @template NameTemplate The name template to use for the new model.\n *\n *  * @example\n * ```typespec\n * model Dog {\n *   @visibility(Lifecycle.Read)\n *   id: int32;\n *\n *   // When getting information for a Dog, you can set this field to true to include\n *   // some extra information about the Dog\'s pedigree that is normally not returned.\n *   // Alternatively, you could just use a separate option parameter to get this\n *   // information.\n *   @visibility(Lifecycle.Query)\n *   includePedigree?: boolean;\n *\n *   name: string;\n *\n *   // Only included if `includePedigree` is set to true in the request.\n *   @visibility(Lifecycle.Read)\n *   pedigree?: string;\n * }\n *\n * // This model will have the `includePedigree` and `name` fields, but not `id` or `pedigree`.\n * model QueryDog is Query<Dog>;\n * ```\n */\n@doc("")\n@friendlyName(NameTemplate, T)\n@withVisibilityFilter(#{ all: #[Lifecycle.Query] }, NameTemplate)\nmodel Query<T extends Reflection.Model, NameTemplate extends valueof string = "Query{name}"> {\n  ...T;\n}\n',
  "lib/main.tsp": 'import "./decorators.tsp";\n',
  "lib/decorators.tsp": 'import "../dist/src/tsp-index.js";\n\nnamespace TypeSpec.OpenAPI;\n\nusing TypeSpec.Reflection;\n\n/**\n * Specify that `oneOf` should be used instead of `anyOf` for that union.\n */\nextern dec oneOf(target: Union | ModelProperty);\n/**\n * Specify an external reference that should be used inside of emitting this type.\n * @param ref External reference(e.g. "../../common.json#/components/schemas/Foo")\n */\nextern dec useRef(target: Model | ModelProperty, ref: valueof string);\n'
};
var _TypeSpecLibrary_ = {
  jsSourceFiles: TypeSpecJSSources,
  typespecSourceFiles: TypeSpecSources
};
export {
  $decorators,
  $lib,
  $onEmit,
  $oneOf,
  $useRef,
  _TypeSpecLibrary_,
  convertOpenAPI3Document,
  getOneOf,
  getOpenAPI3,
  getRef,
  namespace,
  resolveOptions
};
