var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __esm = (fn, res) => function __init() {
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
};
var __commonJS = (cb, mod) => function __require() {
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
  for (var name2 in all)
    __defProp(target, name2, { get: all[name2], enumerable: true });
};
var __copyProps = (to, from3, except, desc) => {
  if (from3 && typeof from3 === "object" || typeof from3 === "function") {
    for (let key of __getOwnPropNames(from3))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from3[key], enumerable: !(desc = __getOwnPropDesc(from3, key)) || desc.enumerable });
  }
  return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
  // If the importer is in node compatibility mode or this is not an ESM
  // file that has been converted to a CommonJS file using a Babel-
  // compatible transform (i.e. "__esModule" has not been set), then set
  // "default" to the CommonJS "module.exports" for node compatibility.
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
  mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// node_modules/zod/v3/helpers/util.cjs
var require_util = __commonJS({
  "node_modules/zod/v3/helpers/util.cjs"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.getParsedType = exports.ZodParsedType = exports.objectUtil = exports.util = void 0;
    var util;
    (function(util2) {
      util2.assertEqual = (_) => {
      };
      function assertIs(_arg) {
      }
      util2.assertIs = assertIs;
      function assertNever(_x) {
        throw new Error();
      }
      util2.assertNever = assertNever;
      util2.arrayToEnum = (items) => {
        const obj = {};
        for (const item of items) {
          obj[item] = item;
        }
        return obj;
      };
      util2.getValidEnumValues = (obj) => {
        const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
        const filtered = {};
        for (const k of validKeys) {
          filtered[k] = obj[k];
        }
        return util2.objectValues(filtered);
      };
      util2.objectValues = (obj) => {
        return util2.objectKeys(obj).map(function(e) {
          return obj[e];
        });
      };
      util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
        const keys = [];
        for (const key in object) {
          if (Object.prototype.hasOwnProperty.call(object, key)) {
            keys.push(key);
          }
        }
        return keys;
      };
      util2.find = (arr, checker) => {
        for (const item of arr) {
          if (checker(item))
            return item;
        }
        return void 0;
      };
      util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
      function joinValues(array, separator = " | ") {
        return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
      }
      util2.joinValues = joinValues;
      util2.jsonStringifyReplacer = (_, value) => {
        if (typeof value === "bigint") {
          return value.toString();
        }
        return value;
      };
    })(util || (exports.util = util = {}));
    var objectUtil;
    (function(objectUtil2) {
      objectUtil2.mergeShapes = (first, second) => {
        return {
          ...first,
          ...second
          // second overwrites first
        };
      };
    })(objectUtil || (exports.objectUtil = objectUtil = {}));
    exports.ZodParsedType = util.arrayToEnum([
      "string",
      "nan",
      "number",
      "integer",
      "float",
      "boolean",
      "date",
      "bigint",
      "symbol",
      "function",
      "undefined",
      "null",
      "array",
      "object",
      "unknown",
      "promise",
      "void",
      "never",
      "map",
      "set"
    ]);
    var getParsedType = (data) => {
      const t = typeof data;
      switch (t) {
        case "undefined":
          return exports.ZodParsedType.undefined;
        case "string":
          return exports.ZodParsedType.string;
        case "number":
          return Number.isNaN(data) ? exports.ZodParsedType.nan : exports.ZodParsedType.number;
        case "boolean":
          return exports.ZodParsedType.boolean;
        case "function":
          return exports.ZodParsedType.function;
        case "bigint":
          return exports.ZodParsedType.bigint;
        case "symbol":
          return exports.ZodParsedType.symbol;
        case "object":
          if (Array.isArray(data)) {
            return exports.ZodParsedType.array;
          }
          if (data === null) {
            return exports.ZodParsedType.null;
          }
          if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
            return exports.ZodParsedType.promise;
          }
          if (typeof Map !== "undefined" && data instanceof Map) {
            return exports.ZodParsedType.map;
          }
          if (typeof Set !== "undefined" && data instanceof Set) {
            return exports.ZodParsedType.set;
          }
          if (typeof Date !== "undefined" && data instanceof Date) {
            return exports.ZodParsedType.date;
          }
          return exports.ZodParsedType.object;
        default:
          return exports.ZodParsedType.unknown;
      }
    };
    exports.getParsedType = getParsedType;
  }
});

// node_modules/zod/v3/ZodError.cjs
var require_ZodError = __commonJS({
  "node_modules/zod/v3/ZodError.cjs"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;
    var util_js_1 = require_util();
    exports.ZodIssueCode = util_js_1.util.arrayToEnum([
      "invalid_type",
      "invalid_literal",
      "custom",
      "invalid_union",
      "invalid_union_discriminator",
      "invalid_enum_value",
      "unrecognized_keys",
      "invalid_arguments",
      "invalid_return_type",
      "invalid_date",
      "invalid_string",
      "too_small",
      "too_big",
      "invalid_intersection_types",
      "not_multiple_of",
      "not_finite"
    ]);
    var quotelessJson = (obj) => {
      const json = JSON.stringify(obj, null, 2);
      return json.replace(/"([^"]+)":/g, "$1:");
    };
    exports.quotelessJson = quotelessJson;
    var ZodError = class _ZodError extends Error {
      get errors() {
        return this.issues;
      }
      constructor(issues) {
        super();
        this.issues = [];
        this.addIssue = (sub) => {
          this.issues = [...this.issues, sub];
        };
        this.addIssues = (subs = []) => {
          this.issues = [...this.issues, ...subs];
        };
        const actualProto = new.target.prototype;
        if (Object.setPrototypeOf) {
          Object.setPrototypeOf(this, actualProto);
        } else {
          this.__proto__ = actualProto;
        }
        this.name = "ZodError";
        this.issues = issues;
      }
      format(_mapper) {
        const mapper = _mapper || function(issue) {
          return issue.message;
        };
        const fieldErrors = { _errors: [] };
        const processError = (error) => {
          for (const issue of error.issues) {
            if (issue.code === "invalid_union") {
              issue.unionErrors.map(processError);
            } else if (issue.code === "invalid_return_type") {
              processError(issue.returnTypeError);
            } else if (issue.code === "invalid_arguments") {
              processError(issue.argumentsError);
            } else if (issue.path.length === 0) {
              fieldErrors._errors.push(mapper(issue));
            } else {
              let curr = fieldErrors;
              let i = 0;
              while (i < issue.path.length) {
                const el = issue.path[i];
                const terminal = i === issue.path.length - 1;
                if (!terminal) {
                  curr[el] = curr[el] || { _errors: [] };
                } else {
                  curr[el] = curr[el] || { _errors: [] };
                  curr[el]._errors.push(mapper(issue));
                }
                curr = curr[el];
                i++;
              }
            }
          }
        };
        processError(this);
        return fieldErrors;
      }
      static assert(value) {
        if (!(value instanceof _ZodError)) {
          throw new Error(`Not a ZodError: ${value}`);
        }
      }
      toString() {
        return this.message;
      }
      get message() {
        return JSON.stringify(this.issues, util_js_1.util.jsonStringifyReplacer, 2);
      }
      get isEmpty() {
        return this.issues.length === 0;
      }
      flatten(mapper = (issue) => issue.message) {
        const fieldErrors = {};
        const formErrors = [];
        for (const sub of this.issues) {
          if (sub.path.length > 0) {
            const firstEl = sub.path[0];
            fieldErrors[firstEl] = fieldErrors[firstEl] || [];
            fieldErrors[firstEl].push(mapper(sub));
          } else {
            formErrors.push(mapper(sub));
          }
        }
        return { formErrors, fieldErrors };
      }
      get formErrors() {
        return this.flatten();
      }
    };
    exports.ZodError = ZodError;
    ZodError.create = (issues) => {
      const error = new ZodError(issues);
      return error;
    };
  }
});

// node_modules/zod/v3/locales/en.cjs
var require_en = __commonJS({
  "node_modules/zod/v3/locales/en.cjs"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var ZodError_js_1 = require_ZodError();
    var util_js_1 = require_util();
    var errorMap = (issue, _ctx) => {
      let message2;
      switch (issue.code) {
        case ZodError_js_1.ZodIssueCode.invalid_type:
          if (issue.received === util_js_1.ZodParsedType.undefined) {
            message2 = "Required";
          } else {
            message2 = `Expected ${issue.expected}, received ${issue.received}`;
          }
          break;
        case ZodError_js_1.ZodIssueCode.invalid_literal:
          message2 = `Invalid literal value, expected ${JSON.stringify(issue.expected, util_js_1.util.jsonStringifyReplacer)}`;
          break;
        case ZodError_js_1.ZodIssueCode.unrecognized_keys:
          message2 = `Unrecognized key(s) in object: ${util_js_1.util.joinValues(issue.keys, ", ")}`;
          break;
        case ZodError_js_1.ZodIssueCode.invalid_union:
          message2 = `Invalid input`;
          break;
        case ZodError_js_1.ZodIssueCode.invalid_union_discriminator:
          message2 = `Invalid discriminator value. Expected ${util_js_1.util.joinValues(issue.options)}`;
          break;
        case ZodError_js_1.ZodIssueCode.invalid_enum_value:
          message2 = `Invalid enum value. Expected ${util_js_1.util.joinValues(issue.options)}, received '${issue.received}'`;
          break;
        case ZodError_js_1.ZodIssueCode.invalid_arguments:
          message2 = `Invalid function arguments`;
          break;
        case ZodError_js_1.ZodIssueCode.invalid_return_type:
          message2 = `Invalid function return type`;
          break;
        case ZodError_js_1.ZodIssueCode.invalid_date:
          message2 = `Invalid date`;
          break;
        case ZodError_js_1.ZodIssueCode.invalid_string:
          if (typeof issue.validation === "object") {
            if ("includes" in issue.validation) {
              message2 = `Invalid input: must include "${issue.validation.includes}"`;
              if (typeof issue.validation.position === "number") {
                message2 = `${message2} at one or more positions greater than or equal to ${issue.validation.position}`;
              }
            } else if ("startsWith" in issue.validation) {
              message2 = `Invalid input: must start with "${issue.validation.startsWith}"`;
            } else if ("endsWith" in issue.validation) {
              message2 = `Invalid input: must end with "${issue.validation.endsWith}"`;
            } else {
              util_js_1.util.assertNever(issue.validation);
            }
          } else if (issue.validation !== "regex") {
            message2 = `Invalid ${issue.validation}`;
          } else {
            message2 = "Invalid";
          }
          break;
        case ZodError_js_1.ZodIssueCode.too_small:
          if (issue.type === "array")
            message2 = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
          else if (issue.type === "string")
            message2 = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
          else if (issue.type === "number")
            message2 = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
          else if (issue.type === "bigint")
            message2 = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
          else if (issue.type === "date")
            message2 = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
          else
            message2 = "Invalid input";
          break;
        case ZodError_js_1.ZodIssueCode.too_big:
          if (issue.type === "array")
            message2 = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
          else if (issue.type === "string")
            message2 = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
          else if (issue.type === "number")
            message2 = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
          else if (issue.type === "bigint")
            message2 = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
          else if (issue.type === "date")
            message2 = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
          else
            message2 = "Invalid input";
          break;
        case ZodError_js_1.ZodIssueCode.custom:
          message2 = `Invalid input`;
          break;
        case ZodError_js_1.ZodIssueCode.invalid_intersection_types:
          message2 = `Intersection results could not be merged`;
          break;
        case ZodError_js_1.ZodIssueCode.not_multiple_of:
          message2 = `Number must be a multiple of ${issue.multipleOf}`;
          break;
        case ZodError_js_1.ZodIssueCode.not_finite:
          message2 = "Number must be finite";
          break;
        default:
          message2 = _ctx.defaultError;
          util_js_1.util.assertNever(issue);
      }
      return { message: message2 };
    };
    exports.default = errorMap;
  }
});

// node_modules/zod/v3/errors.cjs
var require_errors = __commonJS({
  "node_modules/zod/v3/errors.cjs"(exports) {
    "use strict";
    var __importDefault2 = exports && exports.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.defaultErrorMap = void 0;
    exports.setErrorMap = setErrorMap;
    exports.getErrorMap = getErrorMap;
    var en_js_1 = __importDefault2(require_en());
    exports.defaultErrorMap = en_js_1.default;
    var overrideErrorMap = en_js_1.default;
    function setErrorMap(map) {
      overrideErrorMap = map;
    }
    function getErrorMap() {
      return overrideErrorMap;
    }
  }
});

// node_modules/zod/v3/helpers/parseUtil.cjs
var require_parseUtil = __commonJS({
  "node_modules/zod/v3/helpers/parseUtil.cjs"(exports) {
    "use strict";
    var __importDefault2 = exports && exports.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.EMPTY_PATH = exports.makeIssue = void 0;
    exports.addIssueToContext = addIssueToContext;
    var errors_js_1 = require_errors();
    var en_js_1 = __importDefault2(require_en());
    var makeIssue = (params) => {
      const { data, path, errorMaps, issueData } = params;
      const fullPath = [...path, ...issueData.path || []];
      const fullIssue = {
        ...issueData,
        path: fullPath
      };
      if (issueData.message !== void 0) {
        return {
          ...issueData,
          path: fullPath,
          message: issueData.message
        };
      }
      let errorMessage = "";
      const maps = errorMaps.filter((m) => !!m).slice().reverse();
      for (const map of maps) {
        errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
      }
      return {
        ...issueData,
        path: fullPath,
        message: errorMessage
      };
    };
    exports.makeIssue = makeIssue;
    exports.EMPTY_PATH = [];
    function addIssueToContext(ctx, issueData) {
      const overrideMap = (0, errors_js_1.getErrorMap)();
      const issue = (0, exports.makeIssue)({
        issueData,
        data: ctx.data,
        path: ctx.path,
        errorMaps: [
          ctx.common.contextualErrorMap,
          // contextual error map is first priority
          ctx.schemaErrorMap,
          // then schema-bound map if available
          overrideMap,
          // then global override map
          overrideMap === en_js_1.default ? void 0 : en_js_1.default
          // then global default map
        ].filter((x) => !!x)
      });
      ctx.common.issues.push(issue);
    }
    var ParseStatus = class _ParseStatus {
      constructor() {
        this.value = "valid";
      }
      dirty() {
        if (this.value === "valid")
          this.value = "dirty";
      }
      abort() {
        if (this.value !== "aborted")
          this.value = "aborted";
      }
      static mergeArray(status, results) {
        const arrayValue = [];
        for (const s of results) {
          if (s.status === "aborted")
            return exports.INVALID;
          if (s.status === "dirty")
            status.dirty();
          arrayValue.push(s.value);
        }
        return { status: status.value, value: arrayValue };
      }
      static async mergeObjectAsync(status, pairs) {
        const syncPairs = [];
        for (const pair of pairs) {
          const key = await pair.key;
          const value = await pair.value;
          syncPairs.push({
            key,
            value
          });
        }
        return _ParseStatus.mergeObjectSync(status, syncPairs);
      }
      static mergeObjectSync(status, pairs) {
        const finalObject = {};
        for (const pair of pairs) {
          const { key, value } = pair;
          if (key.status === "aborted")
            return exports.INVALID;
          if (value.status === "aborted")
            return exports.INVALID;
          if (key.status === "dirty")
            status.dirty();
          if (value.status === "dirty")
            status.dirty();
          if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
            finalObject[key.value] = value.value;
          }
        }
        return { status: status.value, value: finalObject };
      }
    };
    exports.ParseStatus = ParseStatus;
    exports.INVALID = Object.freeze({
      status: "aborted"
    });
    var DIRTY = (value) => ({ status: "dirty", value });
    exports.DIRTY = DIRTY;
    var OK = (value) => ({ status: "valid", value });
    exports.OK = OK;
    var isAborted = (x) => x.status === "aborted";
    exports.isAborted = isAborted;
    var isDirty = (x) => x.status === "dirty";
    exports.isDirty = isDirty;
    var isValid = (x) => x.status === "valid";
    exports.isValid = isValid;
    var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
    exports.isAsync = isAsync;
  }
});

// node_modules/zod/v3/helpers/typeAliases.cjs
var require_typeAliases = __commonJS({
  "node_modules/zod/v3/helpers/typeAliases.cjs"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/zod/v3/helpers/errorUtil.cjs
var require_errorUtil = __commonJS({
  "node_modules/zod/v3/helpers/errorUtil.cjs"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.errorUtil = void 0;
    var errorUtil;
    (function(errorUtil2) {
      errorUtil2.errToObj = (message2) => typeof message2 === "string" ? { message: message2 } : message2 || {};
      errorUtil2.toString = (message2) => typeof message2 === "string" ? message2 : message2?.message;
    })(errorUtil || (exports.errorUtil = errorUtil = {}));
  }
});

// node_modules/zod/v3/types.cjs
var require_types = __commonJS({
  "node_modules/zod/v3/types.cjs"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.discriminatedUnion = exports.date = exports.boolean = exports.bigint = exports.array = exports.any = exports.coerce = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.ZodReadonly = exports.ZodPipeline = exports.ZodBranded = exports.BRAND = exports.ZodNaN = exports.ZodCatch = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodEffects = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.ZodType = void 0;
    exports.NEVER = exports.void = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports.null = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports.instanceof = exports.function = exports.enum = exports.effect = void 0;
    exports.datetimeRegex = datetimeRegex;
    exports.custom = custom;
    var ZodError_js_1 = require_ZodError();
    var errors_js_1 = require_errors();
    var errorUtil_js_1 = require_errorUtil();
    var parseUtil_js_1 = require_parseUtil();
    var util_js_1 = require_util();
    var ParseInputLazyPath = class {
      constructor(parent, value, path, key) {
        this._cachedPath = [];
        this.parent = parent;
        this.data = value;
        this._path = path;
        this._key = key;
      }
      get path() {
        if (!this._cachedPath.length) {
          if (Array.isArray(this._key)) {
            this._cachedPath.push(...this._path, ...this._key);
          } else {
            this._cachedPath.push(...this._path, this._key);
          }
        }
        return this._cachedPath;
      }
    };
    var handleResult = (ctx, result) => {
      if ((0, parseUtil_js_1.isValid)(result)) {
        return { success: true, data: result.value };
      } else {
        if (!ctx.common.issues.length) {
          throw new Error("Validation failed but no issues detected.");
        }
        return {
          success: false,
          get error() {
            if (this._error)
              return this._error;
            const error = new ZodError_js_1.ZodError(ctx.common.issues);
            this._error = error;
            return this._error;
          }
        };
      }
    };
    function processCreateParams(params) {
      if (!params)
        return {};
      const { errorMap, invalid_type_error, required_error, description } = params;
      if (errorMap && (invalid_type_error || required_error)) {
        throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
      }
      if (errorMap)
        return { errorMap, description };
      const customMap = (iss, ctx) => {
        const { message: message2 } = params;
        if (iss.code === "invalid_enum_value") {
          return { message: message2 ?? ctx.defaultError };
        }
        if (typeof ctx.data === "undefined") {
          return { message: message2 ?? required_error ?? ctx.defaultError };
        }
        if (iss.code !== "invalid_type")
          return { message: ctx.defaultError };
        return { message: message2 ?? invalid_type_error ?? ctx.defaultError };
      };
      return { errorMap: customMap, description };
    }
    var ZodType = class {
      get description() {
        return this._def.description;
      }
      _getType(input) {
        return (0, util_js_1.getParsedType)(input.data);
      }
      _getOrReturnCtx(input, ctx) {
        return ctx || {
          common: input.parent.common,
          data: input.data,
          parsedType: (0, util_js_1.getParsedType)(input.data),
          schemaErrorMap: this._def.errorMap,
          path: input.path,
          parent: input.parent
        };
      }
      _processInputParams(input) {
        return {
          status: new parseUtil_js_1.ParseStatus(),
          ctx: {
            common: input.parent.common,
            data: input.data,
            parsedType: (0, util_js_1.getParsedType)(input.data),
            schemaErrorMap: this._def.errorMap,
            path: input.path,
            parent: input.parent
          }
        };
      }
      _parseSync(input) {
        const result = this._parse(input);
        if ((0, parseUtil_js_1.isAsync)(result)) {
          throw new Error("Synchronous parse encountered promise.");
        }
        return result;
      }
      _parseAsync(input) {
        const result = this._parse(input);
        return Promise.resolve(result);
      }
      parse(data, params) {
        const result = this.safeParse(data, params);
        if (result.success)
          return result.data;
        throw result.error;
      }
      safeParse(data, params) {
        const ctx = {
          common: {
            issues: [],
            async: params?.async ?? false,
            contextualErrorMap: params?.errorMap
          },
          path: params?.path || [],
          schemaErrorMap: this._def.errorMap,
          parent: null,
          data,
          parsedType: (0, util_js_1.getParsedType)(data)
        };
        const result = this._parseSync({ data, path: ctx.path, parent: ctx });
        return handleResult(ctx, result);
      }
      "~validate"(data) {
        const ctx = {
          common: {
            issues: [],
            async: !!this["~standard"].async
          },
          path: [],
          schemaErrorMap: this._def.errorMap,
          parent: null,
          data,
          parsedType: (0, util_js_1.getParsedType)(data)
        };
        if (!this["~standard"].async) {
          try {
            const result = this._parseSync({ data, path: [], parent: ctx });
            return (0, parseUtil_js_1.isValid)(result) ? {
              value: result.value
            } : {
              issues: ctx.common.issues
            };
          } catch (err) {
            if (err?.message?.toLowerCase()?.includes("encountered")) {
              this["~standard"].async = true;
            }
            ctx.common = {
              issues: [],
              async: true
            };
          }
        }
        return this._parseAsync({ data, path: [], parent: ctx }).then((result) => (0, parseUtil_js_1.isValid)(result) ? {
          value: result.value
        } : {
          issues: ctx.common.issues
        });
      }
      async parseAsync(data, params) {
        const result = await this.safeParseAsync(data, params);
        if (result.success)
          return result.data;
        throw result.error;
      }
      async safeParseAsync(data, params) {
        const ctx = {
          common: {
            issues: [],
            contextualErrorMap: params?.errorMap,
            async: true
          },
          path: params?.path || [],
          schemaErrorMap: this._def.errorMap,
          parent: null,
          data,
          parsedType: (0, util_js_1.getParsedType)(data)
        };
        const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
        const result = await ((0, parseUtil_js_1.isAsync)(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
        return handleResult(ctx, result);
      }
      refine(check2, message2) {
        const getIssueProperties = (val) => {
          if (typeof message2 === "string" || typeof message2 === "undefined") {
            return { message: message2 };
          } else if (typeof message2 === "function") {
            return message2(val);
          } else {
            return message2;
          }
        };
        return this._refinement((val, ctx) => {
          const result = check2(val);
          const setError = () => ctx.addIssue({
            code: ZodError_js_1.ZodIssueCode.custom,
            ...getIssueProperties(val)
          });
          if (typeof Promise !== "undefined" && result instanceof Promise) {
            return result.then((data) => {
              if (!data) {
                setError();
                return false;
              } else {
                return true;
              }
            });
          }
          if (!result) {
            setError();
            return false;
          } else {
            return true;
          }
        });
      }
      refinement(check2, refinementData) {
        return this._refinement((val, ctx) => {
          if (!check2(val)) {
            ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
            return false;
          } else {
            return true;
          }
        });
      }
      _refinement(refinement) {
        return new ZodEffects({
          schema: this,
          typeName: ZodFirstPartyTypeKind.ZodEffects,
          effect: { type: "refinement", refinement }
        });
      }
      superRefine(refinement) {
        return this._refinement(refinement);
      }
      constructor(def) {
        this.spa = this.safeParseAsync;
        this._def = def;
        this.parse = this.parse.bind(this);
        this.safeParse = this.safeParse.bind(this);
        this.parseAsync = this.parseAsync.bind(this);
        this.safeParseAsync = this.safeParseAsync.bind(this);
        this.spa = this.spa.bind(this);
        this.refine = this.refine.bind(this);
        this.refinement = this.refinement.bind(this);
        this.superRefine = this.superRefine.bind(this);
        this.optional = this.optional.bind(this);
        this.nullable = this.nullable.bind(this);
        this.nullish = this.nullish.bind(this);
        this.array = this.array.bind(this);
        this.promise = this.promise.bind(this);
        this.or = this.or.bind(this);
        this.and = this.and.bind(this);
        this.transform = this.transform.bind(this);
        this.brand = this.brand.bind(this);
        this.default = this.default.bind(this);
        this.catch = this.catch.bind(this);
        this.describe = this.describe.bind(this);
        this.pipe = this.pipe.bind(this);
        this.readonly = this.readonly.bind(this);
        this.isNullable = this.isNullable.bind(this);
        this.isOptional = this.isOptional.bind(this);
        this["~standard"] = {
          version: 1,
          vendor: "zod",
          validate: (data) => this["~validate"](data)
        };
      }
      optional() {
        return ZodOptional.create(this, this._def);
      }
      nullable() {
        return ZodNullable.create(this, this._def);
      }
      nullish() {
        return this.nullable().optional();
      }
      array() {
        return ZodArray.create(this);
      }
      promise() {
        return ZodPromise.create(this, this._def);
      }
      or(option) {
        return ZodUnion.create([this, option], this._def);
      }
      and(incoming) {
        return ZodIntersection.create(this, incoming, this._def);
      }
      transform(transform) {
        return new ZodEffects({
          ...processCreateParams(this._def),
          schema: this,
          typeName: ZodFirstPartyTypeKind.ZodEffects,
          effect: { type: "transform", transform }
        });
      }
      default(def) {
        const defaultValueFunc = typeof def === "function" ? def : () => def;
        return new ZodDefault({
          ...processCreateParams(this._def),
          innerType: this,
          defaultValue: defaultValueFunc,
          typeName: ZodFirstPartyTypeKind.ZodDefault
        });
      }
      brand() {
        return new ZodBranded({
          typeName: ZodFirstPartyTypeKind.ZodBranded,
          type: this,
          ...processCreateParams(this._def)
        });
      }
      catch(def) {
        const catchValueFunc = typeof def === "function" ? def : () => def;
        return new ZodCatch({
          ...processCreateParams(this._def),
          innerType: this,
          catchValue: catchValueFunc,
          typeName: ZodFirstPartyTypeKind.ZodCatch
        });
      }
      describe(description) {
        const This = this.constructor;
        return new This({
          ...this._def,
          description
        });
      }
      pipe(target) {
        return ZodPipeline.create(this, target);
      }
      readonly() {
        return ZodReadonly.create(this);
      }
      isOptional() {
        return this.safeParse(void 0).success;
      }
      isNullable() {
        return this.safeParse(null).success;
      }
    };
    exports.ZodType = ZodType;
    exports.Schema = ZodType;
    exports.ZodSchema = ZodType;
    var cuidRegex = /^c[^\s-]{8,}$/i;
    var cuid2Regex = /^[0-9a-z]+$/;
    var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
    var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
    var nanoidRegex = /^[a-z0-9_-]{21}$/i;
    var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
    var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
    var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
    var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
    var emojiRegex;
    var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
    var ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
    var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
    var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
    var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
    var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
    var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
    var dateRegex = new RegExp(`^${dateRegexSource}$`);
    function timeRegexSource(args) {
      let secondsRegexSource = `[0-5]\\d`;
      if (args.precision) {
        secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
      } else if (args.precision == null) {
        secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
      }
      const secondsQuantifier = args.precision ? "+" : "?";
      return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
    }
    function timeRegex(args) {
      return new RegExp(`^${timeRegexSource(args)}$`);
    }
    function datetimeRegex(args) {
      let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
      const opts = [];
      opts.push(args.local ? `Z?` : `Z`);
      if (args.offset)
        opts.push(`([+-]\\d{2}:?\\d{2})`);
      regex = `${regex}(${opts.join("|")})`;
      return new RegExp(`^${regex}$`);
    }
    function isValidIP(ip, version2) {
      if ((version2 === "v4" || !version2) && ipv4Regex.test(ip)) {
        return true;
      }
      if ((version2 === "v6" || !version2) && ipv6Regex.test(ip)) {
        return true;
      }
      return false;
    }
    function isValidJWT(jwt, alg) {
      if (!jwtRegex.test(jwt))
        return false;
      try {
        const [header] = jwt.split(".");
        if (!header)
          return false;
        const base642 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
        const decoded = JSON.parse(atob(base642));
        if (typeof decoded !== "object" || decoded === null)
          return false;
        if ("typ" in decoded && decoded?.typ !== "JWT")
          return false;
        if (!decoded.alg)
          return false;
        if (alg && decoded.alg !== alg)
          return false;
        return true;
      } catch {
        return false;
      }
    }
    function isValidCidr(ip, version2) {
      if ((version2 === "v4" || !version2) && ipv4CidrRegex.test(ip)) {
        return true;
      }
      if ((version2 === "v6" || !version2) && ipv6CidrRegex.test(ip)) {
        return true;
      }
      return false;
    }
    var ZodString = class _ZodString extends ZodType {
      _parse(input) {
        if (this._def.coerce) {
          input.data = String(input.data);
        }
        const parsedType = this._getType(input);
        if (parsedType !== util_js_1.ZodParsedType.string) {
          const ctx2 = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx2, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.string,
            received: ctx2.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        const status = new parseUtil_js_1.ParseStatus();
        let ctx = void 0;
        for (const check2 of this._def.checks) {
          if (check2.kind === "min") {
            if (input.data.length < check2.value) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.too_small,
                minimum: check2.value,
                type: "string",
                inclusive: true,
                exact: false,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "max") {
            if (input.data.length > check2.value) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.too_big,
                maximum: check2.value,
                type: "string",
                inclusive: true,
                exact: false,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "length") {
            const tooBig = input.data.length > check2.value;
            const tooSmall = input.data.length < check2.value;
            if (tooBig || tooSmall) {
              ctx = this._getOrReturnCtx(input, ctx);
              if (tooBig) {
                (0, parseUtil_js_1.addIssueToContext)(ctx, {
                  code: ZodError_js_1.ZodIssueCode.too_big,
                  maximum: check2.value,
                  type: "string",
                  inclusive: true,
                  exact: true,
                  message: check2.message
                });
              } else if (tooSmall) {
                (0, parseUtil_js_1.addIssueToContext)(ctx, {
                  code: ZodError_js_1.ZodIssueCode.too_small,
                  minimum: check2.value,
                  type: "string",
                  inclusive: true,
                  exact: true,
                  message: check2.message
                });
              }
              status.dirty();
            }
          } else if (check2.kind === "email") {
            if (!emailRegex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "email",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "emoji") {
            if (!emojiRegex) {
              emojiRegex = new RegExp(_emojiRegex, "u");
            }
            if (!emojiRegex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "emoji",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "uuid") {
            if (!uuidRegex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "uuid",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "nanoid") {
            if (!nanoidRegex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "nanoid",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "cuid") {
            if (!cuidRegex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "cuid",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "cuid2") {
            if (!cuid2Regex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "cuid2",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "ulid") {
            if (!ulidRegex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "ulid",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "url") {
            try {
              new URL(input.data);
            } catch {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "url",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "regex") {
            check2.regex.lastIndex = 0;
            const testResult = check2.regex.test(input.data);
            if (!testResult) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "regex",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "trim") {
            input.data = input.data.trim();
          } else if (check2.kind === "includes") {
            if (!input.data.includes(check2.value, check2.position)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                validation: { includes: check2.value, position: check2.position },
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "toLowerCase") {
            input.data = input.data.toLowerCase();
          } else if (check2.kind === "toUpperCase") {
            input.data = input.data.toUpperCase();
          } else if (check2.kind === "startsWith") {
            if (!input.data.startsWith(check2.value)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                validation: { startsWith: check2.value },
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "endsWith") {
            if (!input.data.endsWith(check2.value)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                validation: { endsWith: check2.value },
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "datetime") {
            const regex = datetimeRegex(check2);
            if (!regex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                validation: "datetime",
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "date") {
            const regex = dateRegex;
            if (!regex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                validation: "date",
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "time") {
            const regex = timeRegex(check2);
            if (!regex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                validation: "time",
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "duration") {
            if (!durationRegex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "duration",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "ip") {
            if (!isValidIP(input.data, check2.version)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "ip",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "jwt") {
            if (!isValidJWT(input.data, check2.alg)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "jwt",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "cidr") {
            if (!isValidCidr(input.data, check2.version)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "cidr",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "base64") {
            if (!base64Regex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "base64",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "base64url") {
            if (!base64urlRegex.test(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                validation: "base64url",
                code: ZodError_js_1.ZodIssueCode.invalid_string,
                message: check2.message
              });
              status.dirty();
            }
          } else {
            util_js_1.util.assertNever(check2);
          }
        }
        return { status: status.value, value: input.data };
      }
      _regex(regex, validation, message2) {
        return this.refinement((data) => regex.test(data), {
          validation,
          code: ZodError_js_1.ZodIssueCode.invalid_string,
          ...errorUtil_js_1.errorUtil.errToObj(message2)
        });
      }
      _addCheck(check2) {
        return new _ZodString({
          ...this._def,
          checks: [...this._def.checks, check2]
        });
      }
      email(message2) {
        return this._addCheck({ kind: "email", ...errorUtil_js_1.errorUtil.errToObj(message2) });
      }
      url(message2) {
        return this._addCheck({ kind: "url", ...errorUtil_js_1.errorUtil.errToObj(message2) });
      }
      emoji(message2) {
        return this._addCheck({ kind: "emoji", ...errorUtil_js_1.errorUtil.errToObj(message2) });
      }
      uuid(message2) {
        return this._addCheck({ kind: "uuid", ...errorUtil_js_1.errorUtil.errToObj(message2) });
      }
      nanoid(message2) {
        return this._addCheck({ kind: "nanoid", ...errorUtil_js_1.errorUtil.errToObj(message2) });
      }
      cuid(message2) {
        return this._addCheck({ kind: "cuid", ...errorUtil_js_1.errorUtil.errToObj(message2) });
      }
      cuid2(message2) {
        return this._addCheck({ kind: "cuid2", ...errorUtil_js_1.errorUtil.errToObj(message2) });
      }
      ulid(message2) {
        return this._addCheck({ kind: "ulid", ...errorUtil_js_1.errorUtil.errToObj(message2) });
      }
      base64(message2) {
        return this._addCheck({ kind: "base64", ...errorUtil_js_1.errorUtil.errToObj(message2) });
      }
      base64url(message2) {
        return this._addCheck({
          kind: "base64url",
          ...errorUtil_js_1.errorUtil.errToObj(message2)
        });
      }
      jwt(options) {
        return this._addCheck({ kind: "jwt", ...errorUtil_js_1.errorUtil.errToObj(options) });
      }
      ip(options) {
        return this._addCheck({ kind: "ip", ...errorUtil_js_1.errorUtil.errToObj(options) });
      }
      cidr(options) {
        return this._addCheck({ kind: "cidr", ...errorUtil_js_1.errorUtil.errToObj(options) });
      }
      datetime(options) {
        if (typeof options === "string") {
          return this._addCheck({
            kind: "datetime",
            precision: null,
            offset: false,
            local: false,
            message: options
          });
        }
        return this._addCheck({
          kind: "datetime",
          precision: typeof options?.precision === "undefined" ? null : options?.precision,
          offset: options?.offset ?? false,
          local: options?.local ?? false,
          ...errorUtil_js_1.errorUtil.errToObj(options?.message)
        });
      }
      date(message2) {
        return this._addCheck({ kind: "date", message: message2 });
      }
      time(options) {
        if (typeof options === "string") {
          return this._addCheck({
            kind: "time",
            precision: null,
            message: options
          });
        }
        return this._addCheck({
          kind: "time",
          precision: typeof options?.precision === "undefined" ? null : options?.precision,
          ...errorUtil_js_1.errorUtil.errToObj(options?.message)
        });
      }
      duration(message2) {
        return this._addCheck({ kind: "duration", ...errorUtil_js_1.errorUtil.errToObj(message2) });
      }
      regex(regex, message2) {
        return this._addCheck({
          kind: "regex",
          regex,
          ...errorUtil_js_1.errorUtil.errToObj(message2)
        });
      }
      includes(value, options) {
        return this._addCheck({
          kind: "includes",
          value,
          position: options?.position,
          ...errorUtil_js_1.errorUtil.errToObj(options?.message)
        });
      }
      startsWith(value, message2) {
        return this._addCheck({
          kind: "startsWith",
          value,
          ...errorUtil_js_1.errorUtil.errToObj(message2)
        });
      }
      endsWith(value, message2) {
        return this._addCheck({
          kind: "endsWith",
          value,
          ...errorUtil_js_1.errorUtil.errToObj(message2)
        });
      }
      min(minLength, message2) {
        return this._addCheck({
          kind: "min",
          value: minLength,
          ...errorUtil_js_1.errorUtil.errToObj(message2)
        });
      }
      max(maxLength, message2) {
        return this._addCheck({
          kind: "max",
          value: maxLength,
          ...errorUtil_js_1.errorUtil.errToObj(message2)
        });
      }
      length(len, message2) {
        return this._addCheck({
          kind: "length",
          value: len,
          ...errorUtil_js_1.errorUtil.errToObj(message2)
        });
      }
      /**
       * Equivalent to `.min(1)`
       */
      nonempty(message2) {
        return this.min(1, errorUtil_js_1.errorUtil.errToObj(message2));
      }
      trim() {
        return new _ZodString({
          ...this._def,
          checks: [...this._def.checks, { kind: "trim" }]
        });
      }
      toLowerCase() {
        return new _ZodString({
          ...this._def,
          checks: [...this._def.checks, { kind: "toLowerCase" }]
        });
      }
      toUpperCase() {
        return new _ZodString({
          ...this._def,
          checks: [...this._def.checks, { kind: "toUpperCase" }]
        });
      }
      get isDatetime() {
        return !!this._def.checks.find((ch) => ch.kind === "datetime");
      }
      get isDate() {
        return !!this._def.checks.find((ch) => ch.kind === "date");
      }
      get isTime() {
        return !!this._def.checks.find((ch) => ch.kind === "time");
      }
      get isDuration() {
        return !!this._def.checks.find((ch) => ch.kind === "duration");
      }
      get isEmail() {
        return !!this._def.checks.find((ch) => ch.kind === "email");
      }
      get isURL() {
        return !!this._def.checks.find((ch) => ch.kind === "url");
      }
      get isEmoji() {
        return !!this._def.checks.find((ch) => ch.kind === "emoji");
      }
      get isUUID() {
        return !!this._def.checks.find((ch) => ch.kind === "uuid");
      }
      get isNANOID() {
        return !!this._def.checks.find((ch) => ch.kind === "nanoid");
      }
      get isCUID() {
        return !!this._def.checks.find((ch) => ch.kind === "cuid");
      }
      get isCUID2() {
        return !!this._def.checks.find((ch) => ch.kind === "cuid2");
      }
      get isULID() {
        return !!this._def.checks.find((ch) => ch.kind === "ulid");
      }
      get isIP() {
        return !!this._def.checks.find((ch) => ch.kind === "ip");
      }
      get isCIDR() {
        return !!this._def.checks.find((ch) => ch.kind === "cidr");
      }
      get isBase64() {
        return !!this._def.checks.find((ch) => ch.kind === "base64");
      }
      get isBase64url() {
        return !!this._def.checks.find((ch) => ch.kind === "base64url");
      }
      get minLength() {
        let min = null;
        for (const ch of this._def.checks) {
          if (ch.kind === "min") {
            if (min === null || ch.value > min)
              min = ch.value;
          }
        }
        return min;
      }
      get maxLength() {
        let max = null;
        for (const ch of this._def.checks) {
          if (ch.kind === "max") {
            if (max === null || ch.value < max)
              max = ch.value;
          }
        }
        return max;
      }
    };
    exports.ZodString = ZodString;
    ZodString.create = (params) => {
      return new ZodString({
        checks: [],
        typeName: ZodFirstPartyTypeKind.ZodString,
        coerce: params?.coerce ?? false,
        ...processCreateParams(params)
      });
    };
    function floatSafeRemainder(val, step) {
      const valDecCount = (val.toString().split(".")[1] || "").length;
      const stepDecCount = (step.toString().split(".")[1] || "").length;
      const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
      const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
      const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
      return valInt % stepInt / 10 ** decCount;
    }
    var ZodNumber = class _ZodNumber extends ZodType {
      constructor() {
        super(...arguments);
        this.min = this.gte;
        this.max = this.lte;
        this.step = this.multipleOf;
      }
      _parse(input) {
        if (this._def.coerce) {
          input.data = Number(input.data);
        }
        const parsedType = this._getType(input);
        if (parsedType !== util_js_1.ZodParsedType.number) {
          const ctx2 = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx2, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.number,
            received: ctx2.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        let ctx = void 0;
        const status = new parseUtil_js_1.ParseStatus();
        for (const check2 of this._def.checks) {
          if (check2.kind === "int") {
            if (!util_js_1.util.isInteger(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.invalid_type,
                expected: "integer",
                received: "float",
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "min") {
            const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;
            if (tooSmall) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.too_small,
                minimum: check2.value,
                type: "number",
                inclusive: check2.inclusive,
                exact: false,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "max") {
            const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;
            if (tooBig) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.too_big,
                maximum: check2.value,
                type: "number",
                inclusive: check2.inclusive,
                exact: false,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "multipleOf") {
            if (floatSafeRemainder(input.data, check2.value) !== 0) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.not_multiple_of,
                multipleOf: check2.value,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "finite") {
            if (!Number.isFinite(input.data)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.not_finite,
                message: check2.message
              });
              status.dirty();
            }
          } else {
            util_js_1.util.assertNever(check2);
          }
        }
        return { status: status.value, value: input.data };
      }
      gte(value, message2) {
        return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message2));
      }
      gt(value, message2) {
        return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message2));
      }
      lte(value, message2) {
        return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message2));
      }
      lt(value, message2) {
        return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message2));
      }
      setLimit(kind, value, inclusive, message2) {
        return new _ZodNumber({
          ...this._def,
          checks: [
            ...this._def.checks,
            {
              kind,
              value,
              inclusive,
              message: errorUtil_js_1.errorUtil.toString(message2)
            }
          ]
        });
      }
      _addCheck(check2) {
        return new _ZodNumber({
          ...this._def,
          checks: [...this._def.checks, check2]
        });
      }
      int(message2) {
        return this._addCheck({
          kind: "int",
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      positive(message2) {
        return this._addCheck({
          kind: "min",
          value: 0,
          inclusive: false,
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      negative(message2) {
        return this._addCheck({
          kind: "max",
          value: 0,
          inclusive: false,
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      nonpositive(message2) {
        return this._addCheck({
          kind: "max",
          value: 0,
          inclusive: true,
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      nonnegative(message2) {
        return this._addCheck({
          kind: "min",
          value: 0,
          inclusive: true,
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      multipleOf(value, message2) {
        return this._addCheck({
          kind: "multipleOf",
          value,
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      finite(message2) {
        return this._addCheck({
          kind: "finite",
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      safe(message2) {
        return this._addCheck({
          kind: "min",
          inclusive: true,
          value: Number.MIN_SAFE_INTEGER,
          message: errorUtil_js_1.errorUtil.toString(message2)
        })._addCheck({
          kind: "max",
          inclusive: true,
          value: Number.MAX_SAFE_INTEGER,
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      get minValue() {
        let min = null;
        for (const ch of this._def.checks) {
          if (ch.kind === "min") {
            if (min === null || ch.value > min)
              min = ch.value;
          }
        }
        return min;
      }
      get maxValue() {
        let max = null;
        for (const ch of this._def.checks) {
          if (ch.kind === "max") {
            if (max === null || ch.value < max)
              max = ch.value;
          }
        }
        return max;
      }
      get isInt() {
        return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util_js_1.util.isInteger(ch.value));
      }
      get isFinite() {
        let max = null;
        let min = null;
        for (const ch of this._def.checks) {
          if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
            return true;
          } else if (ch.kind === "min") {
            if (min === null || ch.value > min)
              min = ch.value;
          } else if (ch.kind === "max") {
            if (max === null || ch.value < max)
              max = ch.value;
          }
        }
        return Number.isFinite(min) && Number.isFinite(max);
      }
    };
    exports.ZodNumber = ZodNumber;
    ZodNumber.create = (params) => {
      return new ZodNumber({
        checks: [],
        typeName: ZodFirstPartyTypeKind.ZodNumber,
        coerce: params?.coerce || false,
        ...processCreateParams(params)
      });
    };
    var ZodBigInt = class _ZodBigInt extends ZodType {
      constructor() {
        super(...arguments);
        this.min = this.gte;
        this.max = this.lte;
      }
      _parse(input) {
        if (this._def.coerce) {
          try {
            input.data = BigInt(input.data);
          } catch {
            return this._getInvalidInput(input);
          }
        }
        const parsedType = this._getType(input);
        if (parsedType !== util_js_1.ZodParsedType.bigint) {
          return this._getInvalidInput(input);
        }
        let ctx = void 0;
        const status = new parseUtil_js_1.ParseStatus();
        for (const check2 of this._def.checks) {
          if (check2.kind === "min") {
            const tooSmall = check2.inclusive ? input.data < check2.value : input.data <= check2.value;
            if (tooSmall) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.too_small,
                type: "bigint",
                minimum: check2.value,
                inclusive: check2.inclusive,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "max") {
            const tooBig = check2.inclusive ? input.data > check2.value : input.data >= check2.value;
            if (tooBig) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.too_big,
                type: "bigint",
                maximum: check2.value,
                inclusive: check2.inclusive,
                message: check2.message
              });
              status.dirty();
            }
          } else if (check2.kind === "multipleOf") {
            if (input.data % check2.value !== BigInt(0)) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.not_multiple_of,
                multipleOf: check2.value,
                message: check2.message
              });
              status.dirty();
            }
          } else {
            util_js_1.util.assertNever(check2);
          }
        }
        return { status: status.value, value: input.data };
      }
      _getInvalidInput(input) {
        const ctx = this._getOrReturnCtx(input);
        (0, parseUtil_js_1.addIssueToContext)(ctx, {
          code: ZodError_js_1.ZodIssueCode.invalid_type,
          expected: util_js_1.ZodParsedType.bigint,
          received: ctx.parsedType
        });
        return parseUtil_js_1.INVALID;
      }
      gte(value, message2) {
        return this.setLimit("min", value, true, errorUtil_js_1.errorUtil.toString(message2));
      }
      gt(value, message2) {
        return this.setLimit("min", value, false, errorUtil_js_1.errorUtil.toString(message2));
      }
      lte(value, message2) {
        return this.setLimit("max", value, true, errorUtil_js_1.errorUtil.toString(message2));
      }
      lt(value, message2) {
        return this.setLimit("max", value, false, errorUtil_js_1.errorUtil.toString(message2));
      }
      setLimit(kind, value, inclusive, message2) {
        return new _ZodBigInt({
          ...this._def,
          checks: [
            ...this._def.checks,
            {
              kind,
              value,
              inclusive,
              message: errorUtil_js_1.errorUtil.toString(message2)
            }
          ]
        });
      }
      _addCheck(check2) {
        return new _ZodBigInt({
          ...this._def,
          checks: [...this._def.checks, check2]
        });
      }
      positive(message2) {
        return this._addCheck({
          kind: "min",
          value: BigInt(0),
          inclusive: false,
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      negative(message2) {
        return this._addCheck({
          kind: "max",
          value: BigInt(0),
          inclusive: false,
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      nonpositive(message2) {
        return this._addCheck({
          kind: "max",
          value: BigInt(0),
          inclusive: true,
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      nonnegative(message2) {
        return this._addCheck({
          kind: "min",
          value: BigInt(0),
          inclusive: true,
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      multipleOf(value, message2) {
        return this._addCheck({
          kind: "multipleOf",
          value,
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      get minValue() {
        let min = null;
        for (const ch of this._def.checks) {
          if (ch.kind === "min") {
            if (min === null || ch.value > min)
              min = ch.value;
          }
        }
        return min;
      }
      get maxValue() {
        let max = null;
        for (const ch of this._def.checks) {
          if (ch.kind === "max") {
            if (max === null || ch.value < max)
              max = ch.value;
          }
        }
        return max;
      }
    };
    exports.ZodBigInt = ZodBigInt;
    ZodBigInt.create = (params) => {
      return new ZodBigInt({
        checks: [],
        typeName: ZodFirstPartyTypeKind.ZodBigInt,
        coerce: params?.coerce ?? false,
        ...processCreateParams(params)
      });
    };
    var ZodBoolean = class extends ZodType {
      _parse(input) {
        if (this._def.coerce) {
          input.data = Boolean(input.data);
        }
        const parsedType = this._getType(input);
        if (parsedType !== util_js_1.ZodParsedType.boolean) {
          const ctx = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.boolean,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        return (0, parseUtil_js_1.OK)(input.data);
      }
    };
    exports.ZodBoolean = ZodBoolean;
    ZodBoolean.create = (params) => {
      return new ZodBoolean({
        typeName: ZodFirstPartyTypeKind.ZodBoolean,
        coerce: params?.coerce || false,
        ...processCreateParams(params)
      });
    };
    var ZodDate = class _ZodDate extends ZodType {
      _parse(input) {
        if (this._def.coerce) {
          input.data = new Date(input.data);
        }
        const parsedType = this._getType(input);
        if (parsedType !== util_js_1.ZodParsedType.date) {
          const ctx2 = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx2, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.date,
            received: ctx2.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        if (Number.isNaN(input.data.getTime())) {
          const ctx2 = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx2, {
            code: ZodError_js_1.ZodIssueCode.invalid_date
          });
          return parseUtil_js_1.INVALID;
        }
        const status = new parseUtil_js_1.ParseStatus();
        let ctx = void 0;
        for (const check2 of this._def.checks) {
          if (check2.kind === "min") {
            if (input.data.getTime() < check2.value) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.too_small,
                message: check2.message,
                inclusive: true,
                exact: false,
                minimum: check2.value,
                type: "date"
              });
              status.dirty();
            }
          } else if (check2.kind === "max") {
            if (input.data.getTime() > check2.value) {
              ctx = this._getOrReturnCtx(input, ctx);
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.too_big,
                message: check2.message,
                inclusive: true,
                exact: false,
                maximum: check2.value,
                type: "date"
              });
              status.dirty();
            }
          } else {
            util_js_1.util.assertNever(check2);
          }
        }
        return {
          status: status.value,
          value: new Date(input.data.getTime())
        };
      }
      _addCheck(check2) {
        return new _ZodDate({
          ...this._def,
          checks: [...this._def.checks, check2]
        });
      }
      min(minDate, message2) {
        return this._addCheck({
          kind: "min",
          value: minDate.getTime(),
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      max(maxDate, message2) {
        return this._addCheck({
          kind: "max",
          value: maxDate.getTime(),
          message: errorUtil_js_1.errorUtil.toString(message2)
        });
      }
      get minDate() {
        let min = null;
        for (const ch of this._def.checks) {
          if (ch.kind === "min") {
            if (min === null || ch.value > min)
              min = ch.value;
          }
        }
        return min != null ? new Date(min) : null;
      }
      get maxDate() {
        let max = null;
        for (const ch of this._def.checks) {
          if (ch.kind === "max") {
            if (max === null || ch.value < max)
              max = ch.value;
          }
        }
        return max != null ? new Date(max) : null;
      }
    };
    exports.ZodDate = ZodDate;
    ZodDate.create = (params) => {
      return new ZodDate({
        checks: [],
        coerce: params?.coerce || false,
        typeName: ZodFirstPartyTypeKind.ZodDate,
        ...processCreateParams(params)
      });
    };
    var ZodSymbol = class extends ZodType {
      _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== util_js_1.ZodParsedType.symbol) {
          const ctx = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.symbol,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        return (0, parseUtil_js_1.OK)(input.data);
      }
    };
    exports.ZodSymbol = ZodSymbol;
    ZodSymbol.create = (params) => {
      return new ZodSymbol({
        typeName: ZodFirstPartyTypeKind.ZodSymbol,
        ...processCreateParams(params)
      });
    };
    var ZodUndefined = class extends ZodType {
      _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== util_js_1.ZodParsedType.undefined) {
          const ctx = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.undefined,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        return (0, parseUtil_js_1.OK)(input.data);
      }
    };
    exports.ZodUndefined = ZodUndefined;
    ZodUndefined.create = (params) => {
      return new ZodUndefined({
        typeName: ZodFirstPartyTypeKind.ZodUndefined,
        ...processCreateParams(params)
      });
    };
    var ZodNull = class extends ZodType {
      _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== util_js_1.ZodParsedType.null) {
          const ctx = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.null,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        return (0, parseUtil_js_1.OK)(input.data);
      }
    };
    exports.ZodNull = ZodNull;
    ZodNull.create = (params) => {
      return new ZodNull({
        typeName: ZodFirstPartyTypeKind.ZodNull,
        ...processCreateParams(params)
      });
    };
    var ZodAny = class extends ZodType {
      constructor() {
        super(...arguments);
        this._any = true;
      }
      _parse(input) {
        return (0, parseUtil_js_1.OK)(input.data);
      }
    };
    exports.ZodAny = ZodAny;
    ZodAny.create = (params) => {
      return new ZodAny({
        typeName: ZodFirstPartyTypeKind.ZodAny,
        ...processCreateParams(params)
      });
    };
    var ZodUnknown = class extends ZodType {
      constructor() {
        super(...arguments);
        this._unknown = true;
      }
      _parse(input) {
        return (0, parseUtil_js_1.OK)(input.data);
      }
    };
    exports.ZodUnknown = ZodUnknown;
    ZodUnknown.create = (params) => {
      return new ZodUnknown({
        typeName: ZodFirstPartyTypeKind.ZodUnknown,
        ...processCreateParams(params)
      });
    };
    var ZodNever = class extends ZodType {
      _parse(input) {
        const ctx = this._getOrReturnCtx(input);
        (0, parseUtil_js_1.addIssueToContext)(ctx, {
          code: ZodError_js_1.ZodIssueCode.invalid_type,
          expected: util_js_1.ZodParsedType.never,
          received: ctx.parsedType
        });
        return parseUtil_js_1.INVALID;
      }
    };
    exports.ZodNever = ZodNever;
    ZodNever.create = (params) => {
      return new ZodNever({
        typeName: ZodFirstPartyTypeKind.ZodNever,
        ...processCreateParams(params)
      });
    };
    var ZodVoid = class extends ZodType {
      _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== util_js_1.ZodParsedType.undefined) {
          const ctx = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.void,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        return (0, parseUtil_js_1.OK)(input.data);
      }
    };
    exports.ZodVoid = ZodVoid;
    ZodVoid.create = (params) => {
      return new ZodVoid({
        typeName: ZodFirstPartyTypeKind.ZodVoid,
        ...processCreateParams(params)
      });
    };
    var ZodArray = class _ZodArray extends ZodType {
      _parse(input) {
        const { ctx, status } = this._processInputParams(input);
        const def = this._def;
        if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.array,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        if (def.exactLength !== null) {
          const tooBig = ctx.data.length > def.exactLength.value;
          const tooSmall = ctx.data.length < def.exactLength.value;
          if (tooBig || tooSmall) {
            (0, parseUtil_js_1.addIssueToContext)(ctx, {
              code: tooBig ? ZodError_js_1.ZodIssueCode.too_big : ZodError_js_1.ZodIssueCode.too_small,
              minimum: tooSmall ? def.exactLength.value : void 0,
              maximum: tooBig ? def.exactLength.value : void 0,
              type: "array",
              inclusive: true,
              exact: true,
              message: def.exactLength.message
            });
            status.dirty();
          }
        }
        if (def.minLength !== null) {
          if (ctx.data.length < def.minLength.value) {
            (0, parseUtil_js_1.addIssueToContext)(ctx, {
              code: ZodError_js_1.ZodIssueCode.too_small,
              minimum: def.minLength.value,
              type: "array",
              inclusive: true,
              exact: false,
              message: def.minLength.message
            });
            status.dirty();
          }
        }
        if (def.maxLength !== null) {
          if (ctx.data.length > def.maxLength.value) {
            (0, parseUtil_js_1.addIssueToContext)(ctx, {
              code: ZodError_js_1.ZodIssueCode.too_big,
              maximum: def.maxLength.value,
              type: "array",
              inclusive: true,
              exact: false,
              message: def.maxLength.message
            });
            status.dirty();
          }
        }
        if (ctx.common.async) {
          return Promise.all([...ctx.data].map((item, i) => {
            return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
          })).then((result2) => {
            return parseUtil_js_1.ParseStatus.mergeArray(status, result2);
          });
        }
        const result = [...ctx.data].map((item, i) => {
          return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
        });
        return parseUtil_js_1.ParseStatus.mergeArray(status, result);
      }
      get element() {
        return this._def.type;
      }
      min(minLength, message2) {
        return new _ZodArray({
          ...this._def,
          minLength: { value: minLength, message: errorUtil_js_1.errorUtil.toString(message2) }
        });
      }
      max(maxLength, message2) {
        return new _ZodArray({
          ...this._def,
          maxLength: { value: maxLength, message: errorUtil_js_1.errorUtil.toString(message2) }
        });
      }
      length(len, message2) {
        return new _ZodArray({
          ...this._def,
          exactLength: { value: len, message: errorUtil_js_1.errorUtil.toString(message2) }
        });
      }
      nonempty(message2) {
        return this.min(1, message2);
      }
    };
    exports.ZodArray = ZodArray;
    ZodArray.create = (schema, params) => {
      return new ZodArray({
        type: schema,
        minLength: null,
        maxLength: null,
        exactLength: null,
        typeName: ZodFirstPartyTypeKind.ZodArray,
        ...processCreateParams(params)
      });
    };
    function deepPartialify(schema) {
      if (schema instanceof ZodObject) {
        const newShape = {};
        for (const key in schema.shape) {
          const fieldSchema = schema.shape[key];
          newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
        }
        return new ZodObject({
          ...schema._def,
          shape: () => newShape
        });
      } else if (schema instanceof ZodArray) {
        return new ZodArray({
          ...schema._def,
          type: deepPartialify(schema.element)
        });
      } else if (schema instanceof ZodOptional) {
        return ZodOptional.create(deepPartialify(schema.unwrap()));
      } else if (schema instanceof ZodNullable) {
        return ZodNullable.create(deepPartialify(schema.unwrap()));
      } else if (schema instanceof ZodTuple) {
        return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
      } else {
        return schema;
      }
    }
    var ZodObject = class _ZodObject extends ZodType {
      constructor() {
        super(...arguments);
        this._cached = null;
        this.nonstrict = this.passthrough;
        this.augment = this.extend;
      }
      _getCached() {
        if (this._cached !== null)
          return this._cached;
        const shape = this._def.shape();
        const keys = util_js_1.util.objectKeys(shape);
        this._cached = { shape, keys };
        return this._cached;
      }
      _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== util_js_1.ZodParsedType.object) {
          const ctx2 = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx2, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.object,
            received: ctx2.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        const { status, ctx } = this._processInputParams(input);
        const { shape, keys: shapeKeys } = this._getCached();
        const extraKeys = [];
        if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
          for (const key in ctx.data) {
            if (!shapeKeys.includes(key)) {
              extraKeys.push(key);
            }
          }
        }
        const pairs = [];
        for (const key of shapeKeys) {
          const keyValidator = shape[key];
          const value = ctx.data[key];
          pairs.push({
            key: { status: "valid", value: key },
            value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
            alwaysSet: key in ctx.data
          });
        }
        if (this._def.catchall instanceof ZodNever) {
          const unknownKeys = this._def.unknownKeys;
          if (unknownKeys === "passthrough") {
            for (const key of extraKeys) {
              pairs.push({
                key: { status: "valid", value: key },
                value: { status: "valid", value: ctx.data[key] }
              });
            }
          } else if (unknownKeys === "strict") {
            if (extraKeys.length > 0) {
              (0, parseUtil_js_1.addIssueToContext)(ctx, {
                code: ZodError_js_1.ZodIssueCode.unrecognized_keys,
                keys: extraKeys
              });
              status.dirty();
            }
          } else if (unknownKeys === "strip") {
          } else {
            throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
          }
        } else {
          const catchall = this._def.catchall;
          for (const key of extraKeys) {
            const value = ctx.data[key];
            pairs.push({
              key: { status: "valid", value: key },
              value: catchall._parse(
                new ParseInputLazyPath(ctx, value, ctx.path, key)
                //, ctx.child(key), value, getParsedType(value)
              ),
              alwaysSet: key in ctx.data
            });
          }
        }
        if (ctx.common.async) {
          return Promise.resolve().then(async () => {
            const syncPairs = [];
            for (const pair of pairs) {
              const key = await pair.key;
              const value = await pair.value;
              syncPairs.push({
                key,
                value,
                alwaysSet: pair.alwaysSet
              });
            }
            return syncPairs;
          }).then((syncPairs) => {
            return parseUtil_js_1.ParseStatus.mergeObjectSync(status, syncPairs);
          });
        } else {
          return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
        }
      }
      get shape() {
        return this._def.shape();
      }
      strict(message2) {
        errorUtil_js_1.errorUtil.errToObj;
        return new _ZodObject({
          ...this._def,
          unknownKeys: "strict",
          ...message2 !== void 0 ? {
            errorMap: (issue, ctx) => {
              const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
              if (issue.code === "unrecognized_keys")
                return {
                  message: errorUtil_js_1.errorUtil.errToObj(message2).message ?? defaultError
                };
              return {
                message: defaultError
              };
            }
          } : {}
        });
      }
      strip() {
        return new _ZodObject({
          ...this._def,
          unknownKeys: "strip"
        });
      }
      passthrough() {
        return new _ZodObject({
          ...this._def,
          unknownKeys: "passthrough"
        });
      }
      // const AugmentFactory =
      //   <Def extends ZodObjectDef>(def: Def) =>
      //   <Augmentation extends ZodRawShape>(
      //     augmentation: Augmentation
      //   ): ZodObject<
      //     extendShape<ReturnType<Def["shape"]>, Augmentation>,
      //     Def["unknownKeys"],
      //     Def["catchall"]
      //   > => {
      //     return new ZodObject({
      //       ...def,
      //       shape: () => ({
      //         ...def.shape(),
      //         ...augmentation,
      //       }),
      //     }) as any;
      //   };
      extend(augmentation) {
        return new _ZodObject({
          ...this._def,
          shape: () => ({
            ...this._def.shape(),
            ...augmentation
          })
        });
      }
      /**
       * Prior to zod@1.0.12 there was a bug in the
       * inferred type of merged objects. Please
       * upgrade if you are experiencing issues.
       */
      merge(merging) {
        const merged = new _ZodObject({
          unknownKeys: merging._def.unknownKeys,
          catchall: merging._def.catchall,
          shape: () => ({
            ...this._def.shape(),
            ...merging._def.shape()
          }),
          typeName: ZodFirstPartyTypeKind.ZodObject
        });
        return merged;
      }
      // merge<
      //   Incoming extends AnyZodObject,
      //   Augmentation extends Incoming["shape"],
      //   NewOutput extends {
      //     [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
      //       ? Augmentation[k]["_output"]
      //       : k extends keyof Output
      //       ? Output[k]
      //       : never;
      //   },
      //   NewInput extends {
      //     [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
      //       ? Augmentation[k]["_input"]
      //       : k extends keyof Input
      //       ? Input[k]
      //       : never;
      //   }
      // >(
      //   merging: Incoming
      // ): ZodObject<
      //   extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
      //   Incoming["_def"]["unknownKeys"],
      //   Incoming["_def"]["catchall"],
      //   NewOutput,
      //   NewInput
      // > {
      //   const merged: any = new ZodObject({
      //     unknownKeys: merging._def.unknownKeys,
      //     catchall: merging._def.catchall,
      //     shape: () =>
      //       objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
      //     typeName: ZodFirstPartyTypeKind.ZodObject,
      //   }) as any;
      //   return merged;
      // }
      setKey(key, schema) {
        return this.augment({ [key]: schema });
      }
      // merge<Incoming extends AnyZodObject>(
      //   merging: Incoming
      // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
      // ZodObject<
      //   extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
      //   Incoming["_def"]["unknownKeys"],
      //   Incoming["_def"]["catchall"]
      // > {
      //   // const mergedShape = objectUtil.mergeShapes(
      //   //   this._def.shape(),
      //   //   merging._def.shape()
      //   // );
      //   const merged: any = new ZodObject({
      //     unknownKeys: merging._def.unknownKeys,
      //     catchall: merging._def.catchall,
      //     shape: () =>
      //       objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
      //     typeName: ZodFirstPartyTypeKind.ZodObject,
      //   }) as any;
      //   return merged;
      // }
      catchall(index) {
        return new _ZodObject({
          ...this._def,
          catchall: index
        });
      }
      pick(mask) {
        const shape = {};
        for (const key of util_js_1.util.objectKeys(mask)) {
          if (mask[key] && this.shape[key]) {
            shape[key] = this.shape[key];
          }
        }
        return new _ZodObject({
          ...this._def,
          shape: () => shape
        });
      }
      omit(mask) {
        const shape = {};
        for (const key of util_js_1.util.objectKeys(this.shape)) {
          if (!mask[key]) {
            shape[key] = this.shape[key];
          }
        }
        return new _ZodObject({
          ...this._def,
          shape: () => shape
        });
      }
      /**
       * @deprecated
       */
      deepPartial() {
        return deepPartialify(this);
      }
      partial(mask) {
        const newShape = {};
        for (const key of util_js_1.util.objectKeys(this.shape)) {
          const fieldSchema = this.shape[key];
          if (mask && !mask[key]) {
            newShape[key] = fieldSchema;
          } else {
            newShape[key] = fieldSchema.optional();
          }
        }
        return new _ZodObject({
          ...this._def,
          shape: () => newShape
        });
      }
      required(mask) {
        const newShape = {};
        for (const key of util_js_1.util.objectKeys(this.shape)) {
          if (mask && !mask[key]) {
            newShape[key] = this.shape[key];
          } else {
            const fieldSchema = this.shape[key];
            let newField = fieldSchema;
            while (newField instanceof ZodOptional) {
              newField = newField._def.innerType;
            }
            newShape[key] = newField;
          }
        }
        return new _ZodObject({
          ...this._def,
          shape: () => newShape
        });
      }
      keyof() {
        return createZodEnum(util_js_1.util.objectKeys(this.shape));
      }
    };
    exports.ZodObject = ZodObject;
    ZodObject.create = (shape, params) => {
      return new ZodObject({
        shape: () => shape,
        unknownKeys: "strip",
        catchall: ZodNever.create(),
        typeName: ZodFirstPartyTypeKind.ZodObject,
        ...processCreateParams(params)
      });
    };
    ZodObject.strictCreate = (shape, params) => {
      return new ZodObject({
        shape: () => shape,
        unknownKeys: "strict",
        catchall: ZodNever.create(),
        typeName: ZodFirstPartyTypeKind.ZodObject,
        ...processCreateParams(params)
      });
    };
    ZodObject.lazycreate = (shape, params) => {
      return new ZodObject({
        shape,
        unknownKeys: "strip",
        catchall: ZodNever.create(),
        typeName: ZodFirstPartyTypeKind.ZodObject,
        ...processCreateParams(params)
      });
    };
    var ZodUnion = class extends ZodType {
      _parse(input) {
        const { ctx } = this._processInputParams(input);
        const options = this._def.options;
        function handleResults(results) {
          for (const result of results) {
            if (result.result.status === "valid") {
              return result.result;
            }
          }
          for (const result of results) {
            if (result.result.status === "dirty") {
              ctx.common.issues.push(...result.ctx.common.issues);
              return result.result;
            }
          }
          const unionErrors = results.map((result) => new ZodError_js_1.ZodError(result.ctx.common.issues));
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_union,
            unionErrors
          });
          return parseUtil_js_1.INVALID;
        }
        if (ctx.common.async) {
          return Promise.all(options.map(async (option) => {
            const childCtx = {
              ...ctx,
              common: {
                ...ctx.common,
                issues: []
              },
              parent: null
            };
            return {
              result: await option._parseAsync({
                data: ctx.data,
                path: ctx.path,
                parent: childCtx
              }),
              ctx: childCtx
            };
          })).then(handleResults);
        } else {
          let dirty = void 0;
          const issues = [];
          for (const option of options) {
            const childCtx = {
              ...ctx,
              common: {
                ...ctx.common,
                issues: []
              },
              parent: null
            };
            const result = option._parseSync({
              data: ctx.data,
              path: ctx.path,
              parent: childCtx
            });
            if (result.status === "valid") {
              return result;
            } else if (result.status === "dirty" && !dirty) {
              dirty = { result, ctx: childCtx };
            }
            if (childCtx.common.issues.length) {
              issues.push(childCtx.common.issues);
            }
          }
          if (dirty) {
            ctx.common.issues.push(...dirty.ctx.common.issues);
            return dirty.result;
          }
          const unionErrors = issues.map((issues2) => new ZodError_js_1.ZodError(issues2));
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_union,
            unionErrors
          });
          return parseUtil_js_1.INVALID;
        }
      }
      get options() {
        return this._def.options;
      }
    };
    exports.ZodUnion = ZodUnion;
    ZodUnion.create = (types2, params) => {
      return new ZodUnion({
        options: types2,
        typeName: ZodFirstPartyTypeKind.ZodUnion,
        ...processCreateParams(params)
      });
    };
    var getDiscriminator = (type) => {
      if (type instanceof ZodLazy) {
        return getDiscriminator(type.schema);
      } else if (type instanceof ZodEffects) {
        return getDiscriminator(type.innerType());
      } else if (type instanceof ZodLiteral) {
        return [type.value];
      } else if (type instanceof ZodEnum) {
        return type.options;
      } else if (type instanceof ZodNativeEnum) {
        return util_js_1.util.objectValues(type.enum);
      } else if (type instanceof ZodDefault) {
        return getDiscriminator(type._def.innerType);
      } else if (type instanceof ZodUndefined) {
        return [void 0];
      } else if (type instanceof ZodNull) {
        return [null];
      } else if (type instanceof ZodOptional) {
        return [void 0, ...getDiscriminator(type.unwrap())];
      } else if (type instanceof ZodNullable) {
        return [null, ...getDiscriminator(type.unwrap())];
      } else if (type instanceof ZodBranded) {
        return getDiscriminator(type.unwrap());
      } else if (type instanceof ZodReadonly) {
        return getDiscriminator(type.unwrap());
      } else if (type instanceof ZodCatch) {
        return getDiscriminator(type._def.innerType);
      } else {
        return [];
      }
    };
    var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
      _parse(input) {
        const { ctx } = this._processInputParams(input);
        if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.object,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        const discriminator = this.discriminator;
        const discriminatorValue = ctx.data[discriminator];
        const option = this.optionsMap.get(discriminatorValue);
        if (!option) {
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_union_discriminator,
            options: Array.from(this.optionsMap.keys()),
            path: [discriminator]
          });
          return parseUtil_js_1.INVALID;
        }
        if (ctx.common.async) {
          return option._parseAsync({
            data: ctx.data,
            path: ctx.path,
            parent: ctx
          });
        } else {
          return option._parseSync({
            data: ctx.data,
            path: ctx.path,
            parent: ctx
          });
        }
      }
      get discriminator() {
        return this._def.discriminator;
      }
      get options() {
        return this._def.options;
      }
      get optionsMap() {
        return this._def.optionsMap;
      }
      /**
       * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
       * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
       * have a different value for each object in the union.
       * @param discriminator the name of the discriminator property
       * @param types an array of object schemas
       * @param params
       */
      static create(discriminator, options, params) {
        const optionsMap = /* @__PURE__ */ new Map();
        for (const type of options) {
          const discriminatorValues = getDiscriminator(type.shape[discriminator]);
          if (!discriminatorValues.length) {
            throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
          }
          for (const value of discriminatorValues) {
            if (optionsMap.has(value)) {
              throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
            }
            optionsMap.set(value, type);
          }
        }
        return new _ZodDiscriminatedUnion({
          typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
          discriminator,
          options,
          optionsMap,
          ...processCreateParams(params)
        });
      }
    };
    exports.ZodDiscriminatedUnion = ZodDiscriminatedUnion;
    function mergeValues(a, b) {
      const aType = (0, util_js_1.getParsedType)(a);
      const bType = (0, util_js_1.getParsedType)(b);
      if (a === b) {
        return { valid: true, data: a };
      } else if (aType === util_js_1.ZodParsedType.object && bType === util_js_1.ZodParsedType.object) {
        const bKeys = util_js_1.util.objectKeys(b);
        const sharedKeys = util_js_1.util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
        const newObj = { ...a, ...b };
        for (const key of sharedKeys) {
          const sharedValue = mergeValues(a[key], b[key]);
          if (!sharedValue.valid) {
            return { valid: false };
          }
          newObj[key] = sharedValue.data;
        }
        return { valid: true, data: newObj };
      } else if (aType === util_js_1.ZodParsedType.array && bType === util_js_1.ZodParsedType.array) {
        if (a.length !== b.length) {
          return { valid: false };
        }
        const newArray = [];
        for (let index = 0; index < a.length; index++) {
          const itemA = a[index];
          const itemB = b[index];
          const sharedValue = mergeValues(itemA, itemB);
          if (!sharedValue.valid) {
            return { valid: false };
          }
          newArray.push(sharedValue.data);
        }
        return { valid: true, data: newArray };
      } else if (aType === util_js_1.ZodParsedType.date && bType === util_js_1.ZodParsedType.date && +a === +b) {
        return { valid: true, data: a };
      } else {
        return { valid: false };
      }
    }
    var ZodIntersection = class extends ZodType {
      _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        const handleParsed = (parsedLeft, parsedRight) => {
          if ((0, parseUtil_js_1.isAborted)(parsedLeft) || (0, parseUtil_js_1.isAborted)(parsedRight)) {
            return parseUtil_js_1.INVALID;
          }
          const merged = mergeValues(parsedLeft.value, parsedRight.value);
          if (!merged.valid) {
            (0, parseUtil_js_1.addIssueToContext)(ctx, {
              code: ZodError_js_1.ZodIssueCode.invalid_intersection_types
            });
            return parseUtil_js_1.INVALID;
          }
          if ((0, parseUtil_js_1.isDirty)(parsedLeft) || (0, parseUtil_js_1.isDirty)(parsedRight)) {
            status.dirty();
          }
          return { status: status.value, value: merged.data };
        };
        if (ctx.common.async) {
          return Promise.all([
            this._def.left._parseAsync({
              data: ctx.data,
              path: ctx.path,
              parent: ctx
            }),
            this._def.right._parseAsync({
              data: ctx.data,
              path: ctx.path,
              parent: ctx
            })
          ]).then(([left, right]) => handleParsed(left, right));
        } else {
          return handleParsed(this._def.left._parseSync({
            data: ctx.data,
            path: ctx.path,
            parent: ctx
          }), this._def.right._parseSync({
            data: ctx.data,
            path: ctx.path,
            parent: ctx
          }));
        }
      }
    };
    exports.ZodIntersection = ZodIntersection;
    ZodIntersection.create = (left, right, params) => {
      return new ZodIntersection({
        left,
        right,
        typeName: ZodFirstPartyTypeKind.ZodIntersection,
        ...processCreateParams(params)
      });
    };
    var ZodTuple = class _ZodTuple extends ZodType {
      _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        if (ctx.parsedType !== util_js_1.ZodParsedType.array) {
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.array,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        if (ctx.data.length < this._def.items.length) {
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.too_small,
            minimum: this._def.items.length,
            inclusive: true,
            exact: false,
            type: "array"
          });
          return parseUtil_js_1.INVALID;
        }
        const rest = this._def.rest;
        if (!rest && ctx.data.length > this._def.items.length) {
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.too_big,
            maximum: this._def.items.length,
            inclusive: true,
            exact: false,
            type: "array"
          });
          status.dirty();
        }
        const items = [...ctx.data].map((item, itemIndex) => {
          const schema = this._def.items[itemIndex] || this._def.rest;
          if (!schema)
            return null;
          return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
        }).filter((x) => !!x);
        if (ctx.common.async) {
          return Promise.all(items).then((results) => {
            return parseUtil_js_1.ParseStatus.mergeArray(status, results);
          });
        } else {
          return parseUtil_js_1.ParseStatus.mergeArray(status, items);
        }
      }
      get items() {
        return this._def.items;
      }
      rest(rest) {
        return new _ZodTuple({
          ...this._def,
          rest
        });
      }
    };
    exports.ZodTuple = ZodTuple;
    ZodTuple.create = (schemas, params) => {
      if (!Array.isArray(schemas)) {
        throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
      }
      return new ZodTuple({
        items: schemas,
        typeName: ZodFirstPartyTypeKind.ZodTuple,
        rest: null,
        ...processCreateParams(params)
      });
    };
    var ZodRecord = class _ZodRecord extends ZodType {
      get keySchema() {
        return this._def.keyType;
      }
      get valueSchema() {
        return this._def.valueType;
      }
      _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        if (ctx.parsedType !== util_js_1.ZodParsedType.object) {
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.object,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        const pairs = [];
        const keyType = this._def.keyType;
        const valueType = this._def.valueType;
        for (const key in ctx.data) {
          pairs.push({
            key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
            value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
            alwaysSet: key in ctx.data
          });
        }
        if (ctx.common.async) {
          return parseUtil_js_1.ParseStatus.mergeObjectAsync(status, pairs);
        } else {
          return parseUtil_js_1.ParseStatus.mergeObjectSync(status, pairs);
        }
      }
      get element() {
        return this._def.valueType;
      }
      static create(first, second, third) {
        if (second instanceof ZodType) {
          return new _ZodRecord({
            keyType: first,
            valueType: second,
            typeName: ZodFirstPartyTypeKind.ZodRecord,
            ...processCreateParams(third)
          });
        }
        return new _ZodRecord({
          keyType: ZodString.create(),
          valueType: first,
          typeName: ZodFirstPartyTypeKind.ZodRecord,
          ...processCreateParams(second)
        });
      }
    };
    exports.ZodRecord = ZodRecord;
    var ZodMap = class extends ZodType {
      get keySchema() {
        return this._def.keyType;
      }
      get valueSchema() {
        return this._def.valueType;
      }
      _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        if (ctx.parsedType !== util_js_1.ZodParsedType.map) {
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.map,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        const keyType = this._def.keyType;
        const valueType = this._def.valueType;
        const pairs = [...ctx.data.entries()].map(([key, value], index) => {
          return {
            key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
            value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
          };
        });
        if (ctx.common.async) {
          const finalMap = /* @__PURE__ */ new Map();
          return Promise.resolve().then(async () => {
            for (const pair of pairs) {
              const key = await pair.key;
              const value = await pair.value;
              if (key.status === "aborted" || value.status === "aborted") {
                return parseUtil_js_1.INVALID;
              }
              if (key.status === "dirty" || value.status === "dirty") {
                status.dirty();
              }
              finalMap.set(key.value, value.value);
            }
            return { status: status.value, value: finalMap };
          });
        } else {
          const finalMap = /* @__PURE__ */ new Map();
          for (const pair of pairs) {
            const key = pair.key;
            const value = pair.value;
            if (key.status === "aborted" || value.status === "aborted") {
              return parseUtil_js_1.INVALID;
            }
            if (key.status === "dirty" || value.status === "dirty") {
              status.dirty();
            }
            finalMap.set(key.value, value.value);
          }
          return { status: status.value, value: finalMap };
        }
      }
    };
    exports.ZodMap = ZodMap;
    ZodMap.create = (keyType, valueType, params) => {
      return new ZodMap({
        valueType,
        keyType,
        typeName: ZodFirstPartyTypeKind.ZodMap,
        ...processCreateParams(params)
      });
    };
    var ZodSet = class _ZodSet extends ZodType {
      _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        if (ctx.parsedType !== util_js_1.ZodParsedType.set) {
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.set,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        const def = this._def;
        if (def.minSize !== null) {
          if (ctx.data.size < def.minSize.value) {
            (0, parseUtil_js_1.addIssueToContext)(ctx, {
              code: ZodError_js_1.ZodIssueCode.too_small,
              minimum: def.minSize.value,
              type: "set",
              inclusive: true,
              exact: false,
              message: def.minSize.message
            });
            status.dirty();
          }
        }
        if (def.maxSize !== null) {
          if (ctx.data.size > def.maxSize.value) {
            (0, parseUtil_js_1.addIssueToContext)(ctx, {
              code: ZodError_js_1.ZodIssueCode.too_big,
              maximum: def.maxSize.value,
              type: "set",
              inclusive: true,
              exact: false,
              message: def.maxSize.message
            });
            status.dirty();
          }
        }
        const valueType = this._def.valueType;
        function finalizeSet(elements2) {
          const parsedSet = /* @__PURE__ */ new Set();
          for (const element of elements2) {
            if (element.status === "aborted")
              return parseUtil_js_1.INVALID;
            if (element.status === "dirty")
              status.dirty();
            parsedSet.add(element.value);
          }
          return { status: status.value, value: parsedSet };
        }
        const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
        if (ctx.common.async) {
          return Promise.all(elements).then((elements2) => finalizeSet(elements2));
        } else {
          return finalizeSet(elements);
        }
      }
      min(minSize, message2) {
        return new _ZodSet({
          ...this._def,
          minSize: { value: minSize, message: errorUtil_js_1.errorUtil.toString(message2) }
        });
      }
      max(maxSize, message2) {
        return new _ZodSet({
          ...this._def,
          maxSize: { value: maxSize, message: errorUtil_js_1.errorUtil.toString(message2) }
        });
      }
      size(size, message2) {
        return this.min(size, message2).max(size, message2);
      }
      nonempty(message2) {
        return this.min(1, message2);
      }
    };
    exports.ZodSet = ZodSet;
    ZodSet.create = (valueType, params) => {
      return new ZodSet({
        valueType,
        minSize: null,
        maxSize: null,
        typeName: ZodFirstPartyTypeKind.ZodSet,
        ...processCreateParams(params)
      });
    };
    var ZodFunction = class _ZodFunction extends ZodType {
      constructor() {
        super(...arguments);
        this.validate = this.implement;
      }
      _parse(input) {
        const { ctx } = this._processInputParams(input);
        if (ctx.parsedType !== util_js_1.ZodParsedType.function) {
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.function,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        function makeArgsIssue(args, error) {
          return (0, parseUtil_js_1.makeIssue)({
            data: args,
            path: ctx.path,
            errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
            issueData: {
              code: ZodError_js_1.ZodIssueCode.invalid_arguments,
              argumentsError: error
            }
          });
        }
        function makeReturnsIssue(returns, error) {
          return (0, parseUtil_js_1.makeIssue)({
            data: returns,
            path: ctx.path,
            errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, (0, errors_js_1.getErrorMap)(), errors_js_1.defaultErrorMap].filter((x) => !!x),
            issueData: {
              code: ZodError_js_1.ZodIssueCode.invalid_return_type,
              returnTypeError: error
            }
          });
        }
        const params = { errorMap: ctx.common.contextualErrorMap };
        const fn = ctx.data;
        if (this._def.returns instanceof ZodPromise) {
          const me = this;
          return (0, parseUtil_js_1.OK)(async function(...args) {
            const error = new ZodError_js_1.ZodError([]);
            const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
              error.addIssue(makeArgsIssue(args, e));
              throw error;
            });
            const result = await Reflect.apply(fn, this, parsedArgs);
            const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
              error.addIssue(makeReturnsIssue(result, e));
              throw error;
            });
            return parsedReturns;
          });
        } else {
          const me = this;
          return (0, parseUtil_js_1.OK)(function(...args) {
            const parsedArgs = me._def.args.safeParse(args, params);
            if (!parsedArgs.success) {
              throw new ZodError_js_1.ZodError([makeArgsIssue(args, parsedArgs.error)]);
            }
            const result = Reflect.apply(fn, this, parsedArgs.data);
            const parsedReturns = me._def.returns.safeParse(result, params);
            if (!parsedReturns.success) {
              throw new ZodError_js_1.ZodError([makeReturnsIssue(result, parsedReturns.error)]);
            }
            return parsedReturns.data;
          });
        }
      }
      parameters() {
        return this._def.args;
      }
      returnType() {
        return this._def.returns;
      }
      args(...items) {
        return new _ZodFunction({
          ...this._def,
          args: ZodTuple.create(items).rest(ZodUnknown.create())
        });
      }
      returns(returnType) {
        return new _ZodFunction({
          ...this._def,
          returns: returnType
        });
      }
      implement(func) {
        const validatedFunc = this.parse(func);
        return validatedFunc;
      }
      strictImplement(func) {
        const validatedFunc = this.parse(func);
        return validatedFunc;
      }
      static create(args, returns, params) {
        return new _ZodFunction({
          args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
          returns: returns || ZodUnknown.create(),
          typeName: ZodFirstPartyTypeKind.ZodFunction,
          ...processCreateParams(params)
        });
      }
    };
    exports.ZodFunction = ZodFunction;
    var ZodLazy = class extends ZodType {
      get schema() {
        return this._def.getter();
      }
      _parse(input) {
        const { ctx } = this._processInputParams(input);
        const lazySchema = this._def.getter();
        return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
      }
    };
    exports.ZodLazy = ZodLazy;
    ZodLazy.create = (getter, params) => {
      return new ZodLazy({
        getter,
        typeName: ZodFirstPartyTypeKind.ZodLazy,
        ...processCreateParams(params)
      });
    };
    var ZodLiteral = class extends ZodType {
      _parse(input) {
        if (input.data !== this._def.value) {
          const ctx = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            received: ctx.data,
            code: ZodError_js_1.ZodIssueCode.invalid_literal,
            expected: this._def.value
          });
          return parseUtil_js_1.INVALID;
        }
        return { status: "valid", value: input.data };
      }
      get value() {
        return this._def.value;
      }
    };
    exports.ZodLiteral = ZodLiteral;
    ZodLiteral.create = (value, params) => {
      return new ZodLiteral({
        value,
        typeName: ZodFirstPartyTypeKind.ZodLiteral,
        ...processCreateParams(params)
      });
    };
    function createZodEnum(values, params) {
      return new ZodEnum({
        values,
        typeName: ZodFirstPartyTypeKind.ZodEnum,
        ...processCreateParams(params)
      });
    }
    var ZodEnum = class _ZodEnum extends ZodType {
      _parse(input) {
        if (typeof input.data !== "string") {
          const ctx = this._getOrReturnCtx(input);
          const expectedValues = this._def.values;
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            expected: util_js_1.util.joinValues(expectedValues),
            received: ctx.parsedType,
            code: ZodError_js_1.ZodIssueCode.invalid_type
          });
          return parseUtil_js_1.INVALID;
        }
        if (!this._cache) {
          this._cache = new Set(this._def.values);
        }
        if (!this._cache.has(input.data)) {
          const ctx = this._getOrReturnCtx(input);
          const expectedValues = this._def.values;
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            received: ctx.data,
            code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
            options: expectedValues
          });
          return parseUtil_js_1.INVALID;
        }
        return (0, parseUtil_js_1.OK)(input.data);
      }
      get options() {
        return this._def.values;
      }
      get enum() {
        const enumValues = {};
        for (const val of this._def.values) {
          enumValues[val] = val;
        }
        return enumValues;
      }
      get Values() {
        const enumValues = {};
        for (const val of this._def.values) {
          enumValues[val] = val;
        }
        return enumValues;
      }
      get Enum() {
        const enumValues = {};
        for (const val of this._def.values) {
          enumValues[val] = val;
        }
        return enumValues;
      }
      extract(values, newDef = this._def) {
        return _ZodEnum.create(values, {
          ...this._def,
          ...newDef
        });
      }
      exclude(values, newDef = this._def) {
        return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
          ...this._def,
          ...newDef
        });
      }
    };
    exports.ZodEnum = ZodEnum;
    ZodEnum.create = createZodEnum;
    var ZodNativeEnum = class extends ZodType {
      _parse(input) {
        const nativeEnumValues = util_js_1.util.getValidEnumValues(this._def.values);
        const ctx = this._getOrReturnCtx(input);
        if (ctx.parsedType !== util_js_1.ZodParsedType.string && ctx.parsedType !== util_js_1.ZodParsedType.number) {
          const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            expected: util_js_1.util.joinValues(expectedValues),
            received: ctx.parsedType,
            code: ZodError_js_1.ZodIssueCode.invalid_type
          });
          return parseUtil_js_1.INVALID;
        }
        if (!this._cache) {
          this._cache = new Set(util_js_1.util.getValidEnumValues(this._def.values));
        }
        if (!this._cache.has(input.data)) {
          const expectedValues = util_js_1.util.objectValues(nativeEnumValues);
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            received: ctx.data,
            code: ZodError_js_1.ZodIssueCode.invalid_enum_value,
            options: expectedValues
          });
          return parseUtil_js_1.INVALID;
        }
        return (0, parseUtil_js_1.OK)(input.data);
      }
      get enum() {
        return this._def.values;
      }
    };
    exports.ZodNativeEnum = ZodNativeEnum;
    ZodNativeEnum.create = (values, params) => {
      return new ZodNativeEnum({
        values,
        typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
        ...processCreateParams(params)
      });
    };
    var ZodPromise = class extends ZodType {
      unwrap() {
        return this._def.type;
      }
      _parse(input) {
        const { ctx } = this._processInputParams(input);
        if (ctx.parsedType !== util_js_1.ZodParsedType.promise && ctx.common.async === false) {
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.promise,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        const promisified = ctx.parsedType === util_js_1.ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
        return (0, parseUtil_js_1.OK)(promisified.then((data) => {
          return this._def.type.parseAsync(data, {
            path: ctx.path,
            errorMap: ctx.common.contextualErrorMap
          });
        }));
      }
    };
    exports.ZodPromise = ZodPromise;
    ZodPromise.create = (schema, params) => {
      return new ZodPromise({
        type: schema,
        typeName: ZodFirstPartyTypeKind.ZodPromise,
        ...processCreateParams(params)
      });
    };
    var ZodEffects = class extends ZodType {
      innerType() {
        return this._def.schema;
      }
      sourceType() {
        return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
      }
      _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        const effect = this._def.effect || null;
        const checkCtx = {
          addIssue: (arg) => {
            (0, parseUtil_js_1.addIssueToContext)(ctx, arg);
            if (arg.fatal) {
              status.abort();
            } else {
              status.dirty();
            }
          },
          get path() {
            return ctx.path;
          }
        };
        checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
        if (effect.type === "preprocess") {
          const processed = effect.transform(ctx.data, checkCtx);
          if (ctx.common.async) {
            return Promise.resolve(processed).then(async (processed2) => {
              if (status.value === "aborted")
                return parseUtil_js_1.INVALID;
              const result = await this._def.schema._parseAsync({
                data: processed2,
                path: ctx.path,
                parent: ctx
              });
              if (result.status === "aborted")
                return parseUtil_js_1.INVALID;
              if (result.status === "dirty")
                return (0, parseUtil_js_1.DIRTY)(result.value);
              if (status.value === "dirty")
                return (0, parseUtil_js_1.DIRTY)(result.value);
              return result;
            });
          } else {
            if (status.value === "aborted")
              return parseUtil_js_1.INVALID;
            const result = this._def.schema._parseSync({
              data: processed,
              path: ctx.path,
              parent: ctx
            });
            if (result.status === "aborted")
              return parseUtil_js_1.INVALID;
            if (result.status === "dirty")
              return (0, parseUtil_js_1.DIRTY)(result.value);
            if (status.value === "dirty")
              return (0, parseUtil_js_1.DIRTY)(result.value);
            return result;
          }
        }
        if (effect.type === "refinement") {
          const executeRefinement = (acc) => {
            const result = effect.refinement(acc, checkCtx);
            if (ctx.common.async) {
              return Promise.resolve(result);
            }
            if (result instanceof Promise) {
              throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
            }
            return acc;
          };
          if (ctx.common.async === false) {
            const inner = this._def.schema._parseSync({
              data: ctx.data,
              path: ctx.path,
              parent: ctx
            });
            if (inner.status === "aborted")
              return parseUtil_js_1.INVALID;
            if (inner.status === "dirty")
              status.dirty();
            executeRefinement(inner.value);
            return { status: status.value, value: inner.value };
          } else {
            return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
              if (inner.status === "aborted")
                return parseUtil_js_1.INVALID;
              if (inner.status === "dirty")
                status.dirty();
              return executeRefinement(inner.value).then(() => {
                return { status: status.value, value: inner.value };
              });
            });
          }
        }
        if (effect.type === "transform") {
          if (ctx.common.async === false) {
            const base3 = this._def.schema._parseSync({
              data: ctx.data,
              path: ctx.path,
              parent: ctx
            });
            if (!(0, parseUtil_js_1.isValid)(base3))
              return parseUtil_js_1.INVALID;
            const result = effect.transform(base3.value, checkCtx);
            if (result instanceof Promise) {
              throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
            }
            return { status: status.value, value: result };
          } else {
            return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base3) => {
              if (!(0, parseUtil_js_1.isValid)(base3))
                return parseUtil_js_1.INVALID;
              return Promise.resolve(effect.transform(base3.value, checkCtx)).then((result) => ({
                status: status.value,
                value: result
              }));
            });
          }
        }
        util_js_1.util.assertNever(effect);
      }
    };
    exports.ZodEffects = ZodEffects;
    exports.ZodTransformer = ZodEffects;
    ZodEffects.create = (schema, effect, params) => {
      return new ZodEffects({
        schema,
        typeName: ZodFirstPartyTypeKind.ZodEffects,
        effect,
        ...processCreateParams(params)
      });
    };
    ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
      return new ZodEffects({
        schema,
        effect: { type: "preprocess", transform: preprocess },
        typeName: ZodFirstPartyTypeKind.ZodEffects,
        ...processCreateParams(params)
      });
    };
    var ZodOptional = class extends ZodType {
      _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType === util_js_1.ZodParsedType.undefined) {
          return (0, parseUtil_js_1.OK)(void 0);
        }
        return this._def.innerType._parse(input);
      }
      unwrap() {
        return this._def.innerType;
      }
    };
    exports.ZodOptional = ZodOptional;
    ZodOptional.create = (type, params) => {
      return new ZodOptional({
        innerType: type,
        typeName: ZodFirstPartyTypeKind.ZodOptional,
        ...processCreateParams(params)
      });
    };
    var ZodNullable = class extends ZodType {
      _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType === util_js_1.ZodParsedType.null) {
          return (0, parseUtil_js_1.OK)(null);
        }
        return this._def.innerType._parse(input);
      }
      unwrap() {
        return this._def.innerType;
      }
    };
    exports.ZodNullable = ZodNullable;
    ZodNullable.create = (type, params) => {
      return new ZodNullable({
        innerType: type,
        typeName: ZodFirstPartyTypeKind.ZodNullable,
        ...processCreateParams(params)
      });
    };
    var ZodDefault = class extends ZodType {
      _parse(input) {
        const { ctx } = this._processInputParams(input);
        let data = ctx.data;
        if (ctx.parsedType === util_js_1.ZodParsedType.undefined) {
          data = this._def.defaultValue();
        }
        return this._def.innerType._parse({
          data,
          path: ctx.path,
          parent: ctx
        });
      }
      removeDefault() {
        return this._def.innerType;
      }
    };
    exports.ZodDefault = ZodDefault;
    ZodDefault.create = (type, params) => {
      return new ZodDefault({
        innerType: type,
        typeName: ZodFirstPartyTypeKind.ZodDefault,
        defaultValue: typeof params.default === "function" ? params.default : () => params.default,
        ...processCreateParams(params)
      });
    };
    var ZodCatch = class extends ZodType {
      _parse(input) {
        const { ctx } = this._processInputParams(input);
        const newCtx = {
          ...ctx,
          common: {
            ...ctx.common,
            issues: []
          }
        };
        const result = this._def.innerType._parse({
          data: newCtx.data,
          path: newCtx.path,
          parent: {
            ...newCtx
          }
        });
        if ((0, parseUtil_js_1.isAsync)(result)) {
          return result.then((result2) => {
            return {
              status: "valid",
              value: result2.status === "valid" ? result2.value : this._def.catchValue({
                get error() {
                  return new ZodError_js_1.ZodError(newCtx.common.issues);
                },
                input: newCtx.data
              })
            };
          });
        } else {
          return {
            status: "valid",
            value: result.status === "valid" ? result.value : this._def.catchValue({
              get error() {
                return new ZodError_js_1.ZodError(newCtx.common.issues);
              },
              input: newCtx.data
            })
          };
        }
      }
      removeCatch() {
        return this._def.innerType;
      }
    };
    exports.ZodCatch = ZodCatch;
    ZodCatch.create = (type, params) => {
      return new ZodCatch({
        innerType: type,
        typeName: ZodFirstPartyTypeKind.ZodCatch,
        catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
        ...processCreateParams(params)
      });
    };
    var ZodNaN = class extends ZodType {
      _parse(input) {
        const parsedType = this._getType(input);
        if (parsedType !== util_js_1.ZodParsedType.nan) {
          const ctx = this._getOrReturnCtx(input);
          (0, parseUtil_js_1.addIssueToContext)(ctx, {
            code: ZodError_js_1.ZodIssueCode.invalid_type,
            expected: util_js_1.ZodParsedType.nan,
            received: ctx.parsedType
          });
          return parseUtil_js_1.INVALID;
        }
        return { status: "valid", value: input.data };
      }
    };
    exports.ZodNaN = ZodNaN;
    ZodNaN.create = (params) => {
      return new ZodNaN({
        typeName: ZodFirstPartyTypeKind.ZodNaN,
        ...processCreateParams(params)
      });
    };
    exports.BRAND = Symbol("zod_brand");
    var ZodBranded = class extends ZodType {
      _parse(input) {
        const { ctx } = this._processInputParams(input);
        const data = ctx.data;
        return this._def.type._parse({
          data,
          path: ctx.path,
          parent: ctx
        });
      }
      unwrap() {
        return this._def.type;
      }
    };
    exports.ZodBranded = ZodBranded;
    var ZodPipeline = class _ZodPipeline extends ZodType {
      _parse(input) {
        const { status, ctx } = this._processInputParams(input);
        if (ctx.common.async) {
          const handleAsync = async () => {
            const inResult = await this._def.in._parseAsync({
              data: ctx.data,
              path: ctx.path,
              parent: ctx
            });
            if (inResult.status === "aborted")
              return parseUtil_js_1.INVALID;
            if (inResult.status === "dirty") {
              status.dirty();
              return (0, parseUtil_js_1.DIRTY)(inResult.value);
            } else {
              return this._def.out._parseAsync({
                data: inResult.value,
                path: ctx.path,
                parent: ctx
              });
            }
          };
          return handleAsync();
        } else {
          const inResult = this._def.in._parseSync({
            data: ctx.data,
            path: ctx.path,
            parent: ctx
          });
          if (inResult.status === "aborted")
            return parseUtil_js_1.INVALID;
          if (inResult.status === "dirty") {
            status.dirty();
            return {
              status: "dirty",
              value: inResult.value
            };
          } else {
            return this._def.out._parseSync({
              data: inResult.value,
              path: ctx.path,
              parent: ctx
            });
          }
        }
      }
      static create(a, b) {
        return new _ZodPipeline({
          in: a,
          out: b,
          typeName: ZodFirstPartyTypeKind.ZodPipeline
        });
      }
    };
    exports.ZodPipeline = ZodPipeline;
    var ZodReadonly = class extends ZodType {
      _parse(input) {
        const result = this._def.innerType._parse(input);
        const freeze = (data) => {
          if ((0, parseUtil_js_1.isValid)(data)) {
            data.value = Object.freeze(data.value);
          }
          return data;
        };
        return (0, parseUtil_js_1.isAsync)(result) ? result.then((data) => freeze(data)) : freeze(result);
      }
      unwrap() {
        return this._def.innerType;
      }
    };
    exports.ZodReadonly = ZodReadonly;
    ZodReadonly.create = (type, params) => {
      return new ZodReadonly({
        innerType: type,
        typeName: ZodFirstPartyTypeKind.ZodReadonly,
        ...processCreateParams(params)
      });
    };
    function cleanParams(params, data) {
      const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
      const p2 = typeof p === "string" ? { message: p } : p;
      return p2;
    }
    function custom(check2, _params = {}, fatal) {
      if (check2)
        return ZodAny.create().superRefine((data, ctx) => {
          const r = check2(data);
          if (r instanceof Promise) {
            return r.then((r2) => {
              if (!r2) {
                const params = cleanParams(_params, data);
                const _fatal = params.fatal ?? fatal ?? true;
                ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
              }
            });
          }
          if (!r) {
            const params = cleanParams(_params, data);
            const _fatal = params.fatal ?? fatal ?? true;
            ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
          }
          return;
        });
      return ZodAny.create();
    }
    exports.late = {
      object: ZodObject.lazycreate
    };
    var ZodFirstPartyTypeKind;
    (function(ZodFirstPartyTypeKind2) {
      ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
      ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
      ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
      ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
      ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
      ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
      ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
      ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
      ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
      ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
      ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
      ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
      ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
      ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
      ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
      ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
      ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
      ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
      ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
      ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
      ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
      ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
      ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
      ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
      ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
      ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
      ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
      ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
      ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
      ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
      ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
      ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
      ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
      ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
      ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
      ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
    })(ZodFirstPartyTypeKind || (exports.ZodFirstPartyTypeKind = ZodFirstPartyTypeKind = {}));
    var instanceOfType = (cls, params = {
      message: `Input not instance of ${cls.name}`
    }) => custom((data) => data instanceof cls, params);
    exports.instanceof = instanceOfType;
    var stringType = ZodString.create;
    exports.string = stringType;
    var numberType = ZodNumber.create;
    exports.number = numberType;
    var nanType = ZodNaN.create;
    exports.nan = nanType;
    var bigIntType = ZodBigInt.create;
    exports.bigint = bigIntType;
    var booleanType = ZodBoolean.create;
    exports.boolean = booleanType;
    var dateType = ZodDate.create;
    exports.date = dateType;
    var symbolType = ZodSymbol.create;
    exports.symbol = symbolType;
    var undefinedType = ZodUndefined.create;
    exports.undefined = undefinedType;
    var nullType = ZodNull.create;
    exports.null = nullType;
    var anyType = ZodAny.create;
    exports.any = anyType;
    var unknownType = ZodUnknown.create;
    exports.unknown = unknownType;
    var neverType = ZodNever.create;
    exports.never = neverType;
    var voidType = ZodVoid.create;
    exports.void = voidType;
    var arrayType = ZodArray.create;
    exports.array = arrayType;
    var objectType = ZodObject.create;
    exports.object = objectType;
    var strictObjectType = ZodObject.strictCreate;
    exports.strictObject = strictObjectType;
    var unionType = ZodUnion.create;
    exports.union = unionType;
    var discriminatedUnionType = ZodDiscriminatedUnion.create;
    exports.discriminatedUnion = discriminatedUnionType;
    var intersectionType = ZodIntersection.create;
    exports.intersection = intersectionType;
    var tupleType = ZodTuple.create;
    exports.tuple = tupleType;
    var recordType = ZodRecord.create;
    exports.record = recordType;
    var mapType = ZodMap.create;
    exports.map = mapType;
    var setType = ZodSet.create;
    exports.set = setType;
    var functionType = ZodFunction.create;
    exports.function = functionType;
    var lazyType = ZodLazy.create;
    exports.lazy = lazyType;
    var literalType = ZodLiteral.create;
    exports.literal = literalType;
    var enumType = ZodEnum.create;
    exports.enum = enumType;
    var nativeEnumType = ZodNativeEnum.create;
    exports.nativeEnum = nativeEnumType;
    var promiseType = ZodPromise.create;
    exports.promise = promiseType;
    var effectsType = ZodEffects.create;
    exports.effect = effectsType;
    exports.transformer = effectsType;
    var optionalType = ZodOptional.create;
    exports.optional = optionalType;
    var nullableType = ZodNullable.create;
    exports.nullable = nullableType;
    var preprocessType = ZodEffects.createWithPreprocess;
    exports.preprocess = preprocessType;
    var pipelineType = ZodPipeline.create;
    exports.pipeline = pipelineType;
    var ostring = () => stringType().optional();
    exports.ostring = ostring;
    var onumber = () => numberType().optional();
    exports.onumber = onumber;
    var oboolean = () => booleanType().optional();
    exports.oboolean = oboolean;
    exports.coerce = {
      string: (arg) => ZodString.create({ ...arg, coerce: true }),
      number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
      boolean: (arg) => ZodBoolean.create({
        ...arg,
        coerce: true
      }),
      bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
      date: (arg) => ZodDate.create({ ...arg, coerce: true })
    };
    exports.NEVER = parseUtil_js_1.INVALID;
  }
});

// node_modules/zod/v3/external.cjs
var require_external = __commonJS({
  "node_modules/zod/v3/external.cjs"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_errors(), exports);
    __exportStar2(require_parseUtil(), exports);
    __exportStar2(require_typeAliases(), exports);
    __exportStar2(require_util(), exports);
    __exportStar2(require_types(), exports);
    __exportStar2(require_ZodError(), exports);
  }
});

// node_modules/zod/index.cjs
var require_zod = __commonJS({
  "node_modules/zod/index.cjs"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __setModuleDefault2 = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    } : function(o, v) {
      o["default"] = v;
    });
    var __importStar2 = exports && exports.__importStar || function(mod) {
      if (mod && mod.__esModule) return mod;
      var result = {};
      if (mod != null) {
        for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding2(result, mod, k);
      }
      __setModuleDefault2(result, mod);
      return result;
    };
    var __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.z = void 0;
    var z = __importStar2(require_external());
    exports.z = z;
    __exportStar2(require_external(), exports);
    exports.default = z;
  }
});

// node_modules/@atproto/common-web/dist/check.js
var require_check = __commonJS({
  "node_modules/@atproto/common-web/dist/check.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isObject = exports.assure = exports.create = exports.is = void 0;
    var is = (obj, def) => {
      return def.safeParse(obj).success;
    };
    exports.is = is;
    var create2 = (def) => (v) => def.safeParse(v).success;
    exports.create = create2;
    var assure = (def, obj) => {
      return def.parse(obj);
    };
    exports.assure = assure;
    var isObject2 = (obj) => {
      return typeof obj === "object" && obj !== null;
    };
    exports.isObject = isObject2;
  }
});

// node_modules/@atproto/common-web/dist/util.js
var require_util2 = __commonJS({
  "node_modules/@atproto/common-web/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.parseIntWithFallback = exports.dedupeStrs = exports.range = exports.chunkArray = exports.errHasMsg = exports.isErrnoException = exports.asyncFilter = exports.s32decode = exports.s32encode = exports.streamToBuffer = exports.flattenUint8Arrays = exports.bailableWait = exports.wait = exports.jitter = exports.noUndefinedVals = void 0;
    exports.aggregateErrors = aggregateErrors;
    exports.omit = omit;
    var noUndefinedVals = (obj) => {
      for (const k of Object.keys(obj)) {
        if (obj[k] === void 0) {
          delete obj[k];
        }
      }
      return obj;
    };
    exports.noUndefinedVals = noUndefinedVals;
    function aggregateErrors(errors, message2) {
      if (errors.length === 1) {
        return errors[0] instanceof Error ? errors[0] : new Error(message2 ?? stringifyError(errors[0]), { cause: errors[0] });
      } else {
        return new AggregateError(errors, message2 ?? `Multiple errors: ${errors.map(stringifyError).join("\n")}`);
      }
    }
    function stringifyError(reason) {
      if (reason instanceof Error) {
        return reason.message;
      }
      return String(reason);
    }
    function omit(src2, rejectedKeys) {
      if (!src2)
        return src2;
      const dst = {};
      const srcKeys = Object.keys(src2);
      for (let i = 0; i < srcKeys.length; i++) {
        const key = srcKeys[i];
        if (!rejectedKeys.includes(key)) {
          dst[key] = src2[key];
        }
      }
      return dst;
    }
    var jitter = (maxMs) => {
      return Math.round((Math.random() - 0.5) * maxMs * 2);
    };
    exports.jitter = jitter;
    var wait = (ms) => {
      return new Promise((res) => setTimeout(res, ms));
    };
    exports.wait = wait;
    var bailableWait = (ms) => {
      let bail;
      const waitPromise = new Promise((res) => {
        const timeout = setTimeout(res, ms);
        bail = () => {
          clearTimeout(timeout);
          res();
        };
      });
      return { bail, wait: () => waitPromise };
    };
    exports.bailableWait = bailableWait;
    var flattenUint8Arrays = (arrs) => {
      const length2 = arrs.reduce((acc, cur) => {
        return acc + cur.length;
      }, 0);
      const flattened = new Uint8Array(length2);
      let offset = 0;
      arrs.forEach((arr) => {
        flattened.set(arr, offset);
        offset += arr.length;
      });
      return flattened;
    };
    exports.flattenUint8Arrays = flattenUint8Arrays;
    var streamToBuffer = async (stream) => {
      const arrays = [];
      for await (const chunk of stream) {
        arrays.push(chunk);
      }
      return (0, exports.flattenUint8Arrays)(arrays);
    };
    exports.streamToBuffer = streamToBuffer;
    var S32_CHAR = "234567abcdefghijklmnopqrstuvwxyz";
    var s32encode = (i) => {
      let s = "";
      while (i) {
        const c = i % 32;
        i = Math.floor(i / 32);
        s = S32_CHAR.charAt(c) + s;
      }
      return s;
    };
    exports.s32encode = s32encode;
    var s32decode = (s) => {
      let i = 0;
      for (const c of s) {
        i = i * 32 + S32_CHAR.indexOf(c);
      }
      return i;
    };
    exports.s32decode = s32decode;
    var asyncFilter = async (arr, fn) => {
      const results = await Promise.all(arr.map((t) => fn(t)));
      return arr.filter((_, i) => results[i]);
    };
    exports.asyncFilter = asyncFilter;
    var isErrnoException = (err) => {
      return !!err && err["code"];
    };
    exports.isErrnoException = isErrnoException;
    var errHasMsg = (err, msg) => {
      return !!err && typeof err === "object" && err["message"] === msg;
    };
    exports.errHasMsg = errHasMsg;
    var chunkArray = (arr, chunkSize) => {
      return arr.reduce((acc, cur, i) => {
        const chunkI = Math.floor(i / chunkSize);
        if (!acc[chunkI]) {
          acc[chunkI] = [];
        }
        acc[chunkI].push(cur);
        return acc;
      }, []);
    };
    exports.chunkArray = chunkArray;
    var range = (num) => {
      const nums = [];
      for (let i = 0; i < num; i++) {
        nums.push(i);
      }
      return nums;
    };
    exports.range = range;
    var dedupeStrs = (strs) => {
      return [...new Set(strs)];
    };
    exports.dedupeStrs = dedupeStrs;
    var parseIntWithFallback = (value, fallback) => {
      const parsed = parseInt(value || "", 10);
      return isNaN(parsed) ? fallback : parsed;
    };
    exports.parseIntWithFallback = parseIntWithFallback;
  }
});

// node_modules/@atproto/common-web/dist/arrays.js
var require_arrays = __commonJS({
  "node_modules/@atproto/common-web/dist/arrays.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.mapDefined = void 0;
    exports.keyBy = keyBy;
    function keyBy(arr, key) {
      return arr.reduce((acc, cur) => {
        acc.set(cur[key], cur);
        return acc;
      }, /* @__PURE__ */ new Map());
    }
    var mapDefined = (arr, fn) => {
      const output = [];
      for (const item of arr) {
        const val = fn(item);
        if (val !== void 0) {
          output.push(val);
        }
      }
      return output;
    };
    exports.mapDefined = mapDefined;
  }
});

// node_modules/@atproto/common-web/dist/async.js
var require_async = __commonJS({
  "node_modules/@atproto/common-web/dist/async.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AsyncBufferFullError = exports.AsyncBuffer = exports.allComplete = exports.createDeferrables = exports.readFromGenerator = void 0;
    exports.createDeferrable = createDeferrable;
    exports.allFulfilled = allFulfilled;
    exports.handleAllSettledErrors = handleAllSettledErrors;
    exports.isRejectedResult = isRejectedResult;
    exports.isFulfilledResult = isFulfilledResult;
    var util_1 = require_util2();
    var readFromGenerator = async (gen, isDone, waitFor = Promise.resolve(), maxLength = Number.MAX_SAFE_INTEGER) => {
      const evts = [];
      let bail;
      let hasBroke = false;
      const awaitDone = async () => {
        if (await isDone(evts.at(-1))) {
          return true;
        }
        const bailable = (0, util_1.bailableWait)(20);
        await bailable.wait();
        bail = bailable.bail;
        if (hasBroke)
          return false;
        return await awaitDone();
      };
      const breakOn = new Promise((resolve) => {
        waitFor.then(() => {
          awaitDone().then(() => resolve());
        });
      });
      try {
        while (evts.length < maxLength) {
          const maybeEvt = await Promise.race([gen.next(), breakOn]);
          if (!maybeEvt)
            break;
          const evt = maybeEvt;
          if (evt.done)
            break;
          evts.push(evt.value);
        }
      } finally {
        hasBroke = true;
        bail && bail();
      }
      return evts;
    };
    exports.readFromGenerator = readFromGenerator;
    function createDeferrable() {
      let res;
      let rej;
      const promise = new Promise((resolve, reject) => {
        res = resolve;
        rej = reject;
      });
      return { resolve: res, reject: rej, complete: promise };
    }
    var createDeferrables = (count) => {
      const list = [];
      for (let i = 0; i < count; i++) {
        list.push(createDeferrable());
      }
      return list;
    };
    exports.createDeferrables = createDeferrables;
    var allComplete = async (deferrables) => {
      await Promise.all(deferrables.map((d) => d.complete));
    };
    exports.allComplete = allComplete;
    var AsyncBuffer = class {
      constructor(maxSize) {
        Object.defineProperty(this, "maxSize", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: maxSize
        });
        Object.defineProperty(this, "buffer", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: []
        });
        Object.defineProperty(this, "promise", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "resolve", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "closed", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: false
        });
        Object.defineProperty(this, "toThrow", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.promise = Promise.resolve();
        this.resolve = () => null;
        this.resetPromise();
      }
      get curr() {
        return this.buffer;
      }
      get size() {
        return this.buffer.length;
      }
      get isClosed() {
        return this.closed;
      }
      resetPromise() {
        this.promise = new Promise((r) => this.resolve = r);
      }
      push(item) {
        this.buffer.push(item);
        this.resolve();
      }
      pushMany(items) {
        items.forEach((i) => this.buffer.push(i));
        this.resolve();
      }
      async *events() {
        while (true) {
          if (this.closed && this.buffer.length === 0) {
            if (this.toThrow) {
              throw this.toThrow;
            } else {
              return;
            }
          }
          await this.promise;
          if (this.toThrow) {
            throw this.toThrow;
          }
          if (this.maxSize && this.size > this.maxSize) {
            throw new AsyncBufferFullError(this.maxSize);
          }
          const [first, ...rest] = this.buffer;
          if (first) {
            this.buffer = rest;
            yield first;
          } else {
            this.resetPromise();
          }
        }
      }
      throw(err) {
        this.toThrow = err;
        this.closed = true;
        this.resolve();
      }
      close() {
        this.closed = true;
        this.resolve();
      }
    };
    exports.AsyncBuffer = AsyncBuffer;
    var AsyncBufferFullError = class extends Error {
      constructor(maxSize) {
        super(`ReachedMaxBufferSize: ${maxSize}`);
      }
    };
    exports.AsyncBufferFullError = AsyncBufferFullError;
    function allFulfilled(promises) {
      return Promise.allSettled(promises).then(handleAllSettledErrors);
    }
    function handleAllSettledErrors(results) {
      if (results.every(isFulfilledResult))
        return results.map(extractValue);
      const errors = results.filter(isRejectedResult).map(extractReason);
      throw (0, util_1.aggregateErrors)(errors);
    }
    function isRejectedResult(result) {
      return result.status === "rejected";
    }
    function extractReason(result) {
      return result.reason;
    }
    function isFulfilledResult(result) {
      return result.status === "fulfilled";
    }
    function extractValue(result) {
      return result.value;
    }
  }
});

// node_modules/@atproto/common-web/dist/tid.js
var require_tid = __commonJS({
  "node_modules/@atproto/common-web/dist/tid.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.TID = void 0;
    var util_1 = require_util2();
    var TID_LEN = 13;
    var lastTimestamp = 0;
    var timestampCount = 0;
    var clockid = null;
    function dedash(str) {
      return str.replaceAll("-", "");
    }
    var TID = class _TID {
      constructor(str) {
        Object.defineProperty(this, "str", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        const noDashes = dedash(str);
        if (noDashes.length !== TID_LEN) {
          throw new Error(`Poorly formatted TID: ${noDashes.length} length`);
        }
        this.str = noDashes;
      }
      static next(prev) {
        const time = Math.max(Date.now(), lastTimestamp);
        if (time === lastTimestamp) {
          timestampCount++;
        }
        lastTimestamp = time;
        const timestamp = time * 1e3 + timestampCount;
        if (clockid === null) {
          clockid = Math.floor(Math.random() * 32);
        }
        const tid = _TID.fromTime(timestamp, clockid);
        if (!prev || tid.newerThan(prev)) {
          return tid;
        }
        return _TID.fromTime(prev.timestamp() + 1, clockid);
      }
      static nextStr(prev) {
        return _TID.next(prev ? new _TID(prev) : void 0).toString();
      }
      static fromTime(timestamp, clockid2) {
        const str = `${(0, util_1.s32encode)(timestamp)}${(0, util_1.s32encode)(clockid2).padStart(2, "2")}`;
        return new _TID(str);
      }
      static fromStr(str) {
        return new _TID(str);
      }
      static oldestFirst(a, b) {
        return a.compareTo(b);
      }
      static newestFirst(a, b) {
        return b.compareTo(a);
      }
      static is(str) {
        return dedash(str).length === TID_LEN;
      }
      timestamp() {
        return (0, util_1.s32decode)(this.str.slice(0, 11));
      }
      clockid() {
        return (0, util_1.s32decode)(this.str.slice(11, 13));
      }
      formatted() {
        const str = this.toString();
        return `${str.slice(0, 4)}-${str.slice(4, 7)}-${str.slice(7, 11)}-${str.slice(11, 13)}`;
      }
      toString() {
        return this.str;
      }
      // newer > older
      compareTo(other) {
        if (this.str > other.str)
          return 1;
        if (this.str < other.str)
          return -1;
        return 0;
      }
      equals(other) {
        return this.str === other.str;
      }
      newerThan(other) {
        return this.compareTo(other) > 0;
      }
      olderThan(other) {
        return this.compareTo(other) < 0;
      }
    };
    exports.TID = TID;
  }
});

// node_modules/tslib/tslib.es6.mjs
var tslib_es6_exports = {};
__export(tslib_es6_exports, {
  __addDisposableResource: () => __addDisposableResource,
  __assign: () => __assign,
  __asyncDelegator: () => __asyncDelegator,
  __asyncGenerator: () => __asyncGenerator,
  __asyncValues: () => __asyncValues,
  __await: () => __await,
  __awaiter: () => __awaiter,
  __classPrivateFieldGet: () => __classPrivateFieldGet,
  __classPrivateFieldIn: () => __classPrivateFieldIn,
  __classPrivateFieldSet: () => __classPrivateFieldSet,
  __createBinding: () => __createBinding,
  __decorate: () => __decorate,
  __disposeResources: () => __disposeResources,
  __esDecorate: () => __esDecorate,
  __exportStar: () => __exportStar,
  __extends: () => __extends,
  __generator: () => __generator,
  __importDefault: () => __importDefault,
  __importStar: () => __importStar,
  __makeTemplateObject: () => __makeTemplateObject,
  __metadata: () => __metadata,
  __param: () => __param,
  __propKey: () => __propKey,
  __read: () => __read,
  __rest: () => __rest,
  __rewriteRelativeImportExtension: () => __rewriteRelativeImportExtension,
  __runInitializers: () => __runInitializers,
  __setFunctionName: () => __setFunctionName,
  __spread: () => __spread,
  __spreadArray: () => __spreadArray,
  __spreadArrays: () => __spreadArrays,
  __values: () => __values,
  default: () => tslib_es6_default
});
function __extends(d, b) {
  if (typeof b !== "function" && b !== null)
    throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  extendStatics(d, b);
  function __() {
    this.constructor = d;
  }
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __rest(s, e) {
  var t = {};
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
    t[p] = s[p];
  if (s != null && typeof Object.getOwnPropertySymbols === "function")
    for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
      if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
        t[p[i]] = s[p[i]];
    }
  return t;
}
function __decorate(decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
  return function(target, key) {
    decorator(target, key, paramIndex);
  };
}
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
  function accept(f) {
    if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
    return f;
  }
  var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
  var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
  var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
  var _, done = false;
  for (var i = decorators.length - 1; i >= 0; i--) {
    var context = {};
    for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
    for (var p in contextIn.access) context.access[p] = contextIn.access[p];
    context.addInitializer = function(f) {
      if (done) throw new TypeError("Cannot add initializers after decoration has completed");
      extraInitializers.push(accept(f || null));
    };
    var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
    if (kind === "accessor") {
      if (result === void 0) continue;
      if (result === null || typeof result !== "object") throw new TypeError("Object expected");
      if (_ = accept(result.get)) descriptor.get = _;
      if (_ = accept(result.set)) descriptor.set = _;
      if (_ = accept(result.init)) initializers.unshift(_);
    } else if (_ = accept(result)) {
      if (kind === "field") initializers.unshift(_);
      else descriptor[key] = _;
    }
  }
  if (target) Object.defineProperty(target, contextIn.name, descriptor);
  done = true;
}
function __runInitializers(thisArg, initializers, value) {
  var useValue = arguments.length > 2;
  for (var i = 0; i < initializers.length; i++) {
    value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
  }
  return useValue ? value : void 0;
}
function __propKey(x) {
  return typeof x === "symbol" ? x : "".concat(x);
}
function __setFunctionName(f, name2, prefix) {
  if (typeof name2 === "symbol") name2 = name2.description ? "[".concat(name2.description, "]") : "";
  return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name2) : name2 });
}
function __metadata(metadataKey, metadataValue) {
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
  function adopt(value) {
    return value instanceof P ? value : new P(function(resolve) {
      resolve(value);
    });
  }
  return new (P || (P = Promise))(function(resolve, reject) {
    function fulfilled(value) {
      try {
        step(generator.next(value));
      } catch (e) {
        reject(e);
      }
    }
    function rejected(value) {
      try {
        step(generator["throw"](value));
      } catch (e) {
        reject(e);
      }
    }
    function step(result) {
      result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
    }
    step((generator = generator.apply(thisArg, _arguments || [])).next());
  });
}
function __generator(thisArg, body) {
  var _ = { label: 0, sent: function() {
    if (t[0] & 1) throw t[1];
    return t[1];
  }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
  return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
    return this;
  }), g;
  function verb(n) {
    return function(v) {
      return step([n, v]);
    };
  }
  function step(op) {
    if (f) throw new TypeError("Generator is already executing.");
    while (g && (g = 0, op[0] && (_ = 0)), _) try {
      if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
      if (y = 0, t) op = [op[0] & 2, t.value];
      switch (op[0]) {
        case 0:
        case 1:
          t = op;
          break;
        case 4:
          _.label++;
          return { value: op[1], done: false };
        case 5:
          _.label++;
          y = op[1];
          op = [0];
          continue;
        case 7:
          op = _.ops.pop();
          _.trys.pop();
          continue;
        default:
          if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
            _ = 0;
            continue;
          }
          if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
            _.label = op[1];
            break;
          }
          if (op[0] === 6 && _.label < t[1]) {
            _.label = t[1];
            t = op;
            break;
          }
          if (t && _.label < t[2]) {
            _.label = t[2];
            _.ops.push(op);
            break;
          }
          if (t[2]) _.ops.pop();
          _.trys.pop();
          continue;
      }
      op = body.call(thisArg, _);
    } catch (e) {
      op = [6, e];
      y = 0;
    } finally {
      f = t = 0;
    }
    if (op[0] & 5) throw op[1];
    return { value: op[0] ? op[1] : void 0, done: true };
  }
}
function __exportStar(m, o) {
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
function __values(o) {
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  if (m) return m.call(o);
  if (o && typeof o.length === "number") return {
    next: function() {
      if (o && i >= o.length) o = void 0;
      return { value: o && o[i++], done: !o };
    }
  };
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
  var m = typeof Symbol === "function" && o[Symbol.iterator];
  if (!m) return o;
  var i = m.call(o), r, ar = [], e;
  try {
    while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  } catch (error) {
    e = { error };
  } finally {
    try {
      if (r && !r.done && (m = i["return"])) m.call(i);
    } finally {
      if (e) throw e.error;
    }
  }
  return ar;
}
function __spread() {
  for (var ar = [], i = 0; i < arguments.length; i++)
    ar = ar.concat(__read(arguments[i]));
  return ar;
}
function __spreadArrays() {
  for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
  for (var r = Array(s), k = 0, i = 0; i < il; i++)
    for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
      r[k] = a[j];
  return r;
}
function __spreadArray(to, from3, pack) {
  if (pack || arguments.length === 2) for (var i = 0, l = from3.length, ar; i < l; i++) {
    if (ar || !(i in from3)) {
      if (!ar) ar = Array.prototype.slice.call(from3, 0, i);
      ar[i] = from3[i];
    }
  }
  return to.concat(ar || Array.prototype.slice.call(from3));
}
function __await(v) {
  return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
  return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function() {
    return this;
  }, i;
  function awaitReturn(f) {
    return function(v) {
      return Promise.resolve(v).then(f, reject);
    };
  }
  function verb(n, f) {
    if (g[n]) {
      i[n] = function(v) {
        return new Promise(function(a, b) {
          q.push([n, v, a, b]) > 1 || resume(n, v);
        });
      };
      if (f) i[n] = f(i[n]);
    }
  }
  function resume(n, v) {
    try {
      step(g[n](v));
    } catch (e) {
      settle(q[0][3], e);
    }
  }
  function step(r) {
    r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);
  }
  function fulfill(value) {
    resume("next", value);
  }
  function reject(value) {
    resume("throw", value);
  }
  function settle(f, v) {
    if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);
  }
}
function __asyncDelegator(o) {
  var i, p;
  return i = {}, verb("next"), verb("throw", function(e) {
    throw e;
  }), verb("return"), i[Symbol.iterator] = function() {
    return this;
  }, i;
  function verb(n, f) {
    i[n] = o[n] ? function(v) {
      return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v;
    } : f;
  }
}
function __asyncValues(o) {
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  var m = o[Symbol.asyncIterator], i;
  return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() {
    return this;
  }, i);
  function verb(n) {
    i[n] = o[n] && function(v) {
      return new Promise(function(resolve, reject) {
        v = o[n](v), settle(resolve, reject, v.done, v.value);
      });
    };
  }
  function settle(resolve, reject, d, v) {
    Promise.resolve(v).then(function(v2) {
      resolve({ value: v2, done: d });
    }, reject);
  }
}
function __makeTemplateObject(cooked, raw) {
  if (Object.defineProperty) {
    Object.defineProperty(cooked, "raw", { value: raw });
  } else {
    cooked.raw = raw;
  }
  return cooked;
}
function __importStar(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;
}
function __importDefault(mod) {
  return mod && mod.__esModule ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, state, kind, f) {
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
  if (kind === "m") throw new TypeError("Private method is not writable");
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
  return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
}
function __classPrivateFieldIn(state, receiver) {
  if (receiver === null || typeof receiver !== "object" && typeof receiver !== "function") throw new TypeError("Cannot use 'in' operator on non-object");
  return typeof state === "function" ? receiver === state : state.has(receiver);
}
function __addDisposableResource(env, value, async) {
  if (value !== null && value !== void 0) {
    if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
    var dispose, inner;
    if (async) {
      if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
      dispose = value[Symbol.asyncDispose];
    }
    if (dispose === void 0) {
      if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
      dispose = value[Symbol.dispose];
      if (async) inner = dispose;
    }
    if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
    if (inner) dispose = function() {
      try {
        inner.call(this);
      } catch (e) {
        return Promise.reject(e);
      }
    };
    env.stack.push({ value, dispose, async });
  } else if (async) {
    env.stack.push({ async: true });
  }
  return value;
}
function __disposeResources(env) {
  function fail(e) {
    env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
    env.hasError = true;
  }
  var r, s = 0;
  function next() {
    while (r = env.stack.pop()) {
      try {
        if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
        if (r.dispose) {
          var result = r.dispose.call(r.value);
          if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
            fail(e);
            return next();
          });
        } else s |= 1;
      } catch (e) {
        fail(e);
      }
    }
    if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
    if (env.hasError) throw env.error;
  }
  return next();
}
function __rewriteRelativeImportExtension(path, preserveJsx) {
  if (typeof path === "string" && /^\.\.?\//.test(path)) {
    return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
      return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
    });
  }
  return path;
}
var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
var init_tslib_es6 = __esm({
  "node_modules/tslib/tslib.es6.mjs"() {
    extendStatics = function(d, b) {
      extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
        d2.__proto__ = b2;
      } || function(d2, b2) {
        for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
      };
      return extendStatics(d, b);
    };
    __assign = function() {
      __assign = Object.assign || function __assign2(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
          s = arguments[i];
          for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
      };
      return __assign.apply(this, arguments);
    };
    __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];
    };
    __setModuleDefault = Object.create ? function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    } : function(o, v) {
      o["default"] = v;
    };
    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);
    };
    _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message2) {
      var e = new Error(message2);
      return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
    };
    tslib_es6_default = {
      __extends,
      __assign,
      __rest,
      __decorate,
      __param,
      __esDecorate,
      __runInitializers,
      __propKey,
      __setFunctionName,
      __metadata,
      __awaiter,
      __generator,
      __createBinding,
      __exportStar,
      __values,
      __read,
      __spread,
      __spreadArrays,
      __spreadArray,
      __await,
      __asyncGenerator,
      __asyncDelegator,
      __asyncValues,
      __makeTemplateObject,
      __importStar,
      __importDefault,
      __classPrivateFieldGet,
      __classPrivateFieldSet,
      __classPrivateFieldIn,
      __addDisposableResource,
      __disposeResources,
      __rewriteRelativeImportExtension
    };
  }
});

// node_modules/multiformats/esm/vendor/varint.js
function encode(num, out, offset) {
  out = out || [];
  offset = offset || 0;
  var oldOffset = offset;
  while (num >= INT) {
    out[offset++] = num & 255 | MSB;
    num /= 128;
  }
  while (num & MSBALL) {
    out[offset++] = num & 255 | MSB;
    num >>>= 7;
  }
  out[offset] = num | 0;
  encode.bytes = offset - oldOffset + 1;
  return out;
}
function read(buf, offset) {
  var res = 0, offset = offset || 0, shift = 0, counter = offset, b, l = buf.length;
  do {
    if (counter >= l) {
      read.bytes = 0;
      throw new RangeError("Could not decode varint");
    }
    b = buf[counter++];
    res += shift < 28 ? (b & REST$1) << shift : (b & REST$1) * Math.pow(2, shift);
    shift += 7;
  } while (b >= MSB$1);
  read.bytes = counter - offset;
  return res;
}
var encode_1, MSB, REST, MSBALL, INT, decode, MSB$1, REST$1, N1, N2, N3, N4, N5, N6, N7, N8, N9, length, varint, _brrp_varint, varint_default;
var init_varint = __esm({
  "node_modules/multiformats/esm/vendor/varint.js"() {
    encode_1 = encode;
    MSB = 128;
    REST = 127;
    MSBALL = ~REST;
    INT = Math.pow(2, 31);
    decode = read;
    MSB$1 = 128;
    REST$1 = 127;
    N1 = Math.pow(2, 7);
    N2 = Math.pow(2, 14);
    N3 = Math.pow(2, 21);
    N4 = Math.pow(2, 28);
    N5 = Math.pow(2, 35);
    N6 = Math.pow(2, 42);
    N7 = Math.pow(2, 49);
    N8 = Math.pow(2, 56);
    N9 = Math.pow(2, 63);
    length = function(value) {
      return value < N1 ? 1 : value < N2 ? 2 : value < N3 ? 3 : value < N4 ? 4 : value < N5 ? 5 : value < N6 ? 6 : value < N7 ? 7 : value < N8 ? 8 : value < N9 ? 9 : 10;
    };
    varint = {
      encode: encode_1,
      decode,
      encodingLength: length
    };
    _brrp_varint = varint;
    varint_default = _brrp_varint;
  }
});

// node_modules/multiformats/esm/src/varint.js
var decode2, encodeTo, encodingLength;
var init_varint2 = __esm({
  "node_modules/multiformats/esm/src/varint.js"() {
    init_varint();
    decode2 = (data, offset = 0) => {
      const code2 = varint_default.decode(data, offset);
      return [
        code2,
        varint_default.decode.bytes
      ];
    };
    encodeTo = (int, target, offset = 0) => {
      varint_default.encode(int, target, offset);
      return target;
    };
    encodingLength = (int) => {
      return varint_default.encodingLength(int);
    };
  }
});

// node_modules/multiformats/esm/src/bytes.js
var empty, equals, coerce, fromString, toString;
var init_bytes = __esm({
  "node_modules/multiformats/esm/src/bytes.js"() {
    empty = new Uint8Array(0);
    equals = (aa, bb) => {
      if (aa === bb)
        return true;
      if (aa.byteLength !== bb.byteLength) {
        return false;
      }
      for (let ii = 0; ii < aa.byteLength; ii++) {
        if (aa[ii] !== bb[ii]) {
          return false;
        }
      }
      return true;
    };
    coerce = (o) => {
      if (o instanceof Uint8Array && o.constructor.name === "Uint8Array")
        return o;
      if (o instanceof ArrayBuffer)
        return new Uint8Array(o);
      if (ArrayBuffer.isView(o)) {
        return new Uint8Array(o.buffer, o.byteOffset, o.byteLength);
      }
      throw new Error("Unknown type, must be binary type");
    };
    fromString = (str) => new TextEncoder().encode(str);
    toString = (b) => new TextDecoder().decode(b);
  }
});

// node_modules/multiformats/esm/src/hashes/digest.js
var digest_exports = {};
__export(digest_exports, {
  Digest: () => Digest,
  create: () => create,
  decode: () => decode3,
  equals: () => equals2
});
var create, decode3, equals2, Digest;
var init_digest = __esm({
  "node_modules/multiformats/esm/src/hashes/digest.js"() {
    init_bytes();
    init_varint2();
    create = (code2, digest3) => {
      const size = digest3.byteLength;
      const sizeOffset = encodingLength(code2);
      const digestOffset = sizeOffset + encodingLength(size);
      const bytes = new Uint8Array(digestOffset + size);
      encodeTo(code2, bytes, 0);
      encodeTo(size, bytes, sizeOffset);
      bytes.set(digest3, digestOffset);
      return new Digest(code2, size, digest3, bytes);
    };
    decode3 = (multihash) => {
      const bytes = coerce(multihash);
      const [code2, sizeOffset] = decode2(bytes);
      const [size, digestOffset] = decode2(bytes.subarray(sizeOffset));
      const digest3 = bytes.subarray(sizeOffset + digestOffset);
      if (digest3.byteLength !== size) {
        throw new Error("Incorrect length");
      }
      return new Digest(code2, size, digest3, bytes);
    };
    equals2 = (a, b) => {
      if (a === b) {
        return true;
      } else {
        return a.code === b.code && a.size === b.size && equals(a.bytes, b.bytes);
      }
    };
    Digest = class {
      constructor(code2, size, digest3, bytes) {
        this.code = code2;
        this.size = size;
        this.digest = digest3;
        this.bytes = bytes;
      }
    };
  }
});

// node_modules/multiformats/esm/vendor/base-x.js
function base(ALPHABET, name2) {
  if (ALPHABET.length >= 255) {
    throw new TypeError("Alphabet too long");
  }
  var BASE_MAP = new Uint8Array(256);
  for (var j = 0; j < BASE_MAP.length; j++) {
    BASE_MAP[j] = 255;
  }
  for (var i = 0; i < ALPHABET.length; i++) {
    var x = ALPHABET.charAt(i);
    var xc = x.charCodeAt(0);
    if (BASE_MAP[xc] !== 255) {
      throw new TypeError(x + " is ambiguous");
    }
    BASE_MAP[xc] = i;
  }
  var BASE = ALPHABET.length;
  var LEADER = ALPHABET.charAt(0);
  var FACTOR = Math.log(BASE) / Math.log(256);
  var iFACTOR = Math.log(256) / Math.log(BASE);
  function encode7(source) {
    if (source instanceof Uint8Array) ;
    else if (ArrayBuffer.isView(source)) {
      source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
    } else if (Array.isArray(source)) {
      source = Uint8Array.from(source);
    }
    if (!(source instanceof Uint8Array)) {
      throw new TypeError("Expected Uint8Array");
    }
    if (source.length === 0) {
      return "";
    }
    var zeroes = 0;
    var length2 = 0;
    var pbegin = 0;
    var pend = source.length;
    while (pbegin !== pend && source[pbegin] === 0) {
      pbegin++;
      zeroes++;
    }
    var size = (pend - pbegin) * iFACTOR + 1 >>> 0;
    var b58 = new Uint8Array(size);
    while (pbegin !== pend) {
      var carry = source[pbegin];
      var i2 = 0;
      for (var it1 = size - 1; (carry !== 0 || i2 < length2) && it1 !== -1; it1--, i2++) {
        carry += 256 * b58[it1] >>> 0;
        b58[it1] = carry % BASE >>> 0;
        carry = carry / BASE >>> 0;
      }
      if (carry !== 0) {
        throw new Error("Non-zero carry");
      }
      length2 = i2;
      pbegin++;
    }
    var it2 = size - length2;
    while (it2 !== size && b58[it2] === 0) {
      it2++;
    }
    var str = LEADER.repeat(zeroes);
    for (; it2 < size; ++it2) {
      str += ALPHABET.charAt(b58[it2]);
    }
    return str;
  }
  function decodeUnsafe(source) {
    if (typeof source !== "string") {
      throw new TypeError("Expected String");
    }
    if (source.length === 0) {
      return new Uint8Array();
    }
    var psz = 0;
    if (source[psz] === " ") {
      return;
    }
    var zeroes = 0;
    var length2 = 0;
    while (source[psz] === LEADER) {
      zeroes++;
      psz++;
    }
    var size = (source.length - psz) * FACTOR + 1 >>> 0;
    var b256 = new Uint8Array(size);
    while (source[psz]) {
      var carry = BASE_MAP[source.charCodeAt(psz)];
      if (carry === 255) {
        return;
      }
      var i2 = 0;
      for (var it3 = size - 1; (carry !== 0 || i2 < length2) && it3 !== -1; it3--, i2++) {
        carry += BASE * b256[it3] >>> 0;
        b256[it3] = carry % 256 >>> 0;
        carry = carry / 256 >>> 0;
      }
      if (carry !== 0) {
        throw new Error("Non-zero carry");
      }
      length2 = i2;
      psz++;
    }
    if (source[psz] === " ") {
      return;
    }
    var it4 = size - length2;
    while (it4 !== size && b256[it4] === 0) {
      it4++;
    }
    var vch = new Uint8Array(zeroes + (size - it4));
    var j2 = zeroes;
    while (it4 !== size) {
      vch[j2++] = b256[it4++];
    }
    return vch;
  }
  function decode8(string2) {
    var buffer = decodeUnsafe(string2);
    if (buffer) {
      return buffer;
    }
    throw new Error(`Non-${name2} character`);
  }
  return {
    encode: encode7,
    decodeUnsafe,
    decode: decode8
  };
}
var src, _brrp__multiformats_scope_baseX, base_x_default;
var init_base_x = __esm({
  "node_modules/multiformats/esm/vendor/base-x.js"() {
    src = base;
    _brrp__multiformats_scope_baseX = src;
    base_x_default = _brrp__multiformats_scope_baseX;
  }
});

// node_modules/multiformats/esm/src/bases/base.js
var Encoder, Decoder, ComposedDecoder, or, Codec, from, baseX, decode4, encode2, rfc4648;
var init_base = __esm({
  "node_modules/multiformats/esm/src/bases/base.js"() {
    init_base_x();
    init_bytes();
    Encoder = class {
      constructor(name2, prefix, baseEncode) {
        this.name = name2;
        this.prefix = prefix;
        this.baseEncode = baseEncode;
      }
      encode(bytes) {
        if (bytes instanceof Uint8Array) {
          return `${this.prefix}${this.baseEncode(bytes)}`;
        } else {
          throw Error("Unknown type, must be binary type");
        }
      }
    };
    Decoder = class {
      constructor(name2, prefix, baseDecode) {
        this.name = name2;
        this.prefix = prefix;
        if (prefix.codePointAt(0) === void 0) {
          throw new Error("Invalid prefix character");
        }
        this.prefixCodePoint = prefix.codePointAt(0);
        this.baseDecode = baseDecode;
      }
      decode(text) {
        if (typeof text === "string") {
          if (text.codePointAt(0) !== this.prefixCodePoint) {
            throw Error(`Unable to decode multibase string ${JSON.stringify(text)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);
          }
          return this.baseDecode(text.slice(this.prefix.length));
        } else {
          throw Error("Can only multibase decode strings");
        }
      }
      or(decoder2) {
        return or(this, decoder2);
      }
    };
    ComposedDecoder = class {
      constructor(decoders) {
        this.decoders = decoders;
      }
      or(decoder2) {
        return or(this, decoder2);
      }
      decode(input) {
        const prefix = input[0];
        const decoder2 = this.decoders[prefix];
        if (decoder2) {
          return decoder2.decode(input);
        } else {
          throw RangeError(`Unable to decode multibase string ${JSON.stringify(input)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`);
        }
      }
    };
    or = (left, right) => new ComposedDecoder({
      ...left.decoders || { [left.prefix]: left },
      ...right.decoders || { [right.prefix]: right }
    });
    Codec = class {
      constructor(name2, prefix, baseEncode, baseDecode) {
        this.name = name2;
        this.prefix = prefix;
        this.baseEncode = baseEncode;
        this.baseDecode = baseDecode;
        this.encoder = new Encoder(name2, prefix, baseEncode);
        this.decoder = new Decoder(name2, prefix, baseDecode);
      }
      encode(input) {
        return this.encoder.encode(input);
      }
      decode(input) {
        return this.decoder.decode(input);
      }
    };
    from = ({ name: name2, prefix, encode: encode7, decode: decode8 }) => new Codec(name2, prefix, encode7, decode8);
    baseX = ({ prefix, name: name2, alphabet: alphabet2 }) => {
      const { encode: encode7, decode: decode8 } = base_x_default(alphabet2, name2);
      return from({
        prefix,
        name: name2,
        encode: encode7,
        decode: (text) => coerce(decode8(text))
      });
    };
    decode4 = (string2, alphabet2, bitsPerChar, name2) => {
      const codes = {};
      for (let i = 0; i < alphabet2.length; ++i) {
        codes[alphabet2[i]] = i;
      }
      let end = string2.length;
      while (string2[end - 1] === "=") {
        --end;
      }
      const out = new Uint8Array(end * bitsPerChar / 8 | 0);
      let bits = 0;
      let buffer = 0;
      let written = 0;
      for (let i = 0; i < end; ++i) {
        const value = codes[string2[i]];
        if (value === void 0) {
          throw new SyntaxError(`Non-${name2} character`);
        }
        buffer = buffer << bitsPerChar | value;
        bits += bitsPerChar;
        if (bits >= 8) {
          bits -= 8;
          out[written++] = 255 & buffer >> bits;
        }
      }
      if (bits >= bitsPerChar || 255 & buffer << 8 - bits) {
        throw new SyntaxError("Unexpected end of data");
      }
      return out;
    };
    encode2 = (data, alphabet2, bitsPerChar) => {
      const pad = alphabet2[alphabet2.length - 1] === "=";
      const mask = (1 << bitsPerChar) - 1;
      let out = "";
      let bits = 0;
      let buffer = 0;
      for (let i = 0; i < data.length; ++i) {
        buffer = buffer << 8 | data[i];
        bits += 8;
        while (bits > bitsPerChar) {
          bits -= bitsPerChar;
          out += alphabet2[mask & buffer >> bits];
        }
      }
      if (bits) {
        out += alphabet2[mask & buffer << bitsPerChar - bits];
      }
      if (pad) {
        while (out.length * bitsPerChar & 7) {
          out += "=";
        }
      }
      return out;
    };
    rfc4648 = ({ name: name2, prefix, bitsPerChar, alphabet: alphabet2 }) => {
      return from({
        prefix,
        name: name2,
        encode(input) {
          return encode2(input, alphabet2, bitsPerChar);
        },
        decode(input) {
          return decode4(input, alphabet2, bitsPerChar, name2);
        }
      });
    };
  }
});

// node_modules/multiformats/esm/src/bases/base58.js
var base58_exports = {};
__export(base58_exports, {
  base58btc: () => base58btc,
  base58flickr: () => base58flickr
});
var base58btc, base58flickr;
var init_base58 = __esm({
  "node_modules/multiformats/esm/src/bases/base58.js"() {
    init_base();
    base58btc = baseX({
      name: "base58btc",
      prefix: "z",
      alphabet: "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
    });
    base58flickr = baseX({
      name: "base58flickr",
      prefix: "Z",
      alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
    });
  }
});

// node_modules/multiformats/esm/src/bases/base32.js
var base32_exports = {};
__export(base32_exports, {
  base32: () => base32,
  base32hex: () => base32hex,
  base32hexpad: () => base32hexpad,
  base32hexpadupper: () => base32hexpadupper,
  base32hexupper: () => base32hexupper,
  base32pad: () => base32pad,
  base32padupper: () => base32padupper,
  base32upper: () => base32upper,
  base32z: () => base32z
});
var base32, base32upper, base32pad, base32padupper, base32hex, base32hexupper, base32hexpad, base32hexpadupper, base32z;
var init_base32 = __esm({
  "node_modules/multiformats/esm/src/bases/base32.js"() {
    init_base();
    base32 = rfc4648({
      prefix: "b",
      name: "base32",
      alphabet: "abcdefghijklmnopqrstuvwxyz234567",
      bitsPerChar: 5
    });
    base32upper = rfc4648({
      prefix: "B",
      name: "base32upper",
      alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",
      bitsPerChar: 5
    });
    base32pad = rfc4648({
      prefix: "c",
      name: "base32pad",
      alphabet: "abcdefghijklmnopqrstuvwxyz234567=",
      bitsPerChar: 5
    });
    base32padupper = rfc4648({
      prefix: "C",
      name: "base32padupper",
      alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",
      bitsPerChar: 5
    });
    base32hex = rfc4648({
      prefix: "v",
      name: "base32hex",
      alphabet: "0123456789abcdefghijklmnopqrstuv",
      bitsPerChar: 5
    });
    base32hexupper = rfc4648({
      prefix: "V",
      name: "base32hexupper",
      alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV",
      bitsPerChar: 5
    });
    base32hexpad = rfc4648({
      prefix: "t",
      name: "base32hexpad",
      alphabet: "0123456789abcdefghijklmnopqrstuv=",
      bitsPerChar: 5
    });
    base32hexpadupper = rfc4648({
      prefix: "T",
      name: "base32hexpadupper",
      alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUV=",
      bitsPerChar: 5
    });
    base32z = rfc4648({
      prefix: "h",
      name: "base32z",
      alphabet: "ybndrfg8ejkmcpqxot1uwisza345h769",
      bitsPerChar: 5
    });
  }
});

// node_modules/multiformats/esm/src/cid.js
var cid_exports = {};
__export(cid_exports, {
  CID: () => CID
});
var CID, parseCIDtoBytes, toStringV0, toStringV1, DAG_PB_CODE, SHA_256_CODE, encodeCID, cidSymbol, readonly, hidden, version, deprecate, IS_CID_DEPRECATION;
var init_cid = __esm({
  "node_modules/multiformats/esm/src/cid.js"() {
    init_varint2();
    init_digest();
    init_base58();
    init_base32();
    init_bytes();
    CID = class _CID {
      constructor(version2, code2, multihash, bytes) {
        this.code = code2;
        this.version = version2;
        this.multihash = multihash;
        this.bytes = bytes;
        this.byteOffset = bytes.byteOffset;
        this.byteLength = bytes.byteLength;
        this.asCID = this;
        this._baseCache = /* @__PURE__ */ new Map();
        Object.defineProperties(this, {
          byteOffset: hidden,
          byteLength: hidden,
          code: readonly,
          version: readonly,
          multihash: readonly,
          bytes: readonly,
          _baseCache: hidden,
          asCID: hidden
        });
      }
      toV0() {
        switch (this.version) {
          case 0: {
            return this;
          }
          default: {
            const { code: code2, multihash } = this;
            if (code2 !== DAG_PB_CODE) {
              throw new Error("Cannot convert a non dag-pb CID to CIDv0");
            }
            if (multihash.code !== SHA_256_CODE) {
              throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");
            }
            return _CID.createV0(multihash);
          }
        }
      }
      toV1() {
        switch (this.version) {
          case 0: {
            const { code: code2, digest: digest3 } = this.multihash;
            const multihash = create(code2, digest3);
            return _CID.createV1(this.code, multihash);
          }
          case 1: {
            return this;
          }
          default: {
            throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`);
          }
        }
      }
      equals(other) {
        return other && this.code === other.code && this.version === other.version && equals2(this.multihash, other.multihash);
      }
      toString(base3) {
        const { bytes, version: version2, _baseCache } = this;
        switch (version2) {
          case 0:
            return toStringV0(bytes, _baseCache, base3 || base58btc.encoder);
          default:
            return toStringV1(bytes, _baseCache, base3 || base32.encoder);
        }
      }
      toJSON() {
        return {
          code: this.code,
          version: this.version,
          hash: this.multihash.bytes
        };
      }
      get [Symbol.toStringTag]() {
        return "CID";
      }
      [Symbol.for("nodejs.util.inspect.custom")]() {
        return "CID(" + this.toString() + ")";
      }
      static isCID(value) {
        deprecate(/^0\.0/, IS_CID_DEPRECATION);
        return !!(value && (value[cidSymbol] || value.asCID === value));
      }
      get toBaseEncodedString() {
        throw new Error("Deprecated, use .toString()");
      }
      get codec() {
        throw new Error('"codec" property is deprecated, use integer "code" property instead');
      }
      get buffer() {
        throw new Error("Deprecated .buffer property, use .bytes to get Uint8Array instead");
      }
      get multibaseName() {
        throw new Error('"multibaseName" property is deprecated');
      }
      get prefix() {
        throw new Error('"prefix" property is deprecated');
      }
      static asCID(value) {
        if (value instanceof _CID) {
          return value;
        } else if (value != null && value.asCID === value) {
          const { version: version2, code: code2, multihash, bytes } = value;
          return new _CID(version2, code2, multihash, bytes || encodeCID(version2, code2, multihash.bytes));
        } else if (value != null && value[cidSymbol] === true) {
          const { version: version2, multihash, code: code2 } = value;
          const digest3 = decode3(multihash);
          return _CID.create(version2, code2, digest3);
        } else {
          return null;
        }
      }
      static create(version2, code2, digest3) {
        if (typeof code2 !== "number") {
          throw new Error("String codecs are no longer supported");
        }
        switch (version2) {
          case 0: {
            if (code2 !== DAG_PB_CODE) {
              throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);
            } else {
              return new _CID(version2, code2, digest3, digest3.bytes);
            }
          }
          case 1: {
            const bytes = encodeCID(version2, code2, digest3.bytes);
            return new _CID(version2, code2, digest3, bytes);
          }
          default: {
            throw new Error("Invalid version");
          }
        }
      }
      static createV0(digest3) {
        return _CID.create(0, DAG_PB_CODE, digest3);
      }
      static createV1(code2, digest3) {
        return _CID.create(1, code2, digest3);
      }
      static decode(bytes) {
        const [cid, remainder] = _CID.decodeFirst(bytes);
        if (remainder.length) {
          throw new Error("Incorrect length");
        }
        return cid;
      }
      static decodeFirst(bytes) {
        const specs = _CID.inspectBytes(bytes);
        const prefixSize = specs.size - specs.multihashSize;
        const multihashBytes = coerce(bytes.subarray(prefixSize, prefixSize + specs.multihashSize));
        if (multihashBytes.byteLength !== specs.multihashSize) {
          throw new Error("Incorrect length");
        }
        const digestBytes = multihashBytes.subarray(specs.multihashSize - specs.digestSize);
        const digest3 = new Digest(specs.multihashCode, specs.digestSize, digestBytes, multihashBytes);
        const cid = specs.version === 0 ? _CID.createV0(digest3) : _CID.createV1(specs.codec, digest3);
        return [
          cid,
          bytes.subarray(specs.size)
        ];
      }
      static inspectBytes(initialBytes) {
        let offset = 0;
        const next = () => {
          const [i, length2] = decode2(initialBytes.subarray(offset));
          offset += length2;
          return i;
        };
        let version2 = next();
        let codec = DAG_PB_CODE;
        if (version2 === 18) {
          version2 = 0;
          offset = 0;
        } else if (version2 === 1) {
          codec = next();
        }
        if (version2 !== 0 && version2 !== 1) {
          throw new RangeError(`Invalid CID version ${version2}`);
        }
        const prefixSize = offset;
        const multihashCode = next();
        const digestSize = next();
        const size = offset + digestSize;
        const multihashSize = size - prefixSize;
        return {
          version: version2,
          codec,
          multihashCode,
          digestSize,
          multihashSize,
          size
        };
      }
      static parse(source, base3) {
        const [prefix, bytes] = parseCIDtoBytes(source, base3);
        const cid = _CID.decode(bytes);
        cid._baseCache.set(prefix, source);
        return cid;
      }
    };
    parseCIDtoBytes = (source, base3) => {
      switch (source[0]) {
        case "Q": {
          const decoder2 = base3 || base58btc;
          return [
            base58btc.prefix,
            decoder2.decode(`${base58btc.prefix}${source}`)
          ];
        }
        case base58btc.prefix: {
          const decoder2 = base3 || base58btc;
          return [
            base58btc.prefix,
            decoder2.decode(source)
          ];
        }
        case base32.prefix: {
          const decoder2 = base3 || base32;
          return [
            base32.prefix,
            decoder2.decode(source)
          ];
        }
        default: {
          if (base3 == null) {
            throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");
          }
          return [
            source[0],
            base3.decode(source)
          ];
        }
      }
    };
    toStringV0 = (bytes, cache, base3) => {
      const { prefix } = base3;
      if (prefix !== base58btc.prefix) {
        throw Error(`Cannot string encode V0 in ${base3.name} encoding`);
      }
      const cid = cache.get(prefix);
      if (cid == null) {
        const cid2 = base3.encode(bytes).slice(1);
        cache.set(prefix, cid2);
        return cid2;
      } else {
        return cid;
      }
    };
    toStringV1 = (bytes, cache, base3) => {
      const { prefix } = base3;
      const cid = cache.get(prefix);
      if (cid == null) {
        const cid2 = base3.encode(bytes);
        cache.set(prefix, cid2);
        return cid2;
      } else {
        return cid;
      }
    };
    DAG_PB_CODE = 112;
    SHA_256_CODE = 18;
    encodeCID = (version2, code2, multihash) => {
      const codeOffset = encodingLength(version2);
      const hashOffset = codeOffset + encodingLength(code2);
      const bytes = new Uint8Array(hashOffset + multihash.byteLength);
      encodeTo(version2, bytes, 0);
      encodeTo(code2, bytes, codeOffset);
      bytes.set(multihash, hashOffset);
      return bytes;
    };
    cidSymbol = Symbol.for("@ipld/js-cid/CID");
    readonly = {
      writable: false,
      configurable: false,
      enumerable: true
    };
    hidden = {
      writable: false,
      enumerable: false,
      configurable: false
    };
    version = "0.0.0-dev";
    deprecate = (range, message2) => {
      if (range.test(version)) {
        console.warn(message2);
      } else {
        throw new Error(message2);
      }
    };
    IS_CID_DEPRECATION = `CID.isCID(v) is deprecated and will be removed in the next major release.
Following code pattern:

if (CID.isCID(value)) {
  doSomethingWithCID(value)
}

Is replaced with:

const cid = CID.asCID(value)
if (cid) {
  // Make sure to use cid instead of value
  doSomethingWithCID(cid)
}
`;
  }
});

// node_modules/multiformats/esm/src/hashes/hasher.js
var from2, Hasher;
var init_hasher = __esm({
  "node_modules/multiformats/esm/src/hashes/hasher.js"() {
    init_digest();
    from2 = ({ name: name2, code: code2, encode: encode7 }) => new Hasher(name2, code2, encode7);
    Hasher = class {
      constructor(name2, code2, encode7) {
        this.name = name2;
        this.code = code2;
        this.encode = encode7;
      }
      digest(input) {
        if (input instanceof Uint8Array) {
          const result = this.encode(input);
          return result instanceof Uint8Array ? create(this.code, result) : result.then((digest3) => create(this.code, digest3));
        } else {
          throw Error("Unknown type, must be binary type");
        }
      }
    };
  }
});

// node_modules/multiformats/esm/src/hashes/sha2-browser.js
var sha2_browser_exports = {};
__export(sha2_browser_exports, {
  sha256: () => sha256,
  sha512: () => sha512
});
var sha, sha256, sha512;
var init_sha2_browser = __esm({
  "node_modules/multiformats/esm/src/hashes/sha2-browser.js"() {
    init_hasher();
    sha = (name2) => async (data) => new Uint8Array(await crypto.subtle.digest(name2, data));
    sha256 = from2({
      name: "sha2-256",
      code: 18,
      encode: sha("SHA-256")
    });
    sha512 = from2({
      name: "sha2-512",
      code: 19,
      encode: sha("SHA-512")
    });
  }
});

// node_modules/@atproto/lex-data/dist/lib/util.js
var require_util3 = __commonJS({
  "node_modules/@atproto/lex-data/dist/lib/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toHexString = toHexString;
    exports.isUint8 = isUint8;
    function toHexString(number) {
      return `0x${number.toString(16).padStart(2, "0")}`;
    }
    function isUint8(val) {
      return Number.isInteger(val) && val >= 0 && val < 256;
    }
  }
});

// node_modules/@atproto/lex-data/dist/object.js
var require_object = __commonJS({
  "node_modules/@atproto/lex-data/dist/object.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isObject = isObject2;
    exports.isPlainObject = isPlainObject;
    exports.isPlainProto = isPlainProto;
    function isObject2(input) {
      return input != null && typeof input === "object";
    }
    var ObjectProto = Object.prototype;
    var ObjectToString = Object.prototype.toString;
    function isPlainObject(input) {
      return isObject2(input) && isPlainProto(input);
    }
    function isPlainProto(input) {
      const proto = Object.getPrototypeOf(input);
      if (proto === null)
        return true;
      return (proto === ObjectProto || // Needed to support NodeJS's `runInNewContext` which produces objects
      // with a different prototype
      Object.getPrototypeOf(proto) === null) && ObjectToString.call(input) === "[object Object]";
    }
  }
});

// node_modules/@atproto/lex-data/dist/lib/nodejs-buffer.js
var require_nodejs_buffer = __commonJS({
  "node_modules/@atproto/lex-data/dist/lib/nodejs-buffer.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.NodeJSBuffer = void 0;
    var BUFFER = /* @__PURE__ */ (() => "Bu" + "f".repeat(2) + "er")();
    exports.NodeJSBuffer = globalThis?.[BUFFER]?.prototype instanceof Uint8Array && "byteLength" in globalThis[BUFFER] ? globalThis[BUFFER] : (
      /* v8 ignore next -- @preserve */
      null
    );
  }
});

// node_modules/@atproto/lex-data/dist/uint8array-concat.js
var require_uint8array_concat = __commonJS({
  "node_modules/@atproto/lex-data/dist/uint8array-concat.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ui8ConcatNode = void 0;
    exports.ui8ConcatPonyfill = ui8ConcatPonyfill;
    var nodejs_buffer_js_1 = require_nodejs_buffer();
    var Buffer2 = nodejs_buffer_js_1.NodeJSBuffer;
    exports.ui8ConcatNode = Buffer2 ? function ui8ConcatNode(array) {
      return Buffer2.concat(array);
    } : (
      /* v8 ignore next -- @preserve */
      null
    );
    function ui8ConcatPonyfill(array) {
      let totalLength = 0;
      for (const arr of array)
        totalLength += arr.length;
      const result = new Uint8Array(totalLength);
      let offset = 0;
      for (const arr of array) {
        result.set(arr, offset);
        offset += arr.length;
      }
      return result;
    }
  }
});

// node_modules/multiformats/esm/src/bases/identity.js
var identity_exports = {};
__export(identity_exports, {
  identity: () => identity
});
var identity;
var init_identity = __esm({
  "node_modules/multiformats/esm/src/bases/identity.js"() {
    init_base();
    init_bytes();
    identity = from({
      prefix: "\0",
      name: "identity",
      encode: (buf) => toString(buf),
      decode: (str) => fromString(str)
    });
  }
});

// node_modules/multiformats/esm/src/bases/base2.js
var base2_exports = {};
__export(base2_exports, {
  base2: () => base2
});
var base2;
var init_base2 = __esm({
  "node_modules/multiformats/esm/src/bases/base2.js"() {
    init_base();
    base2 = rfc4648({
      prefix: "0",
      name: "base2",
      alphabet: "01",
      bitsPerChar: 1
    });
  }
});

// node_modules/multiformats/esm/src/bases/base8.js
var base8_exports = {};
__export(base8_exports, {
  base8: () => base8
});
var base8;
var init_base8 = __esm({
  "node_modules/multiformats/esm/src/bases/base8.js"() {
    init_base();
    base8 = rfc4648({
      prefix: "7",
      name: "base8",
      alphabet: "01234567",
      bitsPerChar: 3
    });
  }
});

// node_modules/multiformats/esm/src/bases/base10.js
var base10_exports = {};
__export(base10_exports, {
  base10: () => base10
});
var base10;
var init_base10 = __esm({
  "node_modules/multiformats/esm/src/bases/base10.js"() {
    init_base();
    base10 = baseX({
      prefix: "9",
      name: "base10",
      alphabet: "0123456789"
    });
  }
});

// node_modules/multiformats/esm/src/bases/base16.js
var base16_exports = {};
__export(base16_exports, {
  base16: () => base16,
  base16upper: () => base16upper
});
var base16, base16upper;
var init_base16 = __esm({
  "node_modules/multiformats/esm/src/bases/base16.js"() {
    init_base();
    base16 = rfc4648({
      prefix: "f",
      name: "base16",
      alphabet: "0123456789abcdef",
      bitsPerChar: 4
    });
    base16upper = rfc4648({
      prefix: "F",
      name: "base16upper",
      alphabet: "0123456789ABCDEF",
      bitsPerChar: 4
    });
  }
});

// node_modules/multiformats/esm/src/bases/base36.js
var base36_exports = {};
__export(base36_exports, {
  base36: () => base36,
  base36upper: () => base36upper
});
var base36, base36upper;
var init_base36 = __esm({
  "node_modules/multiformats/esm/src/bases/base36.js"() {
    init_base();
    base36 = baseX({
      prefix: "k",
      name: "base36",
      alphabet: "0123456789abcdefghijklmnopqrstuvwxyz"
    });
    base36upper = baseX({
      prefix: "K",
      name: "base36upper",
      alphabet: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
    });
  }
});

// node_modules/multiformats/esm/src/bases/base64.js
var base64_exports = {};
__export(base64_exports, {
  base64: () => base64,
  base64pad: () => base64pad,
  base64url: () => base64url,
  base64urlpad: () => base64urlpad
});
var base64, base64pad, base64url, base64urlpad;
var init_base64 = __esm({
  "node_modules/multiformats/esm/src/bases/base64.js"() {
    init_base();
    base64 = rfc4648({
      prefix: "m",
      name: "base64",
      alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
      bitsPerChar: 6
    });
    base64pad = rfc4648({
      prefix: "M",
      name: "base64pad",
      alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
      bitsPerChar: 6
    });
    base64url = rfc4648({
      prefix: "u",
      name: "base64url",
      alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",
      bitsPerChar: 6
    });
    base64urlpad = rfc4648({
      prefix: "U",
      name: "base64urlpad",
      alphabet: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",
      bitsPerChar: 6
    });
  }
});

// node_modules/multiformats/esm/src/bases/base256emoji.js
var base256emoji_exports = {};
__export(base256emoji_exports, {
  base256emoji: () => base256emoji
});
function encode3(data) {
  return data.reduce((p, c) => {
    p += alphabetBytesToChars[c];
    return p;
  }, "");
}
function decode5(str) {
  const byts = [];
  for (const char of str) {
    const byt = alphabetCharsToBytes[char.codePointAt(0)];
    if (byt === void 0) {
      throw new Error(`Non-base256emoji character: ${char}`);
    }
    byts.push(byt);
  }
  return new Uint8Array(byts);
}
var alphabet, alphabetBytesToChars, alphabetCharsToBytes, base256emoji;
var init_base256emoji = __esm({
  "node_modules/multiformats/esm/src/bases/base256emoji.js"() {
    init_base();
    alphabet = Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}");
    alphabetBytesToChars = alphabet.reduce((p, c, i) => {
      p[i] = c;
      return p;
    }, []);
    alphabetCharsToBytes = alphabet.reduce((p, c, i) => {
      p[c.codePointAt(0)] = i;
      return p;
    }, []);
    base256emoji = from({
      prefix: "\u{1F680}",
      name: "base256emoji",
      encode: encode3,
      decode: decode5
    });
  }
});

// node_modules/multiformats/esm/src/hashes/identity.js
var identity_exports2 = {};
__export(identity_exports2, {
  identity: () => identity2
});
var code, name, encode4, digest, identity2;
var init_identity2 = __esm({
  "node_modules/multiformats/esm/src/hashes/identity.js"() {
    init_bytes();
    init_digest();
    code = 0;
    name = "identity";
    encode4 = coerce;
    digest = (input) => create(code, encode4(input));
    identity2 = {
      code,
      name,
      encode: encode4,
      digest
    };
  }
});

// node_modules/multiformats/esm/src/codecs/raw.js
var init_raw = __esm({
  "node_modules/multiformats/esm/src/codecs/raw.js"() {
    init_bytes();
  }
});

// node_modules/multiformats/esm/src/codecs/json.js
var textEncoder, textDecoder;
var init_json = __esm({
  "node_modules/multiformats/esm/src/codecs/json.js"() {
    textEncoder = new TextEncoder();
    textDecoder = new TextDecoder();
  }
});

// node_modules/multiformats/esm/src/index.js
var init_src = __esm({
  "node_modules/multiformats/esm/src/index.js"() {
    init_cid();
    init_varint2();
    init_bytes();
    init_hasher();
    init_digest();
  }
});

// node_modules/multiformats/esm/src/basics.js
var bases, hashes;
var init_basics = __esm({
  "node_modules/multiformats/esm/src/basics.js"() {
    init_identity();
    init_base2();
    init_base8();
    init_base10();
    init_base16();
    init_base32();
    init_base36();
    init_base58();
    init_base64();
    init_base256emoji();
    init_sha2_browser();
    init_identity2();
    init_raw();
    init_json();
    init_src();
    bases = {
      ...identity_exports,
      ...base2_exports,
      ...base8_exports,
      ...base10_exports,
      ...base16_exports,
      ...base32_exports,
      ...base36_exports,
      ...base58_exports,
      ...base64_exports,
      ...base256emoji_exports
    };
    hashes = {
      ...sha2_browser_exports,
      ...identity_exports2
    };
  }
});

// node_modules/uint8arrays/esm/src/util/bases.js
function createCodec(name2, prefix, encode7, decode8) {
  return {
    name: name2,
    prefix,
    encoder: {
      name: name2,
      prefix,
      encode: encode7
    },
    decoder: { decode: decode8 }
  };
}
var string, ascii, BASES, bases_default;
var init_bases = __esm({
  "node_modules/uint8arrays/esm/src/util/bases.js"() {
    init_basics();
    string = createCodec("utf8", "u", (buf) => {
      const decoder2 = new TextDecoder("utf8");
      return "u" + decoder2.decode(buf);
    }, (str) => {
      const encoder2 = new TextEncoder();
      return encoder2.encode(str.substring(1));
    });
    ascii = createCodec("ascii", "a", (buf) => {
      let string2 = "a";
      for (let i = 0; i < buf.length; i++) {
        string2 += String.fromCharCode(buf[i]);
      }
      return string2;
    }, (str) => {
      str = str.substring(1);
      const buf = new Uint8Array(str.length);
      for (let i = 0; i < str.length; i++) {
        buf[i] = str.charCodeAt(i);
      }
      return buf;
    });
    BASES = {
      utf8: string,
      "utf-8": string,
      hex: bases.base16,
      latin1: ascii,
      ascii,
      binary: ascii,
      ...bases
    };
    bases_default = BASES;
  }
});

// node_modules/uint8arrays/esm/src/from-string.js
var from_string_exports = {};
__export(from_string_exports, {
  fromString: () => fromString2
});
function fromString2(string2, encoding = "utf8") {
  const base3 = bases_default[encoding];
  if (!base3) {
    throw new Error(`Unsupported encoding "${encoding}"`);
  }
  return base3.decoder.decode(`${base3.prefix}${string2}`);
}
var init_from_string = __esm({
  "node_modules/uint8arrays/esm/src/from-string.js"() {
    init_bases();
  }
});

// node_modules/@atproto/lex-data/dist/uint8array-from-base64.js
var require_uint8array_from_base64 = __commonJS({
  "node_modules/@atproto/lex-data/dist/uint8array-from-base64.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.fromBase64Node = exports.fromBase64Native = void 0;
    exports.fromBase64Ponyfill = fromBase64Ponyfill;
    var from_string_1 = (init_from_string(), __toCommonJS(from_string_exports));
    var nodejs_buffer_js_1 = require_nodejs_buffer();
    var Buffer2 = nodejs_buffer_js_1.NodeJSBuffer;
    exports.fromBase64Native = typeof Uint8Array.fromBase64 === "function" ? function fromBase64Native(b64, alphabet2 = "base64") {
      return Uint8Array.fromBase64(b64, {
        alphabet: alphabet2,
        lastChunkHandling: "loose"
      });
    } : (
      /* v8 ignore next -- @preserve */
      null
    );
    exports.fromBase64Node = Buffer2 ? function fromBase64Node(b64, alphabet2 = "base64") {
      const bytes = Buffer2.from(b64, alphabet2);
      verifyBase64ForBytes(b64, bytes);
      return new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
    } : (
      /* v8 ignore next -- @preserve */
      null
    );
    function fromBase64Ponyfill(b64, alphabet2 = "base64") {
      const bytes = (0, from_string_1.fromString)(b64, b64.endsWith("=") ? `${alphabet2}pad` : alphabet2);
      verifyBase64ForBytes(b64, bytes);
      return bytes;
    }
    function verifyBase64ForBytes(b64, bytes) {
      const paddingCount = b64.endsWith("==") ? 2 : b64.endsWith("=") ? 1 : 0;
      const trimmedLength = b64.length - paddingCount;
      const expectedByteLength = Math.floor(trimmedLength * 3 / 4);
      if (bytes.length !== expectedByteLength) {
        throw new Error("Invalid base64 string");
      }
      const expectedB64Length = bytes.length / 3 * 4;
      const expectedPaddingCount = expectedB64Length % 4 === 0 ? 0 : 4 - expectedB64Length % 4;
      const expectedFullB64Length = expectedB64Length + expectedPaddingCount;
      if (b64.length > expectedFullB64Length) {
        throw new Error("Invalid base64 string");
      }
      for (let i = Math.ceil(expectedB64Length); i < b64.length - paddingCount; i++) {
        const code2 = b64.charCodeAt(i);
        if (!(code2 >= 65 && code2 <= 90) && // A-Z
        !(code2 >= 97 && code2 <= 122) && // a-z
        !(code2 >= 48 && code2 <= 57) && // 0-9
        code2 !== 43 && // +
        code2 !== 47) {
          throw new Error("Invalid base64 string");
        }
      }
    }
  }
});

// node_modules/uint8arrays/esm/src/to-string.js
var to_string_exports = {};
__export(to_string_exports, {
  toString: () => toString2
});
function toString2(array, encoding = "utf8") {
  const base3 = bases_default[encoding];
  if (!base3) {
    throw new Error(`Unsupported encoding "${encoding}"`);
  }
  return base3.encoder.encode(array).substring(1);
}
var init_to_string = __esm({
  "node_modules/uint8arrays/esm/src/to-string.js"() {
    init_bases();
  }
});

// node_modules/@atproto/lex-data/dist/uint8array-to-base64.js
var require_uint8array_to_base64 = __commonJS({
  "node_modules/@atproto/lex-data/dist/uint8array-to-base64.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toBase64Node = exports.toBase64Native = void 0;
    exports.toBase64Ponyfill = toBase64Ponyfill;
    var to_string_1 = (init_to_string(), __toCommonJS(to_string_exports));
    var nodejs_buffer_js_1 = require_nodejs_buffer();
    var Buffer2 = nodejs_buffer_js_1.NodeJSBuffer;
    exports.toBase64Native = typeof Uint8Array.prototype.toBase64 === "function" ? function toBase64Native(bytes, alphabet2 = "base64") {
      return bytes.toBase64({ alphabet: alphabet2, omitPadding: true });
    } : (
      /* v8 ignore next -- @preserve */
      null
    );
    exports.toBase64Node = Buffer2 ? function toBase64Node(bytes, alphabet2 = "base64") {
      const buffer = bytes instanceof Buffer2 ? bytes : Buffer2.from(bytes);
      const b64 = buffer.toString(alphabet2);
      return b64.charCodeAt(b64.length - 1) === /* '=' */
      61 ? b64.charCodeAt(b64.length - 2) === /* '=' */
      61 ? b64.slice(0, -2) : b64.slice(0, -1) : b64;
    } : (
      /* v8 ignore next -- @preserve */
      null
    );
    function toBase64Ponyfill(bytes, alphabet2 = "base64") {
      return (0, to_string_1.toString)(bytes, alphabet2);
    }
  }
});

// node_modules/@atproto/lex-data/dist/uint8array.js
var require_uint8array = __commonJS({
  "node_modules/@atproto/lex-data/dist/uint8array.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ui8Concat = exports.fromBase64 = exports.toBase64 = void 0;
    exports.ifUint8Array = ifUint8Array;
    exports.asUint8Array = asUint8Array;
    exports.ui8Equals = ui8Equals;
    var uint8array_concat_js_1 = require_uint8array_concat();
    var uint8array_from_base64_js_1 = require_uint8array_from_base64();
    var uint8array_to_base64_js_1 = require_uint8array_to_base64();
    exports.toBase64 = /* v8 ignore next -- @preserve */
    uint8array_to_base64_js_1.toBase64Native ?? uint8array_to_base64_js_1.toBase64Node ?? uint8array_to_base64_js_1.toBase64Ponyfill;
    exports.fromBase64 = /* v8 ignore next -- @preserve */
    uint8array_from_base64_js_1.fromBase64Native ?? uint8array_from_base64_js_1.fromBase64Node ?? uint8array_from_base64_js_1.fromBase64Ponyfill;
    if (exports.toBase64 === uint8array_to_base64_js_1.toBase64Ponyfill || exports.fromBase64 === uint8array_from_base64_js_1.fromBase64Ponyfill) {
      /* @__PURE__ */ console.warn("[@atproto/lex-data]: Uint8Array.fromBase64 / Uint8Array.prototype.toBase64 not available in this environment. Falling back to ponyfill implementation.");
    }
    function ifUint8Array(input) {
      if (input instanceof Uint8Array) {
        return input;
      }
      return void 0;
    }
    function asUint8Array(input) {
      if (input instanceof Uint8Array) {
        return input;
      }
      if (ArrayBuffer.isView(input)) {
        return new Uint8Array(input.buffer, input.byteOffset, input.byteLength / Uint8Array.BYTES_PER_ELEMENT);
      }
      if (input instanceof ArrayBuffer) {
        return new Uint8Array(input);
      }
      return void 0;
    }
    function ui8Equals(a, b) {
      if (a.byteLength !== b.byteLength) {
        return false;
      }
      for (let i = 0; i < a.byteLength; i++) {
        if (a[i] !== b[i]) {
          return false;
        }
      }
      return true;
    }
    exports.ui8Concat = /* v8 ignore next -- @preserve */
    uint8array_concat_js_1.ui8ConcatNode ?? uint8array_concat_js_1.ui8ConcatPonyfill;
  }
});

// node_modules/@atproto/lex-data/dist/cid.js
var require_cid = __commonJS({
  "node_modules/@atproto/lex-data/dist/cid.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.CID = exports.SHA512_HASH_CODE = exports.SHA256_HASH_CODE = exports.RAW_DATA_CODEC = exports.CBOR_DATA_CODEC = void 0;
    exports.multihashEquals = multihashEquals;
    exports.asMultiformatsCID = asMultiformatsCID;
    exports.isRawCid = isRawCid;
    exports.isDaslCid = isDaslCid;
    exports.isCborCid = isCborCid;
    exports.checkCid = checkCid;
    exports.isCid = isCid;
    exports.ifCid = ifCid;
    exports.asCid = asCid;
    exports.decodeCid = decodeCid;
    exports.parseCid = parseCid;
    exports.validateCidString = validateCidString;
    exports.parseCidSafe = parseCidSafe;
    exports.ensureValidCidString = ensureValidCidString;
    exports.isCidForBytes = isCidForBytes;
    exports.createCid = createCid;
    exports.cidForCbor = cidForCbor;
    exports.cidForRawBytes = cidForRawBytes;
    exports.cidForRawHash = cidForRawHash;
    var cid_1 = (init_cid(), __toCommonJS(cid_exports));
    Object.defineProperty(exports, "CID", { enumerable: true, get: function() {
      return cid_1.CID;
    } });
    var digest_1 = (init_digest(), __toCommonJS(digest_exports));
    var sha2_1 = (init_sha2_browser(), __toCommonJS(sha2_browser_exports));
    var util_js_1 = require_util3();
    var object_js_1 = require_object();
    var uint8array_js_1 = require_uint8array();
    exports.CBOR_DATA_CODEC = 113;
    exports.RAW_DATA_CODEC = 85;
    exports.SHA256_HASH_CODE = sha2_1.sha256.code;
    exports.SHA512_HASH_CODE = sha2_1.sha512.code;
    function multihashEquals(a, b) {
      if (a === b)
        return true;
      return a.code === b.code && (0, uint8array_js_1.ui8Equals)(a.digest, b.digest);
    }
    function asMultiformatsCID(input) {
      const cid = (
        // Already a multiformats CID instance
        cid_1.CID.asCID(input) ?? // Create a new multiformats CID instance
        cid_1.CID.create(input.version, input.code, (0, digest_1.create)(input.multihash.code, input.multihash.digest))
      );
      return cid;
    }
    function isRawCid(cid) {
      return cid.version === 1 && cid.code === exports.RAW_DATA_CODEC;
    }
    function isDaslCid(cid) {
      return cid.version === 1 && (cid.code === exports.RAW_DATA_CODEC || cid.code === exports.CBOR_DATA_CODEC) && cid.multihash.code === exports.SHA256_HASH_CODE && cid.multihash.digest.byteLength === 32;
    }
    function isCborCid(cid) {
      return cid.code === exports.CBOR_DATA_CODEC && isDaslCid(cid);
    }
    function checkCid(cid, options) {
      switch (options?.flavor) {
        case void 0:
          return true;
        case "cbor":
          return isCborCid(cid);
        case "dasl":
          return isDaslCid(cid);
        case "raw":
          return isRawCid(cid);
        default:
          throw new TypeError(`Unknown CID flavor: ${options?.flavor}`);
      }
    }
    function isCid(value, options) {
      return isCidImplementation(value) && checkCid(value, options);
    }
    function ifCid(value, options) {
      if (isCid(value, options))
        return value;
      return null;
    }
    function asCid(value, options) {
      if (isCid(value, options))
        return value;
      throw new Error(`Invalid ${options?.flavor ? `${options.flavor} CID` : "CID"} "${value}"`);
    }
    function decodeCid(cidBytes, options) {
      const cid = cid_1.CID.decode(cidBytes);
      return asCid(cid, options);
    }
    function parseCid(input, options) {
      const cid = cid_1.CID.parse(input);
      return asCid(cid, options);
    }
    function validateCidString(input, options) {
      return parseCidSafe(input, options)?.toString() === input;
    }
    function parseCidSafe(input, options) {
      try {
        return parseCid(input, options);
      } catch {
        return null;
      }
    }
    function ensureValidCidString(input, options) {
      if (!validateCidString(input, options)) {
        throw new Error(`Invalid CID string "${input}"`);
      }
    }
    async function isCidForBytes(cid, bytes) {
      if (cid.multihash.code === sha2_1.sha256.code) {
        const multihash = await sha2_1.sha256.digest(bytes);
        return multihashEquals(multihash, cid.multihash);
      }
      if (cid.multihash.code === sha2_1.sha512.code) {
        const multihash = await sha2_1.sha512.digest(bytes);
        return multihashEquals(multihash, cid.multihash);
      }
      throw new Error(`Unsupported CID multihash code: ${(0, util_js_1.toHexString)(cid.multihash.code)}`);
    }
    function createCid(code2, multihashCode, digest3) {
      const cid = cid_1.CID.createV1(code2, (0, digest_1.create)(multihashCode, digest3));
      return cid;
    }
    async function cidForCbor(bytes) {
      const multihash = await sha2_1.sha256.digest(bytes);
      return cid_1.CID.createV1(exports.CBOR_DATA_CODEC, multihash);
    }
    async function cidForRawBytes(bytes) {
      const multihash = await sha2_1.sha256.digest(bytes);
      return cid_1.CID.createV1(exports.RAW_DATA_CODEC, multihash);
    }
    function cidForRawHash(digest3) {
      if (digest3.length !== 32) {
        throw new Error(`Invalid SHA-256 hash length: ${(0, util_js_1.toHexString)(digest3.length)}`);
      }
      return createCid(exports.RAW_DATA_CODEC, sha2_1.sha256.code, digest3);
    }
    function isCidImplementation(value) {
      if (cid_1.CID.asCID(value)) {
        return value.bytes != null;
      } else {
        try {
          if (!(0, object_js_1.isObject)(value))
            return false;
          const val = value;
          if (val.version !== 0 && val.version !== 1)
            return false;
          if (!(0, util_js_1.isUint8)(val.code))
            return false;
          if (!(0, object_js_1.isObject)(val.multihash))
            return false;
          const mh = val.multihash;
          if (!(0, util_js_1.isUint8)(mh.code))
            return false;
          if (!(mh.digest instanceof Uint8Array))
            return false;
          if (!(val.bytes instanceof Uint8Array))
            return false;
          if (val.bytes[0] !== val.version)
            return false;
          if (val.bytes[1] !== val.code)
            return false;
          if (val.bytes[2] !== mh.code)
            return false;
          if (val.bytes[3] !== mh.digest.length)
            return false;
          if (val.bytes.length !== 4 + mh.digest.length)
            return false;
          if (!(0, uint8array_js_1.ui8Equals)(val.bytes.subarray(4), mh.digest))
            return false;
          if (typeof val.equals !== "function")
            return false;
          if (val.equals(val) !== true)
            return false;
          return true;
        } catch {
          return false;
        }
      }
    }
  }
});

// node_modules/@atproto/lex-data/dist/blob.js
var require_blob = __commonJS({
  "node_modules/@atproto/lex-data/dist/blob.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isBlobRef = isBlobRef;
    exports.isLegacyBlobRef = isLegacyBlobRef;
    exports.enumBlobRefs = enumBlobRefs;
    var cid_js_1 = require_cid();
    var object_js_1 = require_object();
    var isSafeInteger = Number.isSafeInteger;
    function isBlobRef(input, options) {
      if (!(0, object_js_1.isPlainObject)(input)) {
        return false;
      }
      if (input?.$type !== "blob") {
        return false;
      }
      const { mimeType, size, ref } = input;
      if (typeof mimeType !== "string" || !mimeType.includes("/")) {
        return false;
      }
      if (size === -1 && options?.strict === false) {
      } else if (!isSafeInteger(size) || size < 0) {
        return false;
      }
      if (typeof ref !== "object" || ref === null) {
        return false;
      }
      for (const key in input) {
        if (key !== "$type" && key !== "mimeType" && key !== "ref" && key !== "size") {
          return false;
        }
      }
      const cid = (0, cid_js_1.ifCid)(
        ref,
        // Strict unless explicitly disabled
        options?.strict === false ? void 0 : { flavor: "raw" }
      );
      if (!cid) {
        return false;
      }
      return true;
    }
    function isLegacyBlobRef(input) {
      if (!(0, object_js_1.isPlainObject)(input)) {
        return false;
      }
      const { cid, mimeType } = input;
      if (typeof cid !== "string") {
        return false;
      }
      if (typeof mimeType !== "string" || mimeType.length === 0) {
        return false;
      }
      for (const key in input) {
        if (key !== "cid" && key !== "mimeType") {
          return false;
        }
      }
      if (!(0, cid_js_1.validateCidString)(cid)) {
        return false;
      }
      return true;
    }
    function* enumBlobRefs(input, options) {
      const includeLegacy = options?.allowLegacy === true;
      const stack = [input];
      const visited = /* @__PURE__ */ new Set();
      do {
        const value = stack.pop();
        if (value != null && typeof value === "object") {
          if (Array.isArray(value)) {
            if (visited.has(value))
              continue;
            visited.add(value);
            stack.push(...value);
          } else if ((0, object_js_1.isPlainProto)(value)) {
            if (visited.has(value))
              continue;
            visited.add(value);
            if (isBlobRef(value, options)) {
              yield value;
            } else if (includeLegacy && isLegacyBlobRef(value)) {
              yield value;
            } else {
              for (const v of Object.values(value)) {
                if (v != null)
                  stack.push(v);
              }
            }
          }
        }
      } while (stack.length > 0);
      visited.clear();
    }
  }
});

// node_modules/@atproto/lex-data/dist/lex-equals.js
var require_lex_equals = __commonJS({
  "node_modules/@atproto/lex-data/dist/lex-equals.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.lexEquals = lexEquals;
    var cid_js_1 = require_cid();
    var object_js_1 = require_object();
    var uint8array_js_1 = require_uint8array();
    function lexEquals(a, b) {
      if (Object.is(a, b)) {
        return true;
      }
      if (a == null || b == null || typeof a !== "object" || typeof b !== "object") {
        return false;
      }
      if (Array.isArray(a)) {
        if (!Array.isArray(b)) {
          return false;
        }
        if (a.length !== b.length) {
          return false;
        }
        for (let i = 0; i < a.length; i++) {
          if (!lexEquals(a[i], b[i])) {
            return false;
          }
        }
        return true;
      } else if (Array.isArray(b)) {
        return false;
      }
      if (ArrayBuffer.isView(a)) {
        if (!ArrayBuffer.isView(b))
          return false;
        return (0, uint8array_js_1.ui8Equals)(a, b);
      } else if (ArrayBuffer.isView(b)) {
        return false;
      }
      if ((0, cid_js_1.isCid)(a)) {
        return (0, cid_js_1.ifCid)(b)?.equals(a) === true;
      } else if ((0, cid_js_1.isCid)(b)) {
        return false;
      }
      if (!(0, object_js_1.isPlainObject)(a) || !(0, object_js_1.isPlainObject)(b)) {
        throw new TypeError("Invalid LexValue (expected CID, Uint8Array, or LexMap)");
      }
      const aKeys = Object.keys(a);
      const bKeys = Object.keys(b);
      if (aKeys.length !== bKeys.length) {
        return false;
      }
      for (const key of aKeys) {
        const aVal = a[key];
        const bVal = b[key];
        if (aVal === void 0) {
          if (bVal === void 0 && bKeys.includes(key))
            continue;
          return false;
        } else if (bVal === void 0) {
          return false;
        }
        if (!lexEquals(aVal, bVal)) {
          return false;
        }
      }
      return true;
    }
  }
});

// node_modules/@atproto/lex-data/dist/lex-error.js
var require_lex_error = __commonJS({
  "node_modules/@atproto/lex-data/dist/lex-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.LexError = void 0;
    var LexError = class extends Error {
      error;
      name = "LexError";
      /**
       * @param error - The error code identifying the type of error, typically used in XRPC error payloads
       * @param message - Optional human-readable error message
       * @param options - Standard Error options (e.g., cause)
       */
      constructor(error, message2, options) {
        super(message2, options);
        this.error = error;
      }
      /**
       * Returns a string representation of this error.
       *
       * @returns A formatted string: "LexErrorClass: [MyErrorCode] My message"
       */
      toString() {
        return `${this.name}: [${this.error}] ${this.message}`;
      }
      /**
       * Converts this error to a JSON-serializable object.
       *
       * @returns The error data suitable for JSON serialization
       * @note The `error` generic is *not* constrained to {@link N} to allow subclasses to override the error code type.
       */
      toJSON() {
        const { error, message: message2 } = this;
        return { error, message: message2 || void 0 };
      }
    };
    exports.LexError = LexError;
  }
});

// node_modules/@atproto/lex-data/dist/lex.js
var require_lex = __commonJS({
  "node_modules/@atproto/lex-data/dist/lex.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isLexMap = isLexMap;
    exports.isLexArray = isLexArray;
    exports.isLexScalar = isLexScalar;
    exports.isLexValue = isLexValue;
    exports.isTypedLexMap = isTypedLexMap;
    var cid_js_1 = require_cid();
    var object_js_1 = require_object();
    function isLexMap(value) {
      return (0, object_js_1.isPlainObject)(value) && Object.values(value).every(isLexValue);
    }
    function isLexArray(value) {
      return Array.isArray(value) && value.every(isLexValue);
    }
    function isLexScalar(value) {
      switch (typeof value) {
        case "object":
          return value === null || value instanceof Uint8Array || (0, cid_js_1.isCid)(value);
        case "string":
        case "boolean":
          return true;
        case "number":
          if (Number.isInteger(value))
            return true;
        // fallthrough
        default:
          return false;
      }
    }
    function isLexValue(value) {
      const stack = [value];
      const visited = /* @__PURE__ */ new Set();
      do {
        const value2 = stack.pop();
        if ((0, object_js_1.isPlainObject)(value2)) {
          if (visited.has(value2))
            return false;
          visited.add(value2);
          stack.push(...Object.values(value2));
        } else if (Array.isArray(value2)) {
          if (visited.has(value2))
            return false;
          visited.add(value2);
          stack.push(...value2);
        } else {
          if (!isLexScalar(value2))
            return false;
        }
      } while (stack.length > 0);
      visited.clear();
      return true;
    }
    function isTypedLexMap(value) {
      return isLexMap(value) && typeof value.$type === "string" && value.$type.length > 0;
    }
  }
});

// node_modules/@atproto/lex-data/dist/utf8-from-base64.js
var require_utf8_from_base64 = __commonJS({
  "node_modules/@atproto/lex-data/dist/utf8-from-base64.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.utf8FromBase64Node = void 0;
    exports.utf8FromBase64Ponyfill = utf8FromBase64Ponyfill;
    var from_string_1 = (init_from_string(), __toCommonJS(from_string_exports));
    var nodejs_buffer_js_1 = require_nodejs_buffer();
    var Buffer2 = nodejs_buffer_js_1.NodeJSBuffer;
    exports.utf8FromBase64Node = Buffer2 ? function utf8FromBase64Node(b64, alphabet2 = "base64") {
      return Buffer2.from(b64, alphabet2).toString("utf8");
    } : (
      /* v8 ignore next -- @preserve */
      null
    );
    var textDecoder2 = /* @__PURE__ */ new TextDecoder();
    function utf8FromBase64Ponyfill(b64, alphabet2) {
      const bytes = (0, from_string_1.fromString)(b64, alphabet2);
      return textDecoder2.decode(bytes);
    }
  }
});

// node_modules/unicode-segmenter/core.cjs
var require_core = __commonJS({
  "node_modules/unicode-segmenter/core.cjs"(exports) {
    "use strict";
    exports.decodeUnicodeData = decodeUnicodeData;
    exports.findUnicodeRangeIndex = findUnicodeRangeIndex;
    function decodeUnicodeData(data, cats = "") {
      let buf = (
        /** @type {Array<CategorizedUnicodeRange<T>>} */
        []
      ), nums = data.split(",").map((s) => s ? parseInt(s, 36) : 0), n = 0;
      for (let i = 0; i < nums.length; i++) i % 2 ? buf.push([
        n,
        n + nums[i],
        /** @type {T} */
        cats ? parseInt(cats[i >> 1], 36) : 0
      ]) : n = nums[i];
      return buf;
    }
    function findUnicodeRangeIndex(cp, ranges, lo = 0, hi = ranges.length - 1) {
      while (lo <= hi) {
        let mid = lo + hi >>> 1, range = ranges[mid];
        if (cp < range[0]) hi = mid - 1;
        else if (cp > range[1]) lo = mid + 1;
        else return mid;
      }
      return -1;
    }
  }
});

// node_modules/unicode-segmenter/_grapheme_data.cjs
var require_grapheme_data = __commonJS({
  "node_modules/unicode-segmenter/_grapheme_data.cjs"(exports) {
    "use strict";
    exports.grapheme_ranges = exports.GraphemeCategory = void 0;
    var _core = require_core();
    var GraphemeCategory = exports.GraphemeCategory = {
      Any: 0,
      CR: 1,
      Control: 2,
      Extend: 3,
      Extended_Pictographic: 4,
      L: 5,
      LF: 6,
      LV: 7,
      LVT: 8,
      Prepend: 9,
      Regional_Indicator: 10,
      SpacingMark: 11,
      T: 12,
      V: 13,
      ZWJ: 14
    };
    var grapheme_ranges = exports.grapheme_ranges = (0, _core.decodeUnicodeData)(
      /** @type {UnicodeDataEncoding} */
      ",9,a,,b,1,d,,e,h,3j,w,4p,,4t,,4u,,lc,33,w3,6,13l,18,14v,,14x,1,150,1,153,,16o,5,174,a,17g,,18r,k,19s,,1cm,6,1ct,,1cv,5,1d3,1,1d6,3,1e7,,1e9,,1f4,q,1ie,a,1kb,8,1kt,,1li,3,1ln,8,1lx,2,1m1,4,1nd,2,1ow,1,1p3,8,1qi,n,1r6,,1r7,v,1s3,,1tm,,1tn,,1to,,1tq,2,1tt,7,1u1,3,1u5,,1u6,1,1u9,6,1uq,1,1vl,,1vm,1,1x8,,1xa,,1xb,1,1xd,3,1xj,1,1xn,1,1xp,,1xz,,1ya,1,1z2,,1z5,1,1z7,,20s,,20u,2,20x,1,213,1,217,2,21d,,228,1,22d,,22p,1,22r,,24c,,24e,2,24h,4,24n,1,24p,,24r,1,24t,,25e,1,262,5,269,,26a,1,27w,,27y,1,280,,281,3,287,1,28b,1,28d,,28l,2,28y,1,29u,,2bi,,2bj,,2bk,,2bl,1,2bq,2,2bu,2,2bx,,2c7,,2dc,,2dd,2,2dg,,2f0,,2f2,2,2f5,3,2fa,2,2fe,3,2fp,1,2g2,1,2gx,,2gy,1,2ik,,2im,,2in,1,2ip,,2iq,,2ir,1,2iu,2,2iy,3,2j9,1,2jm,1,2k3,,2kg,1,2ki,1,2m3,1,2m6,,2m7,1,2m9,3,2me,2,2mi,2,2ml,,2mm,,2mv,,2n6,1,2o1,,2o2,1,2q2,,2q7,,2q8,1,2qa,2,2qe,,2qg,6,2qn,,2r6,1,2sx,,2sz,,2t0,6,2tj,7,2wh,,2wj,,2wk,8,2x4,6,2zc,1,305,,307,,309,,30e,1,31t,d,327,,328,4,32e,1,32l,a,32x,z,346,,371,3,375,,376,5,37d,1,37f,1,37h,1,386,1,388,1,38e,2,38x,3,39e,,39g,,39h,1,39p,,3a5,,3cw,2n,3fk,1z,3hk,2f,3tp,2,4k2,3,4ky,2,4lu,1,4mq,1,4ok,1,4om,,4on,6,4ou,7,4p2,,4p3,1,4p5,a,4pp,,4qz,2,4r2,,4r3,,4ud,1,4vd,,4yo,2,4yr,3,4yv,1,4yx,2,4z4,1,4z6,,4z7,5,4zd,2,55j,1,55l,1,55n,,579,,57a,,57b,,57c,6,57k,,57m,,57p,7,57x,5,583,9,58f,,59s,u,5c0,3,5c4,,5dg,9,5dq,3,5du,2,5ez,8,5fk,1,5fm,,5gh,,5gi,3,5gm,1,5go,5,5ie,,5if,,5ig,1,5ii,2,5il,,5im,,5in,4,5k4,7,5kc,7,5kk,1,5km,1,5ow,2,5p0,c,5pd,,5pe,6,5pp,,5pw,,5pz,,5q0,1,5vk,1r,6bv,,6bw,,6bx,,6by,1,6co,6,6d8,,6dl,,6e8,f,6hc,w,6jm,,6k9,,6ms,5,6nd,1,6xm,1,6y0,,70o,,72n,,73d,a,73s,2,79e,,7fu,1,7g6,,7gg,,7i3,3,7i8,5,7if,b,7is,35,7m8,39,7pk,a,7pw,,7py,,7q5,,7q9,,7qg,,7qr,1,7r8,,7rb,,7rg,,7ri,,7rn,2,7rr,,7s3,4,7th,2,7tt,,7u8,,7un,,850,1,8hx,2,8ij,1,8k0,,8k5,,8vj,2,8zj,,928,v,wvj,3,wvo,9,wwu,1,wz4,1,x6q,,x6u,,x6z,,x7n,1,x7p,1,x7r,,x7w,,xa8,1,xbo,f,xc4,1,xcw,h,xdr,,xeu,7,xfr,a,xg2,,xg3,,xgg,s,xhc,2,xhf,,xir,,xis,1,xiu,3,xiy,1,xj0,1,xj2,1,xj4,,xk5,,xm1,5,xm7,1,xm9,1,xmb,1,xmd,1,xmr,,xn0,,xn1,,xoc,,xps,,xpu,2,xpz,1,xq6,1,xq9,,xrf,,xrg,1,xri,1,xrp,,xrq,,xyb,1,xyd,,xye,1,xyg,,xyh,1,xyk,,xyl,,1e68,f,1e74,f,1edb,,1ehq,1,1ek0,b,1eyl,,1f4w,,1f92,4,1gjl,2,1gjp,1,1gjw,3,1gl4,2,1glb,,1gpx,1,1h5w,3,1h7t,4,1hgr,1,1hj0,3,1hl2,a,1hmq,3,1hq8,,1hq9,,1hqa,,1hrs,e,1htc,,1htf,1,1htr,2,1htu,,1hv4,2,1hv7,3,1hvb,1,1hvd,1,1hvh,,1hvm,,1hvx,,1hxc,2,1hyf,4,1hyk,,1hyl,7,1hz9,1,1i0j,,1i0w,1,1i0y,,1i2b,2,1i2e,8,1i2n,,1i2o,,1i2q,1,1i2x,3,1i32,,1i33,,1i5o,2,1i5r,2,1i5u,1,1i5w,3,1i66,,1i69,,1ian,,1iao,2,1iar,7,1ibk,1,1ibm,1,1id7,1,1ida,,1idb,,1idc,,1idd,3,1idj,1,1idn,1,1idp,,1idz,,1iea,1,1iee,6,1ieo,4,1igo,,1igp,1,1igr,5,1igy,,1ih1,,1ih3,2,1ih6,,1ih8,1,1iha,2,1ihd,,1ihe,,1iht,1,1ik5,2,1ik8,7,1ikg,1,1iki,2,1ikl,,1ikm,,1ila,,1ink,,1inl,1,1inn,5,1int,,1inu,,1inv,1,1inx,,1iny,,1inz,1,1io1,,1io2,1,1iun,,1iuo,1,1iuq,3,1iuw,3,1iv0,1,1iv2,,1iv3,1,1ivw,1,1iy8,2,1iyb,7,1iyj,1,1iyl,,1iym,,1iyn,1,1j1n,,1j1o,,1j1p,,1j1q,1,1j1s,7,1j4t,,1j4u,,1j4v,,1j4y,3,1j52,,1j53,4,1jcc,2,1jcf,8,1jco,,1jcp,1,1jjk,,1jjl,4,1jjr,1,1jjv,3,1jjz,,1jk0,,1jk1,,1jk2,,1jk3,,1jo1,2,1jo4,3,1joa,1,1joc,3,1jog,,1jok,,1jpd,9,1jqr,5,1jqx,,1jqy,,1jqz,3,1jrb,,1jrl,5,1jrr,1,1jrt,2,1jt0,5,1jt6,c,1jtj,,1jtk,1,1k4v,,1k4w,6,1k54,5,1k5a,,1k5b,,1k7m,l,1k89,,1k8a,6,1k8h,,1k8i,1,1k8k,,1k8l,1,1kc1,5,1kca,,1kcc,1,1kcf,6,1kcm,,1kcn,,1kei,4,1keo,1,1ker,1,1ket,,1keu,,1kev,,1koj,1,1kol,1,1kow,1,1koy,,1koz,,1kqc,1,1kqe,4,1kqm,1,1kqo,2,1kre,,1ovk,f,1ow0,,1ow7,e,1xr2,b,1xre,2,1xrh,2,1zow,4,1zqo,6,206b,,206f,3,20jz,,20k1,1i,20lr,3,20o4,,20og,1,2ftp,1,2fts,3,2jgg,19,2jhs,m,2jxh,4,2jxp,5,2jxv,7,2jy3,7,2jyd,6,2jze,3,2k3m,2,2lmo,1i,2lob,1d,2lpx,,2lqc,,2lqz,4,2lr5,e,2mtc,6,2mtk,g,2mu3,6,2mub,1,2mue,4,2mxb,,2n1s,6,2nce,,2ne4,3,2nsc,3,2nzi,1,2ok0,6,2on8,6,2pz4,73,2q6l,2,2q7j,,2q98,5,2q9q,1,2qa6,,2qa9,9,2qb1,1k,2qcm,p,2qdd,e,2qe2,,2qen,,2qeq,8,2qf0,3,2qfd,c1,2qrf,4,2qrk,8t,2r0m,7d,2r9c,3j,2rg4,b,2rit,16,2rkc,3,2rm0,7,2rmi,5,2rns,7,2rou,29,2rrg,1a,2rss,9,2rt3,c8,2scg,sd,jny8,v,jnz4,2n,jo1s,3j,jo5c,6n,joc0,2rz",
      "262122424333333393233393339333333333393393b3b3b3b3b333b33b3bb33333b3b3333333b3b33bb3333b33b3bb33333b3bbb333b333b33333b3b3b3b3333b3b33b3bb39333b33b33b3b3b333b333333b3b333333b33b3b3333b3335dc333333b3b3b33323333b3bb3b33b3b3b3333b3333b3b333bb3b33b3b3b3b3b333b333b3323e2244234444444444444444444444444444444444444444443333333333b3b3bb33333b353b3b3b3b333b3b333b333333b3bb3b3b3bb333232333333333333333b3b3333bb3b393933b3b33bb3b393b3b3b3333b33b33b3bbb33b333b3333bb3933b3b3b333b3b3b3b3b33b3b3b33b3b3b33b3b33b33b3b3b33bb39b9b3b33b3b33b9333b393b3b33b33b3b3b3333393b3b3b33b39bb3b332333b333dd3b33332333323333333333333333333333344444444a44444434444444444444423232"
    );
  }
});

// node_modules/unicode-segmenter/_incb_data.cjs
var require_incb_data = __commonJS({
  "node_modules/unicode-segmenter/_incb_data.cjs"(exports) {
    "use strict";
    exports.consonant_ranges = void 0;
    var _core = require_core();
    var consonant_ranges = exports.consonant_ranges = (0, _core.decodeUnicodeData)(
      /** @type {UnicodeDataEncoding} */
      "1sl,10,1ug,7,1vc,7,1w5,j,1wq,6,1wy,,1x2,3,1y4,1,1y7,,1yo,1,239,j,23u,6,242,1,245,4,261,,26t,j,27e,6,27m,1,27p,4,28s,1,28v,,29d,,2dx,j,2ei,f,2fs,2,2l1,11"
    );
  }
});

// node_modules/unicode-segmenter/grapheme.cjs
var require_grapheme = __commonJS({
  "node_modules/unicode-segmenter/grapheme.cjs"(exports) {
    "use strict";
    exports.countGrapheme = exports.countGraphemes = countGraphemes;
    exports.graphemeSegments = graphemeSegments;
    exports.splitGraphemes = splitGraphemes;
    var _core = require_core();
    var _grapheme_data = require_grapheme_data();
    exports.GraphemeCategory = _grapheme_data.GraphemeCategory;
    var _incb_data = require_incb_data();
    var BMP_MAX = 65535;
    function* graphemeSegments(input) {
      let cp = input.codePointAt(0);
      if (cp == null) return;
      let cursor = cp <= BMP_MAX ? 1 : 2;
      let len = input.length;
      let catBefore = cat(cp);
      let catAfter = 0;
      let risCount = 0;
      let emoji = false;
      let consonant = false;
      let linker = false;
      let index = 0;
      let _catBegin = catBefore;
      let _hd = cp;
      while (cursor < len) {
        cp = /** @type {number} */
        input.codePointAt(cursor);
        catAfter = cat(cp);
        let boundary = true;
        if (catBefore === 1) {
          boundary = catAfter !== 6;
        } else if (catBefore === 2 || catBefore === 6) {
          boundary = true;
        } else if (catAfter === 1 || catAfter === 2 || catAfter === 6) {
          boundary = true;
        } else if (catAfter === 3 || catAfter === 14 || catAfter === 11) {
          boundary = false;
        } else if (catBefore === 9) {
          boundary = false;
        } else if (catBefore === 14 && catAfter === 4) {
          boundary = !emoji;
        } else if (catBefore === 10 && catAfter === 10) {
          boundary = risCount++ % 2 === 1;
        } else if (catBefore === 5) {
          boundary = !(catAfter === 5 || catAfter === 13 || catAfter === 7 || catAfter === 8);
        } else if ((catBefore === 7 || catBefore === 13) && (catAfter === 13 || catAfter === 12)) {
          boundary = false;
        } else if ((catBefore === 8 || catBefore === 12) && catAfter === 12) {
          boundary = false;
        } else if (catAfter === 0 && consonant && linker && isIndicConjunctConsonant(cp)) {
          boundary = false;
        }
        if (boundary) {
          yield {
            segment: input.slice(index, cursor),
            index,
            input,
            _hd,
            _catBegin,
            _catEnd: catBefore
          };
          emoji = false;
          risCount = 0;
          index = cursor;
          _catBegin = catAfter;
          _hd = cp;
        } else {
          if (catAfter === 14 && (catBefore === 3 || catBefore === 4)) {
            emoji = true;
          } else if (cp >= 2325) {
            if (!consonant && catBefore === 0) {
              consonant = isIndicConjunctConsonant(_hd);
            }
            if (consonant && catAfter === 3) {
              linker = linker || cp === 2381 || cp === 2509 || cp === 2637 || cp === 2765 || cp === 2893 || cp === 3149 || cp === 3405;
            } else {
              linker = false;
            }
          }
        }
        cursor += cp <= BMP_MAX ? 1 : 2;
        catBefore = catAfter;
      }
      if (index < len) {
        yield {
          segment: input.slice(index),
          index,
          input,
          _hd,
          _catBegin,
          _catEnd: catBefore
        };
      }
    }
    function countGraphemes(text) {
      let count = 0;
      for (let _ of graphemeSegments(text)) count += 1;
      return count;
    }
    function* splitGraphemes(text) {
      for (let s of graphemeSegments(text)) yield s.segment;
    }
    var SEG0 = new Uint8Array(6080);
    var SEG0_MIN = 128;
    var SEG0_MAX = 12287;
    var SEG1 = new Uint8Array(1536);
    var SEG1_MIN = 40960;
    var SEG1_MAX = 44031;
    var SEG_CURSOR = (() => {
      let cursor = 0;
      while (true) {
        let [start, end, cat2] = _grapheme_data.grapheme_ranges[cursor];
        if (start > SEG1_MAX) break;
        cursor++;
        if (end < SEG0_MIN || start > SEG0_MAX && end < SEG1_MIN) continue;
        for (let cp = start; cp <= end; cp++) {
          let seg, idx = 0;
          if (cp <= SEG0_MAX) {
            seg = SEG0;
            idx = cp - SEG0_MIN >> 1;
          } else {
            seg = SEG1;
            idx = cp - SEG1_MIN >> 1;
          }
          seg[idx] = cp & 1 ? seg[idx] & 15 | cat2 << 4 : seg[idx] & 240 | cat2;
        }
      }
      return cursor;
    })();
    function cat(cp) {
      if (cp < SEG0_MIN) {
        if (cp >= 32) return 0;
        if (cp === 10) return 6;
        if (cp === 13) return 1;
        return 2;
      }
      if (cp <= SEG0_MAX) {
        let byte = SEG0[cp - SEG0_MIN >> 1];
        return (
          /** @type {GraphemeCategoryNum} */
          cp & 1 ? byte >> 4 : byte & 15
        );
      }
      if (cp < SEG1_MIN) {
        if (cp < 12336) return cp >= 12330 ? 3 : 0;
        if (cp < 12443) {
          if (cp === 12336 || cp === 12349) return 4;
          return cp >= 12441 ? 3 : 0;
        }
        if (cp === 12951 || cp === 12953) return 4;
        return 0;
      }
      if (cp <= SEG1_MAX) {
        let byte = SEG1[cp - SEG1_MIN >> 1];
        return (
          /** @type {GraphemeCategoryNum} */
          cp & 1 ? byte >> 4 : byte & 15
        );
      }
      if (cp <= 55203) {
        return (cp - 44032) % 28 === 0 ? 7 : 8;
      }
      if (cp <= 55295) {
        if (cp <= 55238) return cp >= 55216 ? 13 : 0;
        return cp >= 55243 ? 12 : 0;
      }
      if (cp < 65024) {
        return cp === 64286 ? 3 : 0;
      }
      let idx = (0, _core.findUnicodeRangeIndex)(cp, _grapheme_data.grapheme_ranges, SEG_CURSOR);
      return idx < 0 ? 0 : _grapheme_data.grapheme_ranges[idx][2];
    }
    function isIndicConjunctConsonant(cp) {
      return (0, _core.findUnicodeRangeIndex)(cp, _incb_data.consonant_ranges) >= 0;
    }
  }
});

// node_modules/@atproto/lex-data/dist/utf8-grapheme-len.js
var require_utf8_grapheme_len = __commonJS({
  "node_modules/@atproto/lex-data/dist/utf8-grapheme-len.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.graphemeLenNative = void 0;
    exports.graphemeLenPonyfill = graphemeLenPonyfill;
    var grapheme_1 = require_grapheme();
    var segmenter = "Segmenter" in Intl && typeof Intl.Segmenter === "function" ? /* @__PURE__ */ new Intl.Segmenter() : (
      /* v8 ignore next -- @preserve */
      null
    );
    exports.graphemeLenNative = segmenter ? function graphemeLenNative(str) {
      let length2 = 0;
      for (const _ of segmenter.segment(str))
        length2++;
      return length2;
    } : (
      /* v8 ignore next -- @preserve */
      null
    );
    function graphemeLenPonyfill(str) {
      return (0, grapheme_1.countGraphemes)(str);
    }
  }
});

// node_modules/@atproto/lex-data/dist/utf8-len.js
var require_utf8_len = __commonJS({
  "node_modules/@atproto/lex-data/dist/utf8-len.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.utf8LenNode = void 0;
    exports.utf8LenCompute = utf8LenCompute;
    var nodejs_buffer_js_1 = require_nodejs_buffer();
    exports.utf8LenNode = nodejs_buffer_js_1.NodeJSBuffer ? function utf8LenNode(string2) {
      return nodejs_buffer_js_1.NodeJSBuffer.byteLength(string2, "utf8");
    } : (
      /* v8 ignore next -- @preserve */
      null
    );
    function utf8LenCompute(string2) {
      let len = string2.length;
      let code2;
      for (let i = 0; i < string2.length; i += 1) {
        code2 = string2.charCodeAt(i);
        if (code2 <= 127) {
        } else if (code2 <= 2047) {
          len += 1;
        } else {
          len += 2;
          if (code2 >= 55296 && code2 <= 56319) {
            code2 = string2.charCodeAt(i + 1);
            if (code2 >= 56320 && code2 <= 57343) {
              i++;
            }
          }
        }
      }
      return len;
    }
  }
});

// node_modules/@atproto/lex-data/dist/utf8-to-base64.js
var require_utf8_to_base64 = __commonJS({
  "node_modules/@atproto/lex-data/dist/utf8-to-base64.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.utf8ToBase64Node = void 0;
    exports.utf8ToBase64Ponyfill = utf8ToBase64Ponyfill;
    var to_string_1 = (init_to_string(), __toCommonJS(to_string_exports));
    var nodejs_buffer_js_1 = require_nodejs_buffer();
    var uint8array_to_base64_js_1 = require_uint8array_to_base64();
    var Buffer2 = nodejs_buffer_js_1.NodeJSBuffer;
    exports.utf8ToBase64Node = Buffer2 ? function utf8ToBase64Node(text, alphabet2) {
      const buffer = Buffer2.from(text, "utf8");
      return uint8array_to_base64_js_1.toBase64Node(buffer, alphabet2);
    } : (
      /* v8 ignore next -- @preserve */
      null
    );
    var textEncoder2 = /* @__PURE__ */ new TextEncoder();
    function utf8ToBase64Ponyfill(text, alphabet2) {
      const bytes = textEncoder2.encode(text);
      return (0, to_string_1.toString)(bytes, alphabet2);
    }
  }
});

// node_modules/@atproto/lex-data/dist/utf8.js
var require_utf8 = __commonJS({
  "node_modules/@atproto/lex-data/dist/utf8.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.utf8FromBase64 = exports.utf8ToBase64 = exports.utf8Len = exports.graphemeLen = void 0;
    var utf8_from_base64_js_1 = require_utf8_from_base64();
    var utf8_grapheme_len_js_1 = require_utf8_grapheme_len();
    var utf8_len_js_1 = require_utf8_len();
    var utf8_to_base64_js_1 = require_utf8_to_base64();
    exports.graphemeLen = /* v8 ignore next -- @preserve */
    utf8_grapheme_len_js_1.graphemeLenNative ?? utf8_grapheme_len_js_1.graphemeLenPonyfill;
    if (exports.graphemeLen === utf8_grapheme_len_js_1.graphemeLenPonyfill) {
      /* @__PURE__ */ console.warn("[@atproto/lex-data]: Intl.Segmenter is not available in this environment. Falling back to ponyfill implementation.");
    }
    exports.utf8Len = /* v8 ignore next -- @preserve */
    utf8_len_js_1.utf8LenNode ?? utf8_len_js_1.utf8LenCompute;
    exports.utf8ToBase64 = /* v8 ignore next -- @preserve */
    utf8_to_base64_js_1.utf8ToBase64Node ?? utf8_to_base64_js_1.utf8ToBase64Ponyfill;
    exports.utf8FromBase64 = /* v8 ignore next -- @preserve */
    utf8_from_base64_js_1.utf8FromBase64Node ?? utf8_from_base64_js_1.utf8FromBase64Ponyfill;
  }
});

// node_modules/@atproto/lex-data/dist/index.js
var require_dist = __commonJS({
  "node_modules/@atproto/lex-data/dist/index.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
    tslib_1.__exportStar(require_blob(), exports);
    tslib_1.__exportStar(require_cid(), exports);
    tslib_1.__exportStar(require_lex_equals(), exports);
    tslib_1.__exportStar(require_lex_error(), exports);
    tslib_1.__exportStar(require_lex(), exports);
    tslib_1.__exportStar(require_object(), exports);
    tslib_1.__exportStar(require_uint8array(), exports);
    tslib_1.__exportStar(require_utf8(), exports);
  }
});

// node_modules/@atproto/lex-json/dist/bytes.js
var require_bytes = __commonJS({
  "node_modules/@atproto/lex-json/dist/bytes.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.parseLexBytes = parseLexBytes;
    exports.encodeLexBytes = encodeLexBytes;
    var lex_data_1 = require_dist();
    function parseLexBytes(input) {
      if (!input || !("$bytes" in input)) {
        return void 0;
      }
      for (const key in input) {
        if (key !== "$bytes") {
          return void 0;
        }
      }
      if (typeof input.$bytes !== "string") {
        return void 0;
      }
      try {
        return (0, lex_data_1.fromBase64)(input.$bytes);
      } catch {
        return void 0;
      }
    }
    function encodeLexBytes(bytes) {
      return { $bytes: (0, lex_data_1.toBase64)(bytes) };
    }
  }
});

// node_modules/@atproto/lex-json/dist/json.js
var require_json = __commonJS({
  "node_modules/@atproto/lex-json/dist/json.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/@atproto/lex-json/dist/link.js
var require_link = __commonJS({
  "node_modules/@atproto/lex-json/dist/link.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.parseLexLink = parseLexLink;
    exports.encodeLexLink = encodeLexLink;
    var lex_data_1 = require_dist();
    function parseLexLink(input, options) {
      if (!input || !("$link" in input)) {
        return void 0;
      }
      for (const key in input) {
        if (key !== "$link") {
          return void 0;
        }
      }
      const { $link } = input;
      if (typeof $link !== "string") {
        return void 0;
      }
      if ($link.length === 0) {
        return void 0;
      }
      if ($link.length > 2048) {
        return void 0;
      }
      try {
        return (0, lex_data_1.parseCid)($link, options);
      } catch (cause) {
        return void 0;
      }
    }
    function encodeLexLink(cid) {
      return { $link: cid.toString() };
    }
  }
});

// node_modules/@atproto/lex-json/dist/blob.js
var require_blob2 = __commonJS({
  "node_modules/@atproto/lex-json/dist/blob.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.parseBlobRef = parseBlobRef;
    var lex_data_1 = require_dist();
    var link_js_1 = require_link();
    function parseBlobRef(input, options) {
      if (input.$type !== "blob")
        return void 0;
      const ref = input?.ref;
      if (!ref || typeof ref !== "object")
        return void 0;
      if ("$link" in ref) {
        const cid = (0, link_js_1.parseLexLink)(ref);
        if (!cid)
          return void 0;
        const blob = { ...input, ref: cid };
        if ((0, lex_data_1.isBlobRef)(blob, options))
          return blob;
      }
      if ((0, lex_data_1.isBlobRef)(input)) {
        return input;
      }
      return void 0;
    }
  }
});

// node_modules/@atproto/lex-json/dist/lex-json.js
var require_lex_json = __commonJS({
  "node_modules/@atproto/lex-json/dist/lex-json.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.lexStringify = lexStringify;
    exports.lexParse = lexParse;
    exports.jsonToLex = jsonToLex;
    exports.lexToJson = lexToJson;
    var lex_data_1 = require_dist();
    var blob_js_1 = require_blob2();
    var bytes_js_1 = require_bytes();
    var link_js_1 = require_link();
    function lexStringify(input) {
      return JSON.stringify(lexToJson(input));
    }
    function lexParse(input, options = { strict: false }) {
      return JSON.parse(input, function(key, value) {
        switch (typeof value) {
          case "object":
            if (value === null)
              return null;
            if (Array.isArray(value))
              return value;
            return parseSpecialJsonObject(value, options) ?? value;
          case "number":
            if (Number.isSafeInteger(value))
              return value;
            if (options.strict) {
              throw new TypeError(`Invalid non-integer number: ${value}`);
            }
          // fallthrough
          default:
            return value;
        }
      });
    }
    function jsonToLex(value, options = { strict: false }) {
      switch (typeof value) {
        case "object": {
          if (value === null)
            return null;
          if (Array.isArray(value))
            return jsonArrayToLex(value, options);
          return parseSpecialJsonObject(value, options) ?? jsonObjectToLexMap(value, options);
        }
        case "number":
          if (Number.isSafeInteger(value))
            return value;
          if (options.strict) {
            throw new TypeError(`Invalid non-integer number: ${value}`);
          }
        // fallthrough
        case "boolean":
        case "string":
          return value;
        default:
          throw new TypeError(`Invalid JSON value: ${typeof value}`);
      }
    }
    function jsonArrayToLex(input, options) {
      let copy;
      for (let i = 0; i < input.length; i++) {
        const inputItem = input[i];
        const item = jsonToLex(inputItem, options);
        if (item !== inputItem) {
          copy ?? (copy = Array.from(input));
          copy[i] = item;
        }
      }
      return copy ?? input;
    }
    function jsonObjectToLexMap(input, options) {
      let copy = void 0;
      for (const [key, jsonValue] of Object.entries(input)) {
        if (key === "__proto__") {
          throw new TypeError("Invalid key: __proto__");
        }
        if (jsonValue === void 0) {
          copy ?? (copy = { ...input });
          delete copy[key];
          continue;
        }
        const value = jsonToLex(jsonValue, options);
        if (value !== jsonValue) {
          copy ?? (copy = { ...input });
          copy[key] = value;
        }
      }
      return copy ?? input;
    }
    function lexToJson(value) {
      switch (typeof value) {
        case "object":
          if (value === null) {
            return value;
          } else if (Array.isArray(value)) {
            return lexArrayToJson(value);
          } else if ((0, lex_data_1.isCid)(value)) {
            return (0, link_js_1.encodeLexLink)(value);
          } else if (ArrayBuffer.isView(value)) {
            return (0, bytes_js_1.encodeLexBytes)(value);
          } else {
            return encodeLexMap(value);
          }
        case "boolean":
        case "string":
        case "number":
          return value;
        default:
          throw new TypeError(`Invalid Lex value: ${typeof value}`);
      }
    }
    function lexArrayToJson(input) {
      let copy;
      for (let i = 0; i < input.length; i++) {
        const inputItem = input[i];
        const item = lexToJson(inputItem);
        if (item !== inputItem) {
          copy ?? (copy = Array.from(input));
          copy[i] = item;
        }
      }
      return copy ?? input;
    }
    function encodeLexMap(input) {
      let copy = void 0;
      for (const [key, lexValue] of Object.entries(input)) {
        if (key === "__proto__") {
          throw new TypeError("Invalid key: __proto__");
        }
        if (lexValue === void 0) {
          copy ?? (copy = { ...input });
          delete copy[key];
          continue;
        }
        const jsonValue = lexToJson(lexValue);
        if (jsonValue !== lexValue) {
          copy ?? (copy = { ...input });
          copy[key] = jsonValue;
        }
      }
      return copy ?? input;
    }
    function parseSpecialJsonObject(input, options) {
      if (input.$link !== void 0) {
        const cid = (0, link_js_1.parseLexLink)(input);
        if (cid)
          return cid;
        if (options.strict)
          throw new TypeError(`Invalid $link object`);
      } else if (input.$bytes !== void 0) {
        const bytes = (0, bytes_js_1.parseLexBytes)(input);
        if (bytes)
          return bytes;
        if (options.strict)
          throw new TypeError(`Invalid $bytes object`);
      } else if (input.$type !== void 0) {
        if (options.strict) {
          if (input.$type === "blob") {
            const blob = (0, blob_js_1.parseBlobRef)(input, options);
            if (blob)
              return blob;
            throw new TypeError(`Invalid blob object`);
          } else if (typeof input.$type !== "string") {
            throw new TypeError(`Invalid $type property (${typeof input.$type})`);
          } else if (input.$type.length === 0) {
            throw new TypeError(`Empty $type property`);
          }
        }
      }
      return void 0;
    }
  }
});

// node_modules/@atproto/lex-json/dist/index.js
var require_dist2 = __commonJS({
  "node_modules/@atproto/lex-json/dist/index.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
    tslib_1.__exportStar(require_bytes(), exports);
    tslib_1.__exportStar(require_json(), exports);
    tslib_1.__exportStar(require_lex_json(), exports);
    tslib_1.__exportStar(require_link(), exports);
  }
});

// node_modules/@atproto/common-web/dist/ipld.js
var require_ipld = __commonJS({
  "node_modules/@atproto/common-web/dist/ipld.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ipldEquals = exports.ipldToJson = exports.jsonToIpld = void 0;
    var lex_data_1 = require_dist();
    var lex_json_1 = require_dist2();
    var jsonToIpld = (val) => {
      return (0, lex_json_1.jsonToLex)(val, { strict: false });
    };
    exports.jsonToIpld = jsonToIpld;
    var ipldToJson = (val) => {
      if (val === void 0)
        return val;
      if (Number.isNaN(val))
        return val;
      return (0, lex_json_1.lexToJson)(val);
    };
    exports.ipldToJson = ipldToJson;
    var ipldEquals = (a, b) => {
      if (!(0, lex_data_1.lexEquals)(a, b))
        return false;
      if (Number.isNaN(a))
        return false;
      return true;
    };
    exports.ipldEquals = ipldEquals;
  }
});

// node_modules/@atproto/common-web/dist/retry.js
var require_retry = __commonJS({
  "node_modules/@atproto/common-web/dist/retry.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.retry = retry;
    exports.createRetryable = createRetryable;
    exports.backoffMs = backoffMs;
    var util_1 = require_util2();
    async function retry(fn, opts = {}) {
      const { maxRetries = 3, retryable = () => true, getWaitMs = backoffMs } = opts;
      let retries = 0;
      let doneError;
      while (!doneError) {
        try {
          return await fn();
        } catch (err) {
          const waitMs = getWaitMs(retries);
          const willRetry = retries < maxRetries && waitMs !== null && retryable(err);
          if (willRetry) {
            retries += 1;
            if (waitMs !== 0) {
              await (0, util_1.wait)(waitMs);
            }
          } else {
            doneError = err;
          }
        }
      }
      throw doneError;
    }
    function createRetryable(retryable) {
      return async (fn, opts) => retry(fn, { ...opts, retryable });
    }
    function backoffMs(n, multiplier = 100, max = 1e3) {
      const exponentialMs = Math.pow(2, n) * multiplier;
      const ms = Math.min(exponentialMs, max);
      return jitter(ms);
    }
    function jitter(value) {
      const delta = value * 0.15;
      return value + randomRange(-delta, delta);
    }
    function randomRange(from3, to) {
      const rand = Math.random() * (to - from3);
      return rand + from3;
    }
  }
});

// node_modules/@atproto/common-web/dist/types.js
var require_types2 = __commonJS({
  "node_modules/@atproto/common-web/dist/types.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.def = exports.schema = void 0;
    var zod_1 = require_zod();
    var lex_data_1 = require_dist();
    var cidSchema = zod_1.z.unknown().transform((obj, ctx) => {
      const cid = lex_data_1.CID.asCID(obj);
      if (cid == null) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: "Not a valid CID"
        });
        return zod_1.z.NEVER;
      }
      return cid;
    });
    var carHeader = zod_1.z.object({
      version: zod_1.z.literal(1),
      roots: zod_1.z.array(cidSchema)
    });
    exports.schema = {
      cid: cidSchema,
      carHeader,
      bytes: zod_1.z.instanceof(Uint8Array),
      string: zod_1.z.string(),
      array: zod_1.z.array(zod_1.z.unknown()),
      map: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
      unknown: zod_1.z.unknown()
    };
    exports.def = {
      cid: {
        name: "cid",
        schema: exports.schema.cid
      },
      carHeader: {
        name: "CAR header",
        schema: exports.schema.carHeader
      },
      bytes: {
        name: "bytes",
        schema: exports.schema.bytes
      },
      string: {
        name: "string",
        schema: exports.schema.string
      },
      map: {
        name: "map",
        schema: exports.schema.map
      },
      unknown: {
        name: "unknown",
        schema: exports.schema.unknown
      }
    };
  }
});

// node_modules/@atproto/common-web/dist/times.js
var require_times = __commonJS({
  "node_modules/@atproto/common-web/dist/times.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.addHoursToDate = exports.lessThanAgoMs = exports.DAY = exports.HOUR = exports.MINUTE = exports.SECOND = void 0;
    exports.SECOND = 1e3;
    exports.MINUTE = exports.SECOND * 60;
    exports.HOUR = exports.MINUTE * 60;
    exports.DAY = exports.HOUR * 24;
    var lessThanAgoMs = (time, range) => {
      return Date.now() < time.getTime() + range;
    };
    exports.lessThanAgoMs = lessThanAgoMs;
    var addHoursToDate = (hours, startingDate) => {
      const currentDate = startingDate ? new Date(startingDate) : /* @__PURE__ */ new Date();
      currentDate.setHours(currentDate.getHours() + hours);
      return currentDate;
    };
    exports.addHoursToDate = addHoursToDate;
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/did.js
var require_did = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/did.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidDidError = void 0;
    exports.ensureValidDid = ensureValidDid;
    exports.ensureValidDidRegex = ensureValidDidRegex;
    exports.isValidDid = isValidDid;
    function ensureValidDid(input) {
      if (!input.startsWith("did:")) {
        throw new InvalidDidError('DID requires "did:" prefix');
      }
      if (input.length > 2048) {
        throw new InvalidDidError("DID is too long (2048 chars max)");
      }
      if (input.endsWith(":") || input.endsWith("%")) {
        throw new InvalidDidError('DID can not end with ":" or "%"');
      }
      if (!/^[a-zA-Z0-9._:%-]*$/.test(input)) {
        throw new InvalidDidError("Disallowed characters in DID (ASCII letters, digits, and a couple other characters only)");
      }
      const { length: length2, 1: method } = input.split(":");
      if (length2 < 3) {
        throw new InvalidDidError("DID requires prefix, method, and method-specific content");
      }
      if (!/^[a-z]+$/.test(method)) {
        throw new InvalidDidError("DID method must be lower-case letters");
      }
    }
    var DID_REGEX = /^did:[a-z]+:[a-zA-Z0-9._:%-]*[a-zA-Z0-9._-]$/;
    function ensureValidDidRegex(input) {
      if (!DID_REGEX.test(input)) {
        throw new InvalidDidError("DID didn't validate via regex");
      }
      if (input.length > 2048) {
        throw new InvalidDidError("DID is too long (2048 chars max)");
      }
    }
    function isValidDid(input) {
      return input.length <= 2048 && DID_REGEX.test(input);
    }
    var InvalidDidError = class extends Error {
    };
    exports.InvalidDidError = InvalidDidError;
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/handle.js
var require_handle = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/handle.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DisallowedDomainError = exports.UnsupportedDomainError = exports.ReservedHandleError = exports.InvalidHandleError = exports.DISALLOWED_TLDS = exports.INVALID_HANDLE = void 0;
    exports.ensureValidHandle = ensureValidHandle;
    exports.ensureValidHandleRegex = ensureValidHandleRegex;
    exports.normalizeHandle = normalizeHandle;
    exports.normalizeAndEnsureValidHandle = normalizeAndEnsureValidHandle;
    exports.isValidHandle = isValidHandle;
    exports.isValidTld = isValidTld;
    exports.INVALID_HANDLE = "handle.invalid";
    exports.DISALLOWED_TLDS = [
      ".local",
      ".arpa",
      ".invalid",
      ".localhost",
      ".internal",
      ".example",
      ".alt",
      // policy could concievably change on ".onion" some day
      ".onion"
      // NOTE: .test is allowed in testing and devopment. In practical terms
      // "should" "never" actually resolve and get registered in production
    ];
    function ensureValidHandle(input) {
      if (!/^[a-zA-Z0-9.-]*$/.test(input)) {
        throw new InvalidHandleError("Disallowed characters in handle (ASCII letters, digits, dashes, periods only)");
      }
      if (input.length > 253) {
        throw new InvalidHandleError("Handle is too long (253 chars max)");
      }
      const labels = input.split(".");
      if (labels.length < 2) {
        throw new InvalidHandleError("Handle domain needs at least two parts");
      }
      for (let i = 0; i < labels.length; i++) {
        const l = labels[i];
        if (l.length < 1) {
          throw new InvalidHandleError("Handle parts can not be empty");
        }
        if (l.length > 63) {
          throw new InvalidHandleError("Handle part too long (max 63 chars)");
        }
        if (l.endsWith("-") || l.startsWith("-")) {
          throw new InvalidHandleError("Handle parts can not start or end with hyphens");
        }
        if (i + 1 === labels.length && !/^[a-zA-Z]/.test(l)) {
          throw new InvalidHandleError("Handle final component (TLD) must start with ASCII letter");
        }
      }
    }
    var HANDLE_REGEX = /^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/;
    function ensureValidHandleRegex(input) {
      if (input.length > 253) {
        throw new InvalidHandleError("Handle is too long (253 chars max)");
      }
      if (!HANDLE_REGEX.test(input)) {
        throw new InvalidHandleError("Handle didn't validate via regex");
      }
    }
    function normalizeHandle(handle) {
      return handle.toLowerCase();
    }
    function normalizeAndEnsureValidHandle(handle) {
      const normalized = normalizeHandle(handle);
      ensureValidHandle(normalized);
      return normalized;
    }
    function isValidHandle(input) {
      return input.length <= 253 && HANDLE_REGEX.test(input);
    }
    function isValidTld(handle) {
      for (const tld of exports.DISALLOWED_TLDS) {
        if (handle.endsWith(tld)) {
          return false;
        }
      }
      return true;
    }
    var InvalidHandleError = class extends Error {
    };
    exports.InvalidHandleError = InvalidHandleError;
    var ReservedHandleError = class extends Error {
    };
    exports.ReservedHandleError = ReservedHandleError;
    var UnsupportedDomainError = class extends Error {
    };
    exports.UnsupportedDomainError = UnsupportedDomainError;
    var DisallowedDomainError = class extends Error {
    };
    exports.DisallowedDomainError = DisallowedDomainError;
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/at-identifier.js
var require_at_identifier = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/at-identifier.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isHandleIdentifier = isHandleIdentifier;
    exports.isDidIdentifier = isDidIdentifier;
    exports.assertAtIdentifierString = assertAtIdentifierString;
    exports.ensureValidAtIdentifier = assertAtIdentifierString;
    exports.asAtIdentifierString = asAtIdentifierString;
    exports.isAtIdentifierString = isAtIdentifierString;
    exports.isValidAtIdentifier = isAtIdentifierString;
    exports.ifAtIdentifierString = ifAtIdentifierString;
    var did_js_1 = require_did();
    var handle_js_1 = require_handle();
    function isHandleIdentifier(id) {
      return !isDidIdentifier(id);
    }
    function isDidIdentifier(id) {
      return id.startsWith("did:");
    }
    function assertAtIdentifierString(input) {
      try {
        if (!input || typeof input !== "string") {
          throw new TypeError("Identifier must be a non-empty string");
        } else if (input.startsWith("did:")) {
          (0, did_js_1.ensureValidDidRegex)(input);
        } else {
          (0, handle_js_1.ensureValidHandleRegex)(input);
        }
      } catch (cause) {
        throw new handle_js_1.InvalidHandleError("Invalid DID or handle", { cause });
      }
    }
    function asAtIdentifierString(input) {
      assertAtIdentifierString(input);
      return input;
    }
    function isAtIdentifierString(input) {
      if (!input || typeof input !== "string") {
        return false;
      } else if (input.startsWith("did:")) {
        return (0, did_js_1.isValidDid)(input);
      } else {
        return (0, handle_js_1.isValidHandle)(input);
      }
    }
    function ifAtIdentifierString(input) {
      return isAtIdentifierString(input) ? input : void 0;
    }
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/nsid.js
var require_nsid = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/nsid.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidNsidError = exports.NSID = void 0;
    exports.ensureValidNsid = ensureValidNsid;
    exports.parseNsid = parseNsid;
    exports.isValidNsid = isValidNsid;
    exports.validateNsid = validateNsid;
    exports.ensureValidNsidRegex = ensureValidNsidRegex;
    exports.validateNsidRegex = validateNsidRegex;
    var NSID = class _NSID {
      segments;
      static parse(input) {
        return new _NSID(input);
      }
      static create(authority, name2) {
        const input = [...authority.split(".").reverse(), name2].join(".");
        return new _NSID(input);
      }
      static isValid(nsid) {
        return isValidNsid(nsid);
      }
      static from(input) {
        if (input instanceof _NSID) {
          return input;
        }
        if (Array.isArray(input)) {
          return new _NSID(input.join("."));
        }
        return new _NSID(String(input));
      }
      constructor(nsid) {
        this.segments = parseNsid(nsid);
      }
      get authority() {
        return this.segments.slice(0, this.segments.length - 1).reverse().join(".");
      }
      get name() {
        return this.segments.at(this.segments.length - 1);
      }
      toString() {
        return this.segments.join(".");
      }
    };
    exports.NSID = NSID;
    function ensureValidNsid(input) {
      const result = validateNsid(input);
      if (!result.success)
        throw new InvalidNsidError(result.message);
    }
    function parseNsid(nsid) {
      const result = validateNsid(nsid);
      if (!result.success)
        throw new InvalidNsidError(result.message);
      return result.value;
    }
    function isValidNsid(input) {
      return validateNsidRegex(input).success;
    }
    function validateNsid(input) {
      if (input.length > 253 + 1 + 63) {
        return {
          success: false,
          message: "NSID is too long (317 chars max)"
        };
      }
      if (hasDisallowedCharacters(input)) {
        return {
          success: false,
          message: "Disallowed characters in NSID (ASCII letters, digits, dashes, periods only)"
        };
      }
      const segments = input.split(".");
      if (segments.length < 3) {
        return {
          success: false,
          message: "NSID needs at least three parts"
        };
      }
      for (const l of segments) {
        if (l.length < 1) {
          return {
            success: false,
            message: "NSID parts can not be empty"
          };
        }
        if (l.length > 63) {
          return {
            success: false,
            message: "NSID part too long (max 63 chars)"
          };
        }
        if (startsWithHyphen(l) || endsWithHyphen(l)) {
          return {
            success: false,
            message: "NSID parts can not start or end with hyphen"
          };
        }
      }
      if (startsWithNumber(segments[0])) {
        return {
          success: false,
          message: "NSID first part may not start with a digit"
        };
      }
      if (!isValidIdentifier(segments[segments.length - 1])) {
        return {
          success: false,
          message: "NSID name part must be only letters and digits (and no leading digit)"
        };
      }
      return {
        success: true,
        value: segments
      };
    }
    function hasDisallowedCharacters(v) {
      return !/^[a-zA-Z0-9.-]*$/.test(v);
    }
    function startsWithNumber(v) {
      const charCode = v.charCodeAt(0);
      return charCode >= 48 && charCode <= 57;
    }
    function startsWithHyphen(v) {
      return v.charCodeAt(0) === 45;
    }
    function endsWithHyphen(v) {
      return v.charCodeAt(v.length - 1) === 45;
    }
    function isValidIdentifier(v) {
      return !startsWithNumber(v) && !v.includes("-");
    }
    function ensureValidNsidRegex(nsid) {
      const result = validateNsidRegex(nsid);
      if (!result.success)
        throw new InvalidNsidError(result.message);
    }
    function validateNsidRegex(value) {
      if (value.length > 253 + 1 + 63) {
        return {
          success: false,
          message: "NSID is too long (317 chars max)"
        };
      }
      if (
        // Fast check for small values
        value.length < 5 || !/^[a-zA-Z](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?:\.[a-zA-Z](?:[a-zA-Z0-9]{0,62})?)$/.test(value)
      ) {
        return {
          success: false,
          message: "NSID didn't validate via regex"
        };
      }
      return {
        success: true,
        value
      };
    }
    var InvalidNsidError = class extends Error {
    };
    exports.InvalidNsidError = InvalidNsidError;
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/recordkey.js
var require_recordkey = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/recordkey.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidRecordKeyError = void 0;
    exports.ensureValidRecordKey = ensureValidRecordKey;
    exports.isValidRecordKey = isValidRecordKey;
    var RECORD_KEY_MAX_LENGTH = 512;
    var RECORD_KEY_MIN_LENGTH = 1;
    var RECORD_KEY_INVALID_VALUES = /* @__PURE__ */ new Set([".", ".."]);
    var RECORD_KEY_REGEX = /^[a-zA-Z0-9_~.:-]{1,512}$/;
    function ensureValidRecordKey(input) {
      if (input.length > RECORD_KEY_MAX_LENGTH || input.length < RECORD_KEY_MIN_LENGTH) {
        throw new InvalidRecordKeyError(`record key must be ${RECORD_KEY_MIN_LENGTH} to ${RECORD_KEY_MAX_LENGTH} characters`);
      }
      if (RECORD_KEY_INVALID_VALUES.has(input)) {
        throw new InvalidRecordKeyError('record key can not be "." or ".."');
      }
      if (!RECORD_KEY_REGEX.test(input)) {
        throw new InvalidRecordKeyError("record key syntax not valid (regex)");
      }
    }
    function isValidRecordKey(input) {
      return input.length >= RECORD_KEY_MIN_LENGTH && input.length <= RECORD_KEY_MAX_LENGTH && RECORD_KEY_REGEX.test(input) && !RECORD_KEY_INVALID_VALUES.has(input);
    }
    var InvalidRecordKeyError = class extends Error {
    };
    exports.InvalidRecordKeyError = InvalidRecordKeyError;
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/aturi_validation.js
var require_aturi_validation = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/aturi_validation.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ensureValidAtUri = ensureValidAtUri;
    exports.ensureValidAtUriRegex = ensureValidAtUriRegex;
    exports.isValidAtUri = isValidAtUri;
    var at_identifier_js_1 = require_at_identifier();
    var did_js_1 = require_did();
    var handle_js_1 = require_handle();
    var nsid_js_1 = require_nsid();
    function ensureValidAtUri(input) {
      const fragmentIndex = input.indexOf("#");
      if (fragmentIndex !== -1) {
        if (input.charCodeAt(fragmentIndex + 1) !== 47) {
          throw new Error("ATURI fragment must be non-empty and start with slash");
        }
        if (input.includes("#", fragmentIndex + 1)) {
          throw new Error('ATURI can have at most one "#", separating fragment out');
        }
        const fragment = input.slice(fragmentIndex + 1);
        if (!/^\/[a-zA-Z0-9._~:@!$&')(*+,;=%[\]/-]*$/.test(fragment)) {
          throw new Error("Disallowed characters in ATURI fragment (ASCII)");
        }
      }
      const uri = fragmentIndex === -1 ? input : input.slice(0, fragmentIndex);
      if (uri.length > 8 * 1024) {
        throw new Error("ATURI is far too long");
      }
      if (!uri.startsWith("at://")) {
        throw new Error('ATURI must start with "at://"');
      }
      if (!/^[a-zA-Z0-9._~:@!$&')(*+,;=%/-]*$/.test(uri)) {
        throw new Error("Disallowed characters in ATURI (ASCII)");
      }
      const authorityEnd = uri.indexOf("/", 5);
      const authority = authorityEnd === -1 ? uri.slice(5) : uri.slice(5, authorityEnd);
      try {
        (0, at_identifier_js_1.ensureValidAtIdentifier)(authority);
      } catch (cause) {
        throw new Error("ATURI authority must be a valid handle or DID", { cause });
      }
      const collectionStart = authorityEnd === -1 ? -1 : authorityEnd + 1;
      const collectionEnd = collectionStart === -1 ? -1 : uri.indexOf("/", collectionStart);
      if (collectionStart !== -1) {
        const collection = collectionEnd === -1 ? uri.slice(collectionStart) : uri.slice(collectionStart, collectionEnd);
        if (collection.length === 0) {
          throw new Error("ATURI can not have a slash after authority without a path segment");
        }
        if (!(0, nsid_js_1.isValidNsid)(collection)) {
          throw new Error("ATURI requires first path segment (if supplied) to be valid NSID");
        }
      }
      const recordKeyStart = collectionEnd === -1 ? -1 : collectionEnd + 1;
      const recordKeyEnd = recordKeyStart === -1 ? -1 : uri.indexOf("/", recordKeyStart);
      if (recordKeyStart !== -1) {
        if (recordKeyStart === uri.length) {
          throw new Error("ATURI can not have a slash after collection, unless record key is provided");
        }
      }
      if (recordKeyEnd !== -1) {
        throw new Error("ATURI path can have at most two parts, and no trailing slash");
      }
    }
    function ensureValidAtUriRegex(input) {
      const aturiRegex = /^at:\/\/(?<authority>[a-zA-Z0-9._:%-]+)(\/(?<collection>[a-zA-Z0-9-.]+)(\/(?<rkey>[a-zA-Z0-9._~:@!$&%')(*+,;=-]+))?)?(#(?<fragment>\/[a-zA-Z0-9._~:@!$&%')(*+,;=\-[\]/\\]*))?$/;
      const rm = input.match(aturiRegex);
      if (!rm || !rm.groups) {
        throw new Error("ATURI didn't validate via regex");
      }
      const groups = rm.groups;
      try {
        (0, handle_js_1.ensureValidHandleRegex)(groups.authority);
      } catch {
        try {
          (0, did_js_1.ensureValidDidRegex)(groups.authority);
        } catch {
          throw new Error("ATURI authority must be a valid handle or DID");
        }
      }
      if (groups.collection && !(0, nsid_js_1.isValidNsid)(groups.collection)) {
        throw new Error("ATURI collection path segment must be a valid NSID");
      }
      if (input.length > 8 * 1024) {
        throw new Error("ATURI is far too long");
      }
    }
    function isValidAtUri(input) {
      try {
        ensureValidAtUri(input);
      } catch {
        return false;
      }
      return true;
    }
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/aturi.js
var require_aturi = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/aturi.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AtUri = exports.ATP_URI_REGEX = void 0;
    var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
    var at_identifier_js_1 = require_at_identifier();
    var did_js_1 = require_did();
    var nsid_js_1 = require_nsid();
    var recordkey_js_1 = require_recordkey();
    tslib_1.__exportStar(require_aturi_validation(), exports);
    exports.ATP_URI_REGEX = // proto-    --did--------------   --name----------------   --path----   --query--   --hash--
    /^(at:\/\/)?((?:did:[a-z0-9:%-]+)|(?:[a-z0-9][a-z0-9.:-]*))(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
    var RELATIVE_REGEX = /^(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
    var AtUri = class _AtUri {
      hash;
      host;
      pathname;
      searchParams;
      constructor(uri, base3) {
        const parsed = base3 !== void 0 ? typeof base3 === "string" ? Object.assign(parse2(base3), parseRelative(uri)) : Object.assign({ host: base3.host }, parseRelative(uri)) : parse2(uri);
        (0, at_identifier_js_1.ensureValidAtIdentifier)(parsed.host);
        this.hash = parsed.hash ?? "";
        this.host = parsed.host;
        this.pathname = parsed.pathname ?? "";
        this.searchParams = parsed.searchParams;
      }
      static make(handleOrDid, collection, rkey) {
        let str = handleOrDid;
        if (collection)
          str += "/" + collection;
        if (rkey)
          str += "/" + rkey;
        return new _AtUri(str);
      }
      get protocol() {
        return "at:";
      }
      get origin() {
        return `at://${this.host}`;
      }
      get did() {
        const { host } = this;
        if ((0, at_identifier_js_1.isDidIdentifier)(host))
          return host;
        throw new did_js_1.InvalidDidError(`AtUri "${this}" does not have a DID hostname`);
      }
      get hostname() {
        return this.host;
      }
      set hostname(v) {
        (0, at_identifier_js_1.ensureValidAtIdentifier)(v);
        this.host = v;
      }
      get search() {
        return this.searchParams.toString();
      }
      set search(v) {
        this.searchParams = new URLSearchParams(v);
      }
      get collection() {
        return this.pathname.split("/").filter(Boolean)[0] || "";
      }
      get collectionSafe() {
        const { collection } = this;
        (0, nsid_js_1.ensureValidNsid)(collection);
        return collection;
      }
      set collection(v) {
        (0, nsid_js_1.ensureValidNsid)(v);
        this.unsafelySetCollection(v);
      }
      unsafelySetCollection(v) {
        const parts = this.pathname.split("/").filter(Boolean);
        parts[0] = v;
        this.pathname = parts.join("/");
      }
      get rkey() {
        return this.pathname.split("/").filter(Boolean)[1] || "";
      }
      get rkeySafe() {
        const { rkey } = this;
        (0, recordkey_js_1.ensureValidRecordKey)(rkey);
        return rkey;
      }
      set rkey(v) {
        (0, recordkey_js_1.ensureValidRecordKey)(v);
        this.unsafelySetRkey(v);
      }
      unsafelySetRkey(v) {
        const parts = this.pathname.split("/").filter(Boolean);
        parts[0] ||= "undefined";
        parts[1] = v;
        this.pathname = parts.join("/");
      }
      get href() {
        return this.toString();
      }
      toString() {
        let path = this.pathname || "/";
        if (!path.startsWith("/")) {
          path = `/${path}`;
        }
        let qs = "";
        if (this.searchParams.size) {
          qs = `?${this.searchParams.toString()}`;
        }
        let hash = this.hash;
        if (hash && !hash.startsWith("#")) {
          hash = `#${hash}`;
        }
        return `at://${this.host}${path}${qs}${hash}`;
      }
    };
    exports.AtUri = AtUri;
    function parse2(str) {
      const match = str.match(exports.ATP_URI_REGEX);
      if (!match) {
        throw new Error(`Invalid AT uri: ${str}`);
      }
      return {
        host: match[2],
        hash: match[5],
        pathname: match[3],
        searchParams: new URLSearchParams(match[4])
      };
    }
    function parseRelative(str) {
      const match = str.match(RELATIVE_REGEX);
      if (!match) {
        throw new Error(`Invalid path: ${str}`);
      }
      return {
        hash: match[3],
        pathname: match[1],
        searchParams: new URLSearchParams(match[2])
      };
    }
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/datetime.js
var require_datetime = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/datetime.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidDatetimeError = void 0;
    exports.assertAtprotoDate = assertAtprotoDate;
    exports.asAtprotoDate = asAtprotoDate;
    exports.isAtprotoDate = isAtprotoDate;
    exports.ifAtprotoDate = ifAtprotoDate;
    exports.assertDatetimeString = assertDatetimeString;
    exports.ensureValidDatetime = assertDatetimeString;
    exports.asDatetimeString = asDatetimeString;
    exports.isDatetimeString = isDatetimeString;
    exports.isValidDatetime = isDatetimeString;
    exports.ifDatetimeString = ifDatetimeString;
    exports.currentDatetimeString = currentDatetimeString;
    exports.toDatetimeString = toDatetimeString;
    exports.normalizeDatetime = normalizeDatetime;
    exports.normalizeDatetimeAlways = normalizeDatetimeAlways;
    var InvalidDatetimeError = class extends Error {
    };
    exports.InvalidDatetimeError = InvalidDatetimeError;
    function assertAtprotoDate(date) {
      const res = parseDate(date);
      if (!res.success) {
        throw new InvalidDatetimeError(res.message);
      }
    }
    function asAtprotoDate(date) {
      assertAtprotoDate(date);
      return date;
    }
    function isAtprotoDate(date) {
      return parseDate(date).success;
    }
    function ifAtprotoDate(date) {
      return isAtprotoDate(date) ? date : void 0;
    }
    function assertDatetimeString(input) {
      const result = parseString(input);
      if (!result.success) {
        throw new InvalidDatetimeError(result.message);
      }
    }
    function asDatetimeString(input) {
      assertDatetimeString(input);
      return input;
    }
    function isDatetimeString(input) {
      return parseString(input).success;
    }
    function ifDatetimeString(input) {
      return isDatetimeString(input) ? input : void 0;
    }
    function currentDatetimeString() {
      return toDatetimeString(/* @__PURE__ */ new Date());
    }
    function toDatetimeString(date) {
      return asAtprotoDate(date).toISOString();
    }
    function normalizeDatetime(dtStr) {
      const date = new Date(dtStr);
      if (isAtprotoDate(date)) {
        return date.toISOString();
      }
      if (isNaN(date.getTime()) && !/.*(([+-]\d\d:?\d\d)|[a-zA-Z])$/.test(dtStr)) {
        const date2 = /* @__PURE__ */ new Date(`${dtStr}Z`);
        if (isAtprotoDate(date2)) {
          return date2.toISOString();
        }
      }
      throw new InvalidDatetimeError("datetime did not parse as any timestamp format");
    }
    function normalizeDatetimeAlways(dtStr) {
      try {
        return normalizeDatetime(dtStr);
      } catch (err) {
        return "1970-01-01T00:00:00.000Z";
      }
    }
    var failure = (m) => ({ success: false, message: m });
    var success = (v) => ({ success: true, value: v });
    var DATETIME_REGEX = /^(?<full_year>[0-9]{4})-(?<date_month>0[1-9]|1[012])-(?<date_mday>[0-2][0-9]|3[01])T(?<time_hour>[0-1][0-9]|2[0-3]):(?<time_minute>[0-5][0-9]):(?<time_second>[0-5][0-9]|60)(?<time_secfrac>\.[0-9]+)?(?<time_offset>Z|(?<time_numoffset>[+-](?:[0-1][0-9]|2[0-3]):[0-5][0-9]))$/;
    function parseString(input) {
      if (typeof input !== "string") {
        return failure("datetime must be a string");
      }
      if (input.length > 64) {
        return failure("datetime is too long (64 chars max)");
      }
      if (input.endsWith("-00:00")) {
        return failure('datetime can not use "-00:00" for UTC timezone');
      }
      if (!DATETIME_REGEX.test(input)) {
        return failure("datetime is not in a valid format (must match RFC 3339 & ISO 8601 with 'Z' or \xB1hh:mm timezone)");
      }
      const date = new Date(input);
      return parseDate(date);
    }
    function parseDate(date) {
      const fullYear = date.getUTCFullYear();
      if (Number.isNaN(fullYear)) {
        return failure("datetime did not parse as ISO 8601");
      }
      if (fullYear < 0) {
        return failure("datetime normalized to a negative time");
      }
      if (fullYear > 9999) {
        return failure("datetime year is too far in the future");
      }
      return success(date);
    }
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/language.js
var require_language = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/language.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.parseLanguageString = parseLanguageString;
    exports.isValidLanguage = isValidLanguage;
    var BCP47_REGEXP = /^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUseA>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUseB>x(-[A-Za-z0-9]{1,8})+))$/;
    function parseLanguageString(input) {
      const parsed = input.match(BCP47_REGEXP);
      if (!parsed?.groups)
        return null;
      const { groups } = parsed;
      return {
        grandfathered: groups.grandfathered,
        language: groups.language,
        extlang: groups.extlang,
        script: groups.script,
        region: groups.region,
        variant: groups.variant,
        extension: groups.extension,
        privateUse: groups.privateUseA || groups.privateUseB
      };
    }
    function isValidLanguage(input) {
      return BCP47_REGEXP.test(input);
    }
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/tid.js
var require_tid2 = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/tid.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidTidError = void 0;
    exports.ensureValidTid = ensureValidTid;
    exports.isValidTid = isValidTid;
    var TID_LENGTH = 13;
    var TID_REGEX = /^[234567abcdefghij][234567abcdefghijklmnopqrstuvwxyz]{12}$/;
    function ensureValidTid(input) {
      if (input.length !== TID_LENGTH) {
        throw new InvalidTidError(`TID must be ${TID_LENGTH} characters`);
      }
      if (!TID_REGEX.test(input)) {
        throw new InvalidTidError("TID syntax not valid (regex)");
      }
    }
    function isValidTid(input) {
      return input.length === TID_LENGTH && TID_REGEX.test(input);
    }
    var InvalidTidError = class extends Error {
    };
    exports.InvalidTidError = InvalidTidError;
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/uri.js
var require_uri = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/uri.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isValidUri = isValidUri;
    function isValidUri(input) {
      return /^\w+:(?:\/\/)?[^\s/][^\s]*$/.test(input);
    }
  }
});

// node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/index.js
var require_dist3 = __commonJS({
  "node_modules/@atproto/common-web/node_modules/@atproto/syntax/dist/index.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
    tslib_1.__exportStar(require_at_identifier(), exports);
    tslib_1.__exportStar(require_aturi(), exports);
    tslib_1.__exportStar(require_datetime(), exports);
    tslib_1.__exportStar(require_did(), exports);
    tslib_1.__exportStar(require_handle(), exports);
    tslib_1.__exportStar(require_nsid(), exports);
    tslib_1.__exportStar(require_language(), exports);
    tslib_1.__exportStar(require_recordkey(), exports);
    tslib_1.__exportStar(require_tid2(), exports);
    tslib_1.__exportStar(require_uri(), exports);
  }
});

// node_modules/@atproto/common-web/dist/strings.js
var require_strings = __commonJS({
  "node_modules/@atproto/common-web/dist/strings.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.b64UrlToUtf8 = exports.utf8ToB64Url = exports.validateLanguage = exports.parseLanguage = exports.utf8Len = exports.graphemeLen = void 0;
    var lex_data_1 = require_dist();
    var syntax_1 = require_dist3();
    var graphemeLenLegacy = lex_data_1.graphemeLen;
    exports.graphemeLen = graphemeLenLegacy;
    var utf8LenLegacy = lex_data_1.utf8Len;
    exports.utf8Len = utf8LenLegacy;
    var parseLanguageLegacy = syntax_1.parseLanguageString;
    exports.parseLanguage = parseLanguageLegacy;
    exports.validateLanguage = syntax_1.isValidLanguage;
    var utf8ToB64Url = (utf8) => {
      return (0, lex_data_1.toBase64)(new TextEncoder().encode(utf8), "base64url");
    };
    exports.utf8ToB64Url = utf8ToB64Url;
    var b64UrlToUtf8 = (b64) => {
      return new TextDecoder().decode((0, lex_data_1.fromBase64)(b64, "base64url"));
    };
    exports.b64UrlToUtf8 = b64UrlToUtf8;
  }
});

// node_modules/@atproto/common-web/dist/did-doc.js
var require_did_doc = __commonJS({
  "node_modules/@atproto/common-web/dist/did-doc.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.didDocument = exports.getServiceEndpoint = exports.getNotifEndpoint = exports.getFeedGenEndpoint = exports.getPdsEndpoint = exports.getSigningDidKey = exports.getVerificationMaterial = exports.getSigningKey = exports.getHandle = exports.getDid = exports.isValidDidDoc = void 0;
    var zod_1 = require_zod();
    var isValidDidDoc = (doc) => {
      return exports.didDocument.safeParse(doc).success;
    };
    exports.isValidDidDoc = isValidDidDoc;
    var getDid = (doc) => {
      const id = doc.id;
      if (typeof id !== "string") {
        throw new Error("No `id` on document");
      }
      return id;
    };
    exports.getDid = getDid;
    var getHandle = (doc) => {
      const aka = doc.alsoKnownAs;
      if (aka) {
        for (let i = 0; i < aka.length; i++) {
          const alias = aka[i];
          if (alias.startsWith("at://")) {
            return alias.slice(5);
          }
        }
      }
      return void 0;
    };
    exports.getHandle = getHandle;
    var getSigningKey = (doc) => {
      return (0, exports.getVerificationMaterial)(doc, "atproto");
    };
    exports.getSigningKey = getSigningKey;
    var getVerificationMaterial = (doc, keyId) => {
      const key = findItemById(doc, "verificationMethod", `#${keyId}`);
      if (!key) {
        return void 0;
      }
      if (!key.publicKeyMultibase) {
        return void 0;
      }
      return {
        type: key.type,
        publicKeyMultibase: key.publicKeyMultibase
      };
    };
    exports.getVerificationMaterial = getVerificationMaterial;
    var getSigningDidKey = (doc) => {
      const parsed = (0, exports.getSigningKey)(doc);
      if (!parsed)
        return;
      return `did:key:${parsed.publicKeyMultibase}`;
    };
    exports.getSigningDidKey = getSigningDidKey;
    var getPdsEndpoint = (doc) => {
      return (0, exports.getServiceEndpoint)(doc, {
        id: "#atproto_pds",
        type: "AtprotoPersonalDataServer"
      });
    };
    exports.getPdsEndpoint = getPdsEndpoint;
    var getFeedGenEndpoint = (doc) => {
      return (0, exports.getServiceEndpoint)(doc, {
        id: "#bsky_fg",
        type: "BskyFeedGenerator"
      });
    };
    exports.getFeedGenEndpoint = getFeedGenEndpoint;
    var getNotifEndpoint = (doc) => {
      return (0, exports.getServiceEndpoint)(doc, {
        id: "#bsky_notif",
        type: "BskyNotificationService"
      });
    };
    exports.getNotifEndpoint = getNotifEndpoint;
    var getServiceEndpoint = (doc, opts) => {
      const service2 = findItemById(doc, "service", opts.id);
      if (!service2) {
        return void 0;
      }
      if (opts.type && service2.type !== opts.type) {
        return void 0;
      }
      if (typeof service2.serviceEndpoint !== "string") {
        return void 0;
      }
      return validateUrl(service2.serviceEndpoint);
    };
    exports.getServiceEndpoint = getServiceEndpoint;
    function findItemById(doc, type, id) {
      const items = doc[type];
      if (items) {
        for (let i = 0; i < items.length; i++) {
          const item = items[i];
          const itemId = item.id;
          if (itemId[0] === "#" ? itemId === id : (
            // Optimized version of: itemId === `${doc.id}${id}`
            itemId.length === doc.id.length + id.length && itemId[doc.id.length] === "#" && itemId.endsWith(id) && itemId.startsWith(doc.id)
          )) {
            return item;
          }
        }
      }
      return void 0;
    }
    var validateUrl = (urlStr) => {
      if (!urlStr.startsWith("http://") && !urlStr.startsWith("https://")) {
        return void 0;
      }
      if (!canParseUrl(urlStr)) {
        return void 0;
      }
      return urlStr;
    };
    var canParseUrl = URL.canParse ?? // URL.canParse is not available in Node.js < 18.17.0
    ((urlStr) => {
      try {
        new URL(urlStr);
        return true;
      } catch {
        return false;
      }
    });
    var verificationMethod = zod_1.z.object({
      id: zod_1.z.string(),
      type: zod_1.z.string(),
      controller: zod_1.z.string(),
      publicKeyJwk: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
      publicKeyMultibase: zod_1.z.string().optional()
    });
    var service = zod_1.z.object({
      id: zod_1.z.string(),
      type: zod_1.z.string(),
      serviceEndpoint: zod_1.z.union([zod_1.z.string(), zod_1.z.record(zod_1.z.unknown())])
    });
    exports.didDocument = zod_1.z.object({
      "@context": zod_1.z.union([
        zod_1.z.literal("https://www.w3.org/ns/did/v1"),
        zod_1.z.array(zod_1.z.string().url())
      ]).optional(),
      id: zod_1.z.string(),
      alsoKnownAs: zod_1.z.array(zod_1.z.string()).optional(),
      verificationMethod: zod_1.z.array(verificationMethod).optional(),
      authentication: zod_1.z.array(zod_1.z.union([zod_1.z.string(), verificationMethod])).optional(),
      service: zod_1.z.array(service).optional()
    });
  }
});

// node_modules/@atproto/common-web/dist/index.js
var require_dist4 = __commonJS({
  "node_modules/@atproto/common-web/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __setModuleDefault2 = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    } : function(o, v) {
      o["default"] = v;
    });
    var __importStar2 = exports && exports.__importStar || /* @__PURE__ */ function() {
      var ownKeys2 = function(o) {
        ownKeys2 = 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 ownKeys2(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]);
        }
        __setModuleDefault2(result, mod);
        return result;
      };
    }();
    var __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.util = exports.check = void 0;
    exports.check = __importStar2(require_check());
    exports.util = __importStar2(require_util2());
    __exportStar2(require_arrays(), exports);
    __exportStar2(require_async(), exports);
    __exportStar2(require_util2(), exports);
    __exportStar2(require_tid(), exports);
    __exportStar2(require_ipld(), exports);
    __exportStar2(require_retry(), exports);
    __exportStar2(require_types2(), exports);
    __exportStar2(require_times(), exports);
    __exportStar2(require_strings(), exports);
    __exportStar2(require_did_doc(), exports);
  }
});

// node_modules/@atproto/syntax/dist/did.js
var require_did2 = __commonJS({
  "node_modules/@atproto/syntax/dist/did.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidDidError = void 0;
    exports.ensureValidDid = ensureValidDid;
    exports.ensureValidDidRegex = ensureValidDidRegex;
    exports.isValidDid = isValidDid;
    function ensureValidDid(input) {
      if (!input.startsWith("did:")) {
        throw new InvalidDidError('DID requires "did:" prefix');
      }
      if (input.length > 2048) {
        throw new InvalidDidError("DID is too long (2048 chars max)");
      }
      if (input.endsWith(":") || input.endsWith("%")) {
        throw new InvalidDidError('DID can not end with ":" or "%"');
      }
      if (!/^[a-zA-Z0-9._:%-]*$/.test(input)) {
        throw new InvalidDidError("Disallowed characters in DID (ASCII letters, digits, and a couple other characters only)");
      }
      const { length: length2, 1: method } = input.split(":");
      if (length2 < 3) {
        throw new InvalidDidError("DID requires prefix, method, and method-specific content");
      }
      if (!/^[a-z]+$/.test(method)) {
        throw new InvalidDidError("DID method must be lower-case letters");
      }
    }
    var DID_REGEX = /^did:[a-z]+:[a-zA-Z0-9._:%-]*[a-zA-Z0-9._-]$/;
    function ensureValidDidRegex(input) {
      if (!DID_REGEX.test(input)) {
        throw new InvalidDidError("DID didn't validate via regex");
      }
      if (input.length > 2048) {
        throw new InvalidDidError("DID is too long (2048 chars max)");
      }
    }
    function isValidDid(input) {
      return input.length <= 2048 && DID_REGEX.test(input);
    }
    var InvalidDidError = class extends Error {
    };
    exports.InvalidDidError = InvalidDidError;
  }
});

// node_modules/@atproto/syntax/dist/handle.js
var require_handle2 = __commonJS({
  "node_modules/@atproto/syntax/dist/handle.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DisallowedDomainError = exports.UnsupportedDomainError = exports.ReservedHandleError = exports.InvalidHandleError = exports.DISALLOWED_TLDS = exports.INVALID_HANDLE = void 0;
    exports.ensureValidHandle = ensureValidHandle;
    exports.ensureValidHandleRegex = ensureValidHandleRegex;
    exports.normalizeHandle = normalizeHandle;
    exports.normalizeAndEnsureValidHandle = normalizeAndEnsureValidHandle;
    exports.isValidHandle = isValidHandle;
    exports.isValidTld = isValidTld;
    exports.INVALID_HANDLE = "handle.invalid";
    exports.DISALLOWED_TLDS = [
      ".local",
      ".arpa",
      ".invalid",
      ".localhost",
      ".internal",
      ".example",
      ".alt",
      // policy could concievably change on ".onion" some day
      ".onion"
      // NOTE: .test is allowed in testing and devopment. In practical terms
      // "should" "never" actually resolve and get registered in production
    ];
    function ensureValidHandle(input) {
      if (!/^[a-zA-Z0-9.-]*$/.test(input)) {
        throw new InvalidHandleError("Disallowed characters in handle (ASCII letters, digits, dashes, periods only)");
      }
      if (input.length > 253) {
        throw new InvalidHandleError("Handle is too long (253 chars max)");
      }
      const labels = input.split(".");
      if (labels.length < 2) {
        throw new InvalidHandleError("Handle domain needs at least two parts");
      }
      for (let i = 0; i < labels.length; i++) {
        const l = labels[i];
        if (l.length < 1) {
          throw new InvalidHandleError("Handle parts can not be empty");
        }
        if (l.length > 63) {
          throw new InvalidHandleError("Handle part too long (max 63 chars)");
        }
        if (l.endsWith("-") || l.startsWith("-")) {
          throw new InvalidHandleError("Handle parts can not start or end with hyphens");
        }
        if (i + 1 === labels.length && !/^[a-zA-Z]/.test(l)) {
          throw new InvalidHandleError("Handle final component (TLD) must start with ASCII letter");
        }
      }
    }
    var HANDLE_REGEX = /^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/;
    function ensureValidHandleRegex(input) {
      if (input.length > 253) {
        throw new InvalidHandleError("Handle is too long (253 chars max)");
      }
      if (!HANDLE_REGEX.test(input)) {
        throw new InvalidHandleError("Handle didn't validate via regex");
      }
    }
    function normalizeHandle(handle) {
      return handle.toLowerCase();
    }
    function normalizeAndEnsureValidHandle(handle) {
      const normalized = normalizeHandle(handle);
      ensureValidHandle(normalized);
      return normalized;
    }
    function isValidHandle(input) {
      return input.length <= 253 && HANDLE_REGEX.test(input);
    }
    function isValidTld(handle) {
      for (const tld of exports.DISALLOWED_TLDS) {
        if (handle.endsWith(tld)) {
          return false;
        }
      }
      return true;
    }
    var InvalidHandleError = class extends Error {
    };
    exports.InvalidHandleError = InvalidHandleError;
    var ReservedHandleError = class extends Error {
    };
    exports.ReservedHandleError = ReservedHandleError;
    var UnsupportedDomainError = class extends Error {
    };
    exports.UnsupportedDomainError = UnsupportedDomainError;
    var DisallowedDomainError = class extends Error {
    };
    exports.DisallowedDomainError = DisallowedDomainError;
  }
});

// node_modules/@atproto/syntax/dist/at-identifier.js
var require_at_identifier2 = __commonJS({
  "node_modules/@atproto/syntax/dist/at-identifier.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ensureValidAtIdentifier = ensureValidAtIdentifier;
    exports.isValidAtIdentifier = isValidAtIdentifier;
    var did_js_1 = require_did2();
    var handle_js_1 = require_handle2();
    function ensureValidAtIdentifier(input) {
      try {
        if (input.startsWith("did:")) {
          (0, did_js_1.ensureValidDidRegex)(input);
        } else {
          (0, handle_js_1.ensureValidHandleRegex)(input);
        }
      } catch (cause) {
        throw new handle_js_1.InvalidHandleError("Invalid DID or handle", { cause });
      }
    }
    function isValidAtIdentifier(input) {
      if (input.startsWith("did:")) {
        return (0, did_js_1.isValidDid)(input);
      } else {
        return (0, handle_js_1.isValidHandle)(input);
      }
    }
  }
});

// node_modules/@atproto/syntax/dist/nsid.js
var require_nsid2 = __commonJS({
  "node_modules/@atproto/syntax/dist/nsid.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidNsidError = exports.NSID = void 0;
    exports.ensureValidNsid = ensureValidNsid;
    exports.parseNsid = parseNsid;
    exports.isValidNsid = isValidNsid;
    exports.validateNsid = validateNsid;
    exports.ensureValidNsidRegex = ensureValidNsidRegex;
    exports.validateNsidRegex = validateNsidRegex;
    var NSID = class _NSID {
      segments;
      static parse(input) {
        return new _NSID(input);
      }
      static create(authority, name2) {
        const input = [...authority.split(".").reverse(), name2].join(".");
        return new _NSID(input);
      }
      static isValid(nsid) {
        return isValidNsid(nsid);
      }
      static from(input) {
        if (input instanceof _NSID) {
          return input;
        }
        if (Array.isArray(input)) {
          return new _NSID(input.join("."));
        }
        return new _NSID(String(input));
      }
      constructor(nsid) {
        this.segments = parseNsid(nsid);
      }
      get authority() {
        return this.segments.slice(0, this.segments.length - 1).reverse().join(".");
      }
      get name() {
        return this.segments.at(this.segments.length - 1);
      }
      toString() {
        return this.segments.join(".");
      }
    };
    exports.NSID = NSID;
    function ensureValidNsid(input) {
      const result = validateNsid(input);
      if (!result.success)
        throw new InvalidNsidError(result.message);
    }
    function parseNsid(nsid) {
      const result = validateNsid(nsid);
      if (!result.success)
        throw new InvalidNsidError(result.message);
      return result.value;
    }
    function isValidNsid(input) {
      return validateNsidRegex(input).success;
    }
    function validateNsid(input) {
      if (input.length > 253 + 1 + 63) {
        return {
          success: false,
          message: "NSID is too long (317 chars max)"
        };
      }
      if (hasDisallowedCharacters(input)) {
        return {
          success: false,
          message: "Disallowed characters in NSID (ASCII letters, digits, dashes, periods only)"
        };
      }
      const segments = input.split(".");
      if (segments.length < 3) {
        return {
          success: false,
          message: "NSID needs at least three parts"
        };
      }
      for (const l of segments) {
        if (l.length < 1) {
          return {
            success: false,
            message: "NSID parts can not be empty"
          };
        }
        if (l.length > 63) {
          return {
            success: false,
            message: "NSID part too long (max 63 chars)"
          };
        }
        if (startsWithHyphen(l) || endsWithHyphen(l)) {
          return {
            success: false,
            message: "NSID parts can not start or end with hyphen"
          };
        }
      }
      if (startsWithNumber(segments[0])) {
        return {
          success: false,
          message: "NSID first part may not start with a digit"
        };
      }
      if (!isValidIdentifier(segments[segments.length - 1])) {
        return {
          success: false,
          message: "NSID name part must be only letters and digits (and no leading digit)"
        };
      }
      return {
        success: true,
        value: segments
      };
    }
    function hasDisallowedCharacters(v) {
      return !/^[a-zA-Z0-9.-]*$/.test(v);
    }
    function startsWithNumber(v) {
      const charCode = v.charCodeAt(0);
      return charCode >= 48 && charCode <= 57;
    }
    function startsWithHyphen(v) {
      return v.charCodeAt(0) === 45;
    }
    function endsWithHyphen(v) {
      return v.charCodeAt(v.length - 1) === 45;
    }
    function isValidIdentifier(v) {
      return !startsWithNumber(v) && !v.includes("-");
    }
    function ensureValidNsidRegex(nsid) {
      const result = validateNsidRegex(nsid);
      if (!result.success)
        throw new InvalidNsidError(result.message);
    }
    function validateNsidRegex(value) {
      if (value.length > 253 + 1 + 63) {
        return {
          success: false,
          message: "NSID is too long (317 chars max)"
        };
      }
      if (!/^[a-zA-Z](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?:\.[a-zA-Z](?:[a-zA-Z0-9]{0,62})?)$/.test(value)) {
        return {
          success: false,
          message: "NSID didn't validate via regex"
        };
      }
      return {
        success: true,
        value
      };
    }
    var InvalidNsidError = class extends Error {
    };
    exports.InvalidNsidError = InvalidNsidError;
  }
});

// node_modules/@atproto/syntax/dist/aturi_validation.js
var require_aturi_validation2 = __commonJS({
  "node_modules/@atproto/syntax/dist/aturi_validation.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ensureValidAtUri = ensureValidAtUri;
    exports.ensureValidAtUriRegex = ensureValidAtUriRegex;
    exports.isValidAtUri = isValidAtUri;
    var at_identifier_js_1 = require_at_identifier2();
    var did_js_1 = require_did2();
    var handle_js_1 = require_handle2();
    var nsid_js_1 = require_nsid2();
    function ensureValidAtUri(input) {
      const fragmentIndex = input.indexOf("#");
      if (fragmentIndex !== -1) {
        if (input.charCodeAt(fragmentIndex + 1) !== 47) {
          throw new Error("ATURI fragment must be non-empty and start with slash");
        }
        if (input.includes("#", fragmentIndex + 1)) {
          throw new Error('ATURI can have at most one "#", separating fragment out');
        }
        const fragment = input.slice(fragmentIndex + 1);
        if (!/^\/[a-zA-Z0-9._~:@!$&')(*+,;=%[\]/-]*$/.test(fragment)) {
          throw new Error("Disallowed characters in ATURI fragment (ASCII)");
        }
      }
      const uri = fragmentIndex === -1 ? input : input.slice(0, fragmentIndex);
      if (uri.length > 8 * 1024) {
        throw new Error("ATURI is far too long");
      }
      if (!uri.startsWith("at://")) {
        throw new Error('ATURI must start with "at://"');
      }
      if (!/^[a-zA-Z0-9._~:@!$&')(*+,;=%/-]*$/.test(uri)) {
        throw new Error("Disallowed characters in ATURI (ASCII)");
      }
      const authorityEnd = uri.indexOf("/", 5);
      const authority = authorityEnd === -1 ? uri.slice(5) : uri.slice(5, authorityEnd);
      try {
        (0, at_identifier_js_1.ensureValidAtIdentifier)(authority);
      } catch (cause) {
        throw new Error("ATURI authority must be a valid handle or DID", { cause });
      }
      const collectionStart = authorityEnd === -1 ? -1 : authorityEnd + 1;
      const collectionEnd = collectionStart === -1 ? -1 : uri.indexOf("/", collectionStart);
      if (collectionStart !== -1) {
        const collection = collectionEnd === -1 ? uri.slice(collectionStart) : uri.slice(collectionStart, collectionEnd);
        if (collection.length === 0) {
          throw new Error("ATURI can not have a slash after authority without a path segment");
        }
        if (!(0, nsid_js_1.isValidNsid)(collection)) {
          throw new Error("ATURI requires first path segment (if supplied) to be valid NSID");
        }
      }
      const recordKeyStart = collectionEnd === -1 ? -1 : collectionEnd + 1;
      const recordKeyEnd = recordKeyStart === -1 ? -1 : uri.indexOf("/", recordKeyStart);
      if (recordKeyStart !== -1) {
        if (recordKeyStart === uri.length) {
          throw new Error("ATURI can not have a slash after collection, unless record key is provided");
        }
      }
      if (recordKeyEnd !== -1) {
        throw new Error("ATURI path can have at most two parts, and no trailing slash");
      }
    }
    function ensureValidAtUriRegex(input) {
      const aturiRegex = /^at:\/\/(?<authority>[a-zA-Z0-9._:%-]+)(\/(?<collection>[a-zA-Z0-9-.]+)(\/(?<rkey>[a-zA-Z0-9._~:@!$&%')(*+,;=-]+))?)?(#(?<fragment>\/[a-zA-Z0-9._~:@!$&%')(*+,;=\-[\]/\\]*))?$/;
      const rm = input.match(aturiRegex);
      if (!rm || !rm.groups) {
        throw new Error("ATURI didn't validate via regex");
      }
      const groups = rm.groups;
      try {
        (0, handle_js_1.ensureValidHandleRegex)(groups.authority);
      } catch {
        try {
          (0, did_js_1.ensureValidDidRegex)(groups.authority);
        } catch {
          throw new Error("ATURI authority must be a valid handle or DID");
        }
      }
      if (groups.collection && !(0, nsid_js_1.isValidNsid)(groups.collection)) {
        throw new Error("ATURI collection path segment must be a valid NSID");
      }
      if (input.length > 8 * 1024) {
        throw new Error("ATURI is far too long");
      }
    }
    function isValidAtUri(input) {
      try {
        ensureValidAtUriRegex(input);
      } catch {
        return false;
      }
      return true;
    }
  }
});

// node_modules/@atproto/syntax/dist/aturi.js
var require_aturi2 = __commonJS({
  "node_modules/@atproto/syntax/dist/aturi.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AtUri = exports.ATP_URI_REGEX = void 0;
    var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
    var at_identifier_js_1 = require_at_identifier2();
    var nsid_js_1 = require_nsid2();
    tslib_1.__exportStar(require_aturi_validation2(), exports);
    exports.ATP_URI_REGEX = // proto-    --did--------------   --name----------------   --path----   --query--   --hash--
    /^(at:\/\/)?((?:did:[a-z0-9:%-]+)|(?:[a-z0-9][a-z0-9.:-]*))(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
    var RELATIVE_REGEX = /^(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
    var AtUri = class _AtUri {
      hash;
      host;
      pathname;
      searchParams;
      constructor(uri, base3) {
        const parsed = base3 !== void 0 ? typeof base3 === "string" ? Object.assign(parse2(base3), parseRelative(uri)) : Object.assign({ host: base3.host }, parseRelative(uri)) : parse2(uri);
        (0, at_identifier_js_1.ensureValidAtIdentifier)(parsed.host);
        this.hash = parsed.hash ?? "";
        this.host = parsed.host;
        this.pathname = parsed.pathname ?? "";
        this.searchParams = parsed.searchParams;
      }
      static make(handleOrDid, collection, rkey) {
        let str = handleOrDid;
        if (collection)
          str += "/" + collection;
        if (rkey)
          str += "/" + rkey;
        return new _AtUri(str);
      }
      get protocol() {
        return "at:";
      }
      get origin() {
        return `at://${this.host}`;
      }
      get hostname() {
        return this.host;
      }
      set hostname(v) {
        (0, at_identifier_js_1.ensureValidAtIdentifier)(v);
        this.host = v;
      }
      get search() {
        return this.searchParams.toString();
      }
      set search(v) {
        this.searchParams = new URLSearchParams(v);
      }
      get collection() {
        return this.pathname.split("/").filter(Boolean)[0] || "";
      }
      set collection(v) {
        (0, nsid_js_1.ensureValidNsid)(v);
        const parts = this.pathname.split("/").filter(Boolean);
        parts[0] = v;
        this.pathname = parts.join("/");
      }
      get rkey() {
        return this.pathname.split("/").filter(Boolean)[1] || "";
      }
      set rkey(v) {
        const parts = this.pathname.split("/").filter(Boolean);
        parts[0] ||= "undefined";
        parts[1] = v;
        this.pathname = parts.join("/");
      }
      get href() {
        return this.toString();
      }
      toString() {
        let path = this.pathname || "/";
        if (!path.startsWith("/")) {
          path = `/${path}`;
        }
        let qs = "";
        if (this.searchParams.size) {
          qs = `?${this.searchParams.toString()}`;
        }
        let hash = this.hash;
        if (hash && !hash.startsWith("#")) {
          hash = `#${hash}`;
        }
        return `at://${this.host}${path}${qs}${hash}`;
      }
    };
    exports.AtUri = AtUri;
    function parse2(str) {
      const match = str.match(exports.ATP_URI_REGEX);
      if (!match) {
        throw new Error(`Invalid AT uri: ${str}`);
      }
      return {
        host: match[2],
        hash: match[5],
        pathname: match[3],
        searchParams: new URLSearchParams(match[4])
      };
    }
    function parseRelative(str) {
      const match = str.match(RELATIVE_REGEX);
      if (!match) {
        throw new Error(`Invalid path: ${str}`);
      }
      return {
        hash: match[3],
        pathname: match[1],
        searchParams: new URLSearchParams(match[2])
      };
    }
  }
});

// node_modules/@atproto/syntax/dist/datetime.js
var require_datetime2 = __commonJS({
  "node_modules/@atproto/syntax/dist/datetime.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidDatetimeError = exports.normalizeDatetimeAlways = void 0;
    exports.ensureValidDatetime = ensureValidDatetime;
    exports.isValidDatetime = isValidDatetime;
    exports.normalizeDatetime = normalizeDatetime;
    function ensureValidDatetime(input) {
      const date = new Date(input);
      if (isNaN(date.getTime())) {
        throw new InvalidDatetimeError("datetime did not parse as ISO 8601");
      }
      if (date.toISOString().startsWith("-")) {
        throw new InvalidDatetimeError("datetime normalized to a negative time");
      }
      if (!/^[0-9]{4}-[01][0-9]-[0-3][0-9]T[0-2][0-9]:[0-6][0-9]:[0-6][0-9](.[0-9]{1,20})?(Z|([+-][0-2][0-9]:[0-5][0-9]))$/.test(input)) {
        throw new InvalidDatetimeError("datetime didn't validate via regex");
      }
      if (input.length > 64) {
        throw new InvalidDatetimeError("datetime is too long (64 chars max)");
      }
      if (input.endsWith("-00:00")) {
        throw new InvalidDatetimeError('datetime can not use "-00:00" for UTC timezone');
      }
      if (input.startsWith("000")) {
        throw new InvalidDatetimeError("datetime so close to year zero not allowed");
      }
    }
    function isValidDatetime(input) {
      try {
        ensureValidDatetime(input);
      } catch (err) {
        return false;
      }
      return true;
    }
    function normalizeDatetime(dtStr) {
      if (isValidDatetime(dtStr)) {
        const outStr = new Date(dtStr).toISOString();
        if (isValidDatetime(outStr)) {
          return outStr;
        }
      }
      if (!/.*(([+-]\d\d:?\d\d)|[a-zA-Z])$/.test(dtStr)) {
        const date2 = /* @__PURE__ */ new Date(dtStr + "Z");
        if (!isNaN(date2.getTime())) {
          const tzStr = date2.toISOString();
          if (isValidDatetime(tzStr)) {
            return tzStr;
          }
        }
      }
      const date = new Date(dtStr);
      if (isNaN(date.getTime())) {
        throw new InvalidDatetimeError("datetime did not parse as any timestamp format");
      }
      const isoStr = date.toISOString();
      if (isValidDatetime(isoStr)) {
        return isoStr;
      } else {
        throw new InvalidDatetimeError("datetime normalized to invalid timestamp string");
      }
    }
    var normalizeDatetimeAlways = (dtStr) => {
      try {
        return normalizeDatetime(dtStr);
      } catch (err) {
        if (err instanceof InvalidDatetimeError) {
          return (/* @__PURE__ */ new Date(0)).toISOString();
        }
        throw err;
      }
    };
    exports.normalizeDatetimeAlways = normalizeDatetimeAlways;
    var InvalidDatetimeError = class extends Error {
    };
    exports.InvalidDatetimeError = InvalidDatetimeError;
  }
});

// node_modules/@atproto/syntax/dist/language.js
var require_language2 = __commonJS({
  "node_modules/@atproto/syntax/dist/language.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.parseLanguageString = parseLanguageString;
    exports.isValidLanguage = isValidLanguage;
    var BCP47_REGEXP = /^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUseA>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUseB>x(-[A-Za-z0-9]{1,8})+))$/;
    function parseLanguageString(input) {
      const parsed = input.match(BCP47_REGEXP);
      if (!parsed?.groups)
        return null;
      const { groups } = parsed;
      return {
        grandfathered: groups.grandfathered,
        language: groups.language,
        extlang: groups.extlang,
        script: groups.script,
        region: groups.region,
        variant: groups.variant,
        extension: groups.extension,
        privateUse: groups.privateUseA || groups.privateUseB
      };
    }
    function isValidLanguage(input) {
      return BCP47_REGEXP.test(input);
    }
  }
});

// node_modules/@atproto/syntax/dist/recordkey.js
var require_recordkey2 = __commonJS({
  "node_modules/@atproto/syntax/dist/recordkey.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidRecordKeyError = void 0;
    exports.ensureValidRecordKey = ensureValidRecordKey;
    exports.isValidRecordKey = isValidRecordKey;
    var RECORD_KEY_MAX_LENGTH = 512;
    var RECORD_KEY_MIN_LENGTH = 1;
    var RECORD_KEY_INVALID_VALUES = /* @__PURE__ */ new Set([".", ".."]);
    var RECORD_KEY_REGEX = /^[a-zA-Z0-9_~.:-]{1,512}$/;
    function ensureValidRecordKey(input) {
      if (input.length > RECORD_KEY_MAX_LENGTH || input.length < RECORD_KEY_MIN_LENGTH) {
        throw new InvalidRecordKeyError(`record key must be ${RECORD_KEY_MIN_LENGTH} to ${RECORD_KEY_MAX_LENGTH} characters`);
      }
      if (RECORD_KEY_INVALID_VALUES.has(input)) {
        throw new InvalidRecordKeyError('record key can not be "." or ".."');
      }
      if (!RECORD_KEY_REGEX.test(input)) {
        throw new InvalidRecordKeyError("record key syntax not valid (regex)");
      }
    }
    function isValidRecordKey(input) {
      return input.length >= RECORD_KEY_MIN_LENGTH && input.length <= RECORD_KEY_MAX_LENGTH && RECORD_KEY_REGEX.test(input) && !RECORD_KEY_INVALID_VALUES.has(input);
    }
    var InvalidRecordKeyError = class extends Error {
    };
    exports.InvalidRecordKeyError = InvalidRecordKeyError;
  }
});

// node_modules/@atproto/syntax/dist/tid.js
var require_tid3 = __commonJS({
  "node_modules/@atproto/syntax/dist/tid.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidTidError = void 0;
    exports.ensureValidTid = ensureValidTid;
    exports.isValidTid = isValidTid;
    var TID_LENGTH = 13;
    var TID_REGEX = /^[234567abcdefghij][234567abcdefghijklmnopqrstuvwxyz]{12}$/;
    function ensureValidTid(input) {
      if (input.length !== TID_LENGTH) {
        throw new InvalidTidError(`TID must be ${TID_LENGTH} characters`);
      }
      if (!TID_REGEX.test(input)) {
        throw new InvalidTidError("TID syntax not valid (regex)");
      }
    }
    function isValidTid(input) {
      return input.length === TID_LENGTH && TID_REGEX.test(input);
    }
    var InvalidTidError = class extends Error {
    };
    exports.InvalidTidError = InvalidTidError;
  }
});

// node_modules/@atproto/syntax/dist/uri.js
var require_uri2 = __commonJS({
  "node_modules/@atproto/syntax/dist/uri.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isValidUri = isValidUri;
    function isValidUri(input) {
      return /^\w+:(?:\/\/)?[^\s/][^\s]*$/.test(input);
    }
  }
});

// node_modules/@atproto/syntax/dist/index.js
var require_dist5 = __commonJS({
  "node_modules/@atproto/syntax/dist/index.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
    tslib_1.__exportStar(require_at_identifier2(), exports);
    tslib_1.__exportStar(require_aturi2(), exports);
    tslib_1.__exportStar(require_datetime2(), exports);
    tslib_1.__exportStar(require_did2(), exports);
    tslib_1.__exportStar(require_handle2(), exports);
    tslib_1.__exportStar(require_nsid2(), exports);
    tslib_1.__exportStar(require_language2(), exports);
    tslib_1.__exportStar(require_recordkey2(), exports);
    tslib_1.__exportStar(require_tid3(), exports);
    tslib_1.__exportStar(require_uri2(), exports);
  }
});

// node_modules/@atproto/lexicon/dist/util.js
var require_util4 = __commonJS({
  "node_modules/@atproto/lexicon/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toLexUri = toLexUri;
    exports.requiredPropertiesRefinement = requiredPropertiesRefinement;
    var zod_1 = require_zod();
    function toLexUri(str, baseUri) {
      if (str.split("#").length > 2) {
        throw new Error("Uri can only have one hash segment");
      }
      if (str.startsWith("lex:")) {
        return str;
      }
      if (str.startsWith("#")) {
        if (!baseUri) {
          throw new Error(`Unable to resolve uri without anchor: ${str}`);
        }
        return `${baseUri}${str}`;
      }
      return `lex:${str}`;
    }
    function requiredPropertiesRefinement(object, ctx) {
      if (object.required === void 0) {
        return;
      }
      if (!Array.isArray(object.required)) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.invalid_type,
          received: typeof object.required,
          expected: "array"
        });
        return;
      }
      if (object.properties === void 0) {
        if (object.required.length > 0) {
          ctx.addIssue({
            code: zod_1.z.ZodIssueCode.custom,
            message: `Required fields defined but no properties defined`
          });
        }
        return;
      }
      for (const field of object.required) {
        if (object.properties[field] === void 0) {
          ctx.addIssue({
            code: zod_1.z.ZodIssueCode.custom,
            message: `Required field "${field}" not defined`
          });
        }
      }
    }
  }
});

// node_modules/@atproto/lexicon/dist/types.js
var require_types3 = __commonJS({
  "node_modules/@atproto/lexicon/dist/types.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.LexiconDefNotFoundError = exports.InvalidLexiconError = exports.ValidationError = exports.lexiconDoc = exports.lexUserType = exports.lexRecord = exports.lexXrpcSubscription = exports.lexXrpcProcedure = exports.lexXrpcQuery = exports.lexXrpcError = exports.lexXrpcSubscriptionMessage = exports.lexXrpcBody = exports.lexXrpcParameters = exports.lexPermissionSet = exports.lexObject = exports.lexToken = exports.lexPrimitiveArray = exports.lexArray = exports.lexBlob = exports.lexRefVariant = exports.lexRefUnion = exports.lexRef = exports.lexIpldType = exports.lexCidLink = exports.lexBytes = exports.lexPrimitive = exports.lexUnknown = exports.lexString = exports.lexStringFormat = exports.lexInteger = exports.lexBoolean = exports.lexLang = exports.languageSchema = void 0;
    exports.isValidLexiconDoc = isValidLexiconDoc;
    exports.isObj = isObj;
    exports.isDiscriminatedObject = isDiscriminatedObject;
    exports.parseLexiconDoc = parseLexiconDoc;
    var zod_1 = require_zod();
    var common_web_1 = require_dist4();
    var syntax_1 = require_dist5();
    var util_1 = require_util4();
    exports.languageSchema = zod_1.z.string().refine(common_web_1.validateLanguage, "Invalid BCP47 language tag");
    exports.lexLang = zod_1.z.record(exports.languageSchema, zod_1.z.string().optional());
    exports.lexBoolean = zod_1.z.object({
      type: zod_1.z.literal("boolean"),
      description: zod_1.z.string().optional(),
      default: zod_1.z.boolean().optional(),
      const: zod_1.z.boolean().optional()
    });
    exports.lexInteger = zod_1.z.object({
      type: zod_1.z.literal("integer"),
      description: zod_1.z.string().optional(),
      default: zod_1.z.number().int().optional(),
      minimum: zod_1.z.number().int().optional(),
      maximum: zod_1.z.number().int().optional(),
      enum: zod_1.z.number().int().array().optional(),
      const: zod_1.z.number().int().optional()
    });
    exports.lexStringFormat = zod_1.z.enum([
      "datetime",
      "uri",
      "at-uri",
      "did",
      "handle",
      "at-identifier",
      "nsid",
      "cid",
      "language",
      "tid",
      "record-key"
    ]);
    exports.lexString = zod_1.z.object({
      type: zod_1.z.literal("string"),
      format: exports.lexStringFormat.optional(),
      description: zod_1.z.string().optional(),
      default: zod_1.z.string().optional(),
      minLength: zod_1.z.number().int().optional(),
      maxLength: zod_1.z.number().int().optional(),
      minGraphemes: zod_1.z.number().int().optional(),
      maxGraphemes: zod_1.z.number().int().optional(),
      enum: zod_1.z.string().array().optional(),
      const: zod_1.z.string().optional(),
      knownValues: zod_1.z.string().array().optional()
    });
    exports.lexUnknown = zod_1.z.object({
      type: zod_1.z.literal("unknown"),
      description: zod_1.z.string().optional()
    });
    exports.lexPrimitive = zod_1.z.discriminatedUnion("type", [
      exports.lexBoolean,
      exports.lexInteger,
      exports.lexString,
      exports.lexUnknown
    ]);
    exports.lexBytes = zod_1.z.object({
      type: zod_1.z.literal("bytes"),
      description: zod_1.z.string().optional(),
      maxLength: zod_1.z.number().optional(),
      minLength: zod_1.z.number().optional()
    });
    exports.lexCidLink = zod_1.z.object({
      type: zod_1.z.literal("cid-link"),
      description: zod_1.z.string().optional()
    });
    exports.lexIpldType = zod_1.z.discriminatedUnion("type", [exports.lexBytes, exports.lexCidLink]);
    exports.lexRef = zod_1.z.object({
      type: zod_1.z.literal("ref"),
      description: zod_1.z.string().optional(),
      ref: zod_1.z.string()
    });
    exports.lexRefUnion = zod_1.z.object({
      type: zod_1.z.literal("union"),
      description: zod_1.z.string().optional(),
      refs: zod_1.z.string().array(),
      closed: zod_1.z.boolean().optional()
    });
    exports.lexRefVariant = zod_1.z.discriminatedUnion("type", [exports.lexRef, exports.lexRefUnion]);
    exports.lexBlob = zod_1.z.object({
      type: zod_1.z.literal("blob"),
      description: zod_1.z.string().optional(),
      accept: zod_1.z.string().array().optional(),
      maxSize: zod_1.z.number().optional()
    });
    exports.lexArray = zod_1.z.object({
      type: zod_1.z.literal("array"),
      description: zod_1.z.string().optional(),
      items: zod_1.z.discriminatedUnion("type", [
        // lexPrimitive
        exports.lexBoolean,
        exports.lexInteger,
        exports.lexString,
        exports.lexUnknown,
        // lexIpldType
        exports.lexBytes,
        exports.lexCidLink,
        // lexRefVariant
        exports.lexRef,
        exports.lexRefUnion,
        // other
        exports.lexBlob
      ]),
      minLength: zod_1.z.number().int().optional(),
      maxLength: zod_1.z.number().int().optional()
    });
    exports.lexPrimitiveArray = exports.lexArray.merge(zod_1.z.object({
      items: exports.lexPrimitive
    }));
    exports.lexToken = zod_1.z.object({
      type: zod_1.z.literal("token"),
      description: zod_1.z.string().optional()
    });
    exports.lexObject = zod_1.z.object({
      type: zod_1.z.literal("object"),
      description: zod_1.z.string().optional(),
      required: zod_1.z.string().array().optional(),
      nullable: zod_1.z.string().array().optional(),
      properties: zod_1.z.record(zod_1.z.string(), zod_1.z.discriminatedUnion("type", [
        exports.lexArray,
        // lexPrimitive
        exports.lexBoolean,
        exports.lexInteger,
        exports.lexString,
        exports.lexUnknown,
        // lexIpldType
        exports.lexBytes,
        exports.lexCidLink,
        // lexRefVariant
        exports.lexRef,
        exports.lexRefUnion,
        // other
        exports.lexBlob
      ]))
    }).superRefine(util_1.requiredPropertiesRefinement);
    var lexPermission = zod_1.z.intersection(zod_1.z.object({
      type: zod_1.z.literal("permission"),
      resource: zod_1.z.string().nonempty()
    }), zod_1.z.record(zod_1.z.string(), zod_1.z.union([
      zod_1.z.array(zod_1.z.union([zod_1.z.string(), zod_1.z.number().int(), zod_1.z.boolean()])),
      zod_1.z.boolean(),
      zod_1.z.number().int(),
      zod_1.z.string()
    ]).optional()));
    exports.lexPermissionSet = zod_1.z.object({
      type: zod_1.z.literal("permission-set"),
      description: zod_1.z.string().optional(),
      title: zod_1.z.string().optional(),
      "title:lang": exports.lexLang.optional(),
      detail: zod_1.z.string().optional(),
      "detail:lang": exports.lexLang.optional(),
      permissions: zod_1.z.array(lexPermission)
    });
    exports.lexXrpcParameters = zod_1.z.object({
      type: zod_1.z.literal("params"),
      description: zod_1.z.string().optional(),
      required: zod_1.z.string().array().optional(),
      properties: zod_1.z.record(zod_1.z.string(), zod_1.z.discriminatedUnion("type", [
        exports.lexPrimitiveArray,
        // lexPrimitive
        exports.lexBoolean,
        exports.lexInteger,
        exports.lexString,
        exports.lexUnknown
      ]))
    }).superRefine(util_1.requiredPropertiesRefinement);
    exports.lexXrpcBody = zod_1.z.object({
      description: zod_1.z.string().optional(),
      encoding: zod_1.z.string(),
      // @NOTE using discriminatedUnion with a refined schema requires zod >= 4
      schema: zod_1.z.union([exports.lexRefVariant, exports.lexObject]).optional()
    });
    exports.lexXrpcSubscriptionMessage = zod_1.z.object({
      description: zod_1.z.string().optional(),
      // @NOTE using discriminatedUnion with a refined schema requires zod >= 4
      schema: zod_1.z.union([exports.lexRefVariant, exports.lexObject]).optional()
    });
    exports.lexXrpcError = zod_1.z.object({
      name: zod_1.z.string(),
      description: zod_1.z.string().optional()
    });
    exports.lexXrpcQuery = zod_1.z.object({
      type: zod_1.z.literal("query"),
      description: zod_1.z.string().optional(),
      parameters: exports.lexXrpcParameters.optional(),
      output: exports.lexXrpcBody.optional(),
      errors: exports.lexXrpcError.array().optional()
    });
    exports.lexXrpcProcedure = zod_1.z.object({
      type: zod_1.z.literal("procedure"),
      description: zod_1.z.string().optional(),
      parameters: exports.lexXrpcParameters.optional(),
      input: exports.lexXrpcBody.optional(),
      output: exports.lexXrpcBody.optional(),
      errors: exports.lexXrpcError.array().optional()
    });
    exports.lexXrpcSubscription = zod_1.z.object({
      type: zod_1.z.literal("subscription"),
      description: zod_1.z.string().optional(),
      parameters: exports.lexXrpcParameters.optional(),
      message: exports.lexXrpcSubscriptionMessage.optional(),
      errors: exports.lexXrpcError.array().optional()
    });
    exports.lexRecord = zod_1.z.object({
      type: zod_1.z.literal("record"),
      description: zod_1.z.string().optional(),
      key: zod_1.z.string().optional(),
      record: exports.lexObject
    });
    exports.lexUserType = zod_1.z.custom((val) => {
      if (!val || typeof val !== "object") {
        return;
      }
      if (val["type"] === void 0) {
        return;
      }
      switch (val["type"]) {
        case "record":
          return exports.lexRecord.parse(val);
        case "permission-set":
          return exports.lexPermissionSet.parse(val);
        case "query":
          return exports.lexXrpcQuery.parse(val);
        case "procedure":
          return exports.lexXrpcProcedure.parse(val);
        case "subscription":
          return exports.lexXrpcSubscription.parse(val);
        case "blob":
          return exports.lexBlob.parse(val);
        case "array":
          return exports.lexArray.parse(val);
        case "token":
          return exports.lexToken.parse(val);
        case "object":
          return exports.lexObject.parse(val);
        case "boolean":
          return exports.lexBoolean.parse(val);
        case "integer":
          return exports.lexInteger.parse(val);
        case "string":
          return exports.lexString.parse(val);
        case "bytes":
          return exports.lexBytes.parse(val);
        case "cid-link":
          return exports.lexCidLink.parse(val);
        case "unknown":
          return exports.lexUnknown.parse(val);
      }
    }, (val) => {
      if (!val || typeof val !== "object") {
        return {
          message: "Must be an object",
          fatal: true
        };
      }
      if (val["type"] === void 0) {
        return {
          message: "Must have a type",
          fatal: true
        };
      }
      if (typeof val["type"] !== "string") {
        return {
          message: "Type property must be a string",
          fatal: true
        };
      }
      return {
        message: `Invalid type: ${val["type"]} must be one of: record, query, procedure, subscription, blob, array, token, object, boolean, integer, string, bytes, cid-link, unknown`,
        fatal: true
      };
    });
    exports.lexiconDoc = zod_1.z.object({
      lexicon: zod_1.z.literal(1),
      id: zod_1.z.string().refine(syntax_1.isValidNsid, {
        message: "Must be a valid NSID"
      }),
      revision: zod_1.z.number().optional(),
      description: zod_1.z.string().optional(),
      defs: zod_1.z.record(zod_1.z.string(), exports.lexUserType)
    }).refine((doc) => {
      for (const [defId, def] of Object.entries(doc.defs)) {
        if (defId !== "main" && (def.type === "record" || def.type === "permission-set" || def.type === "procedure" || def.type === "query" || def.type === "subscription")) {
          return false;
        }
      }
      return true;
    }, {
      message: `Records, permission sets, procedures, queries, and subscriptions must be the main definition.`
    });
    function isValidLexiconDoc(v) {
      return exports.lexiconDoc.safeParse(v).success;
    }
    function isObj(v) {
      return v != null && typeof v === "object";
    }
    function isDiscriminatedObject(v) {
      return isObj(v) && "$type" in v && typeof v.$type === "string";
    }
    function parseLexiconDoc(v) {
      exports.lexiconDoc.parse(v);
      return v;
    }
    var ValidationError = class extends Error {
    };
    exports.ValidationError = ValidationError;
    var InvalidLexiconError = class extends Error {
    };
    exports.InvalidLexiconError = InvalidLexiconError;
    var LexiconDefNotFoundError = class extends Error {
    };
    exports.LexiconDefNotFoundError = LexiconDefNotFoundError;
  }
});

// node_modules/@atproto/lexicon/dist/blob-refs.js
var require_blob_refs = __commonJS({
  "node_modules/@atproto/lexicon/dist/blob-refs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BlobRef = exports.jsonBlobRef = exports.untypedJsonBlobRef = exports.typedJsonBlobRef = void 0;
    var cid_1 = (init_cid(), __toCommonJS(cid_exports));
    var zod_1 = require_zod();
    var common_web_1 = require_dist4();
    exports.typedJsonBlobRef = zod_1.z.object({
      $type: zod_1.z.literal("blob"),
      ref: common_web_1.schema.cid,
      mimeType: zod_1.z.string(),
      size: zod_1.z.number()
    }).strict();
    exports.untypedJsonBlobRef = zod_1.z.object({
      cid: zod_1.z.string(),
      mimeType: zod_1.z.string()
    }).strict();
    exports.jsonBlobRef = zod_1.z.union([exports.typedJsonBlobRef, exports.untypedJsonBlobRef]);
    var BlobRef = class _BlobRef {
      constructor(ref, mimeType, size, original) {
        Object.defineProperty(this, "ref", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: ref
        });
        Object.defineProperty(this, "mimeType", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: mimeType
        });
        Object.defineProperty(this, "size", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: size
        });
        Object.defineProperty(this, "original", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.original = original ?? {
          $type: "blob",
          ref,
          mimeType,
          size
        };
      }
      static asBlobRef(obj) {
        if (common_web_1.check.is(obj, exports.jsonBlobRef)) {
          return _BlobRef.fromJsonRef(obj);
        }
        return null;
      }
      static fromJsonRef(json) {
        if (common_web_1.check.is(json, exports.typedJsonBlobRef)) {
          return new _BlobRef(json.ref, json.mimeType, json.size);
        } else {
          return new _BlobRef(cid_1.CID.parse(json.cid), json.mimeType, -1, json);
        }
      }
      ipld() {
        return this.original;
      }
      toJSON() {
        return (0, common_web_1.ipldToJson)(this.ipld());
      }
    };
    exports.BlobRef = BlobRef;
  }
});

// node_modules/@atproto/lexicon/dist/validators/blob.js
var require_blob3 = __commonJS({
  "node_modules/@atproto/lexicon/dist/validators/blob.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.blob = blob;
    var blob_refs_1 = require_blob_refs();
    var types_1 = require_types3();
    function blob(lexicons, path, def, value) {
      if (!value || !(value instanceof blob_refs_1.BlobRef)) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} should be a blob ref`)
        };
      }
      return { success: true, value };
    }
  }
});

// node_modules/iso-datestring-validator/dist/index.js
var require_dist6 = __commonJS({
  "node_modules/iso-datestring-validator/dist/index.js"(exports) {
    (() => {
      "use strict";
      var e = { d: (t2, r2) => {
        for (var n2 in r2) e.o(r2, n2) && !e.o(t2, n2) && Object.defineProperty(t2, n2, { enumerable: true, get: r2[n2] });
      }, o: (e2, t2) => Object.prototype.hasOwnProperty.call(e2, t2), r: (e2) => {
        "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e2, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(e2, "__esModule", { value: true });
      } }, t = {};
      function r(e2, t2) {
        return void 0 === t2 && (t2 = "-"), new RegExp("^(?!0{4}" + t2 + "0{2}" + t2 + "0{2})((?=[0-9]{4}" + t2 + "(((0[^2])|1[0-2])|02(?=" + t2 + "(([0-1][0-9])|2[0-8])))" + t2 + "[0-9]{2})|(?=((([13579][26])|([2468][048])|(0[48]))0{2})|([0-9]{2}((((0|[2468])[48])|[2468][048])|([13579][26])))" + t2 + "02" + t2 + "29))([0-9]{4})" + t2 + "(?!((0[469])|11)" + t2 + "31)((0[1,3-9]|1[0-2])|(02(?!" + t2 + "3)))" + t2 + "(0[1-9]|[1-2][0-9]|3[0-1])$").test(e2);
      }
      function n(e2) {
        var t2 = /\D/.exec(e2);
        return t2 ? t2[0] : "";
      }
      function i(e2, t2, r2) {
        void 0 === t2 && (t2 = ":"), void 0 === r2 && (r2 = false);
        var i2 = new RegExp("^([0-1]|2(?=([0-3])|4" + t2 + "00))[0-9]" + t2 + "[0-5][0-9](" + t2 + "([0-5]|6(?=0))[0-9])?(.[0-9]{1,9})?$");
        if (!r2 || !/[Z+\-]/.test(e2)) return i2.test(e2);
        if (/Z$/.test(e2)) return i2.test(e2.replace("Z", ""));
        var o2 = e2.includes("+"), a2 = e2.split(/[+-]/), u2 = a2[0], d2 = a2[1];
        return i2.test(u2) && function(e3, t3, r3) {
          return void 0 === r3 && (r3 = ":"), new RegExp(t3 ? "^(0(?!(2" + r3 + "4)|0" + r3 + "3)|1(?=([0-1]|2(?=" + r3 + "[04])|[34](?=" + r3 + "0))))([03469](?=" + r3 + "[03])|[17](?=" + r3 + "0)|2(?=" + r3 + "[04])|5(?=" + r3 + "[034])|8(?=" + r3 + "[04]))" + r3 + "([03](?=0)|4(?=5))[05]$" : "^(0(?=[^0])|1(?=[0-2]))([39](?=" + r3 + "[03])|[0-24-8](?=" + r3 + "00))" + r3 + "[03]0$").test(e3);
        }(d2, o2, n(d2));
      }
      function o(e2) {
        var t2 = e2.split("T"), o2 = t2[0], a2 = t2[1], u2 = r(o2, n(o2));
        if (!a2) return false;
        var d2, s = (d2 = a2.match(/([^Z+\-\d])(?=\d+\1)/), Array.isArray(d2) ? d2[0] : "");
        return u2 && i(a2, s, true);
      }
      function a(e2, t2) {
        return void 0 === t2 && (t2 = "-"), new RegExp("^[0-9]{4}" + t2 + "(0(?=[^0])|1(?=[0-2]))[0-9]$").test(e2);
      }
      e.r(t), e.d(t, { isValidDate: () => r, isValidISODateString: () => o, isValidTime: () => i, isValidYearMonth: () => a });
      var u = exports;
      for (var d in t) u[d] = t[d];
      t.__esModule && Object.defineProperty(u, "__esModule", { value: true });
    })();
  }
});

// node_modules/@atproto/lexicon/dist/validators/formats.js
var require_formats = __commonJS({
  "node_modules/@atproto/lexicon/dist/validators/formats.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.datetime = datetime;
    exports.uri = uri;
    exports.atUri = atUri;
    exports.did = did;
    exports.handle = handle;
    exports.atIdentifier = atIdentifier;
    exports.nsid = nsid;
    exports.cid = cid;
    exports.language = language;
    exports.tid = tid;
    exports.recordKey = recordKey;
    var iso_datestring_validator_1 = require_dist6();
    var cid_1 = (init_cid(), __toCommonJS(cid_exports));
    var common_web_1 = require_dist4();
    var syntax_1 = require_dist5();
    var types_1 = require_types3();
    function datetime(path, value) {
      try {
        if (!(0, iso_datestring_validator_1.isValidISODateString)(value)) {
          throw new Error();
        }
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an valid atproto datetime (both RFC-3339 and ISO-8601)`)
        };
      }
      return { success: true, value };
    }
    function uri(path, value) {
      const isUri = value.match(/^\w+:(?:\/\/)?[^\s/][^\s]*$/) !== null;
      if (!isUri) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a uri`)
        };
      }
      return { success: true, value };
    }
    function atUri(path, value) {
      try {
        (0, syntax_1.ensureValidAtUri)(value);
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a valid at-uri`)
        };
      }
      return { success: true, value };
    }
    function did(path, value) {
      try {
        (0, syntax_1.ensureValidDid)(value);
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a valid did`)
        };
      }
      return { success: true, value };
    }
    function handle(path, value) {
      try {
        (0, syntax_1.ensureValidHandle)(value);
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a valid handle`)
        };
      }
      return { success: true, value };
    }
    function atIdentifier(path, value) {
      if (value.startsWith("did:")) {
        const didResult = did(path, value);
        if (didResult.success)
          return didResult;
      } else {
        const handleResult = handle(path, value);
        if (handleResult.success)
          return handleResult;
      }
      return {
        success: false,
        error: new types_1.ValidationError(`${path} must be a valid did or a handle`)
      };
    }
    function nsid(path, value) {
      if ((0, syntax_1.isValidNsid)(value)) {
        return {
          success: true,
          value
        };
      } else {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a valid nsid`)
        };
      }
    }
    function cid(path, value) {
      try {
        cid_1.CID.parse(value);
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a cid string`)
        };
      }
      return { success: true, value };
    }
    function language(path, value) {
      if ((0, common_web_1.validateLanguage)(value)) {
        return { success: true, value };
      }
      return {
        success: false,
        error: new types_1.ValidationError(`${path} must be a well-formed BCP 47 language tag`)
      };
    }
    function tid(path, value) {
      if ((0, syntax_1.isValidTid)(value)) {
        return { success: true, value };
      }
      return {
        success: false,
        error: new types_1.ValidationError(`${path} must be a valid TID`)
      };
    }
    function recordKey(path, value) {
      try {
        (0, syntax_1.ensureValidRecordKey)(value);
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a valid Record Key`)
        };
      }
      return { success: true, value };
    }
  }
});

// node_modules/@atproto/lexicon/dist/validators/primitives.js
var require_primitives = __commonJS({
  "node_modules/@atproto/lexicon/dist/validators/primitives.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __setModuleDefault2 = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    } : function(o, v) {
      o["default"] = v;
    });
    var __importStar2 = exports && exports.__importStar || /* @__PURE__ */ function() {
      var ownKeys2 = function(o) {
        ownKeys2 = 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 ownKeys2(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]);
        }
        __setModuleDefault2(result, mod);
        return result;
      };
    }();
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.validate = validate;
    var cid_1 = (init_cid(), __toCommonJS(cid_exports));
    var common_web_1 = require_dist4();
    var types_1 = require_types3();
    var formats = __importStar2(require_formats());
    function validate(lexicons, path, def, value) {
      switch (def.type) {
        case "boolean":
          return boolean(lexicons, path, def, value);
        case "integer":
          return integer(lexicons, path, def, value);
        case "string":
          return string2(lexicons, path, def, value);
        case "bytes":
          return bytes(lexicons, path, def, value);
        case "cid-link":
          return cidLink(lexicons, path, def, value);
        case "unknown":
          return unknown(lexicons, path, def, value);
        default:
          return {
            success: false,
            error: new types_1.ValidationError(`Unexpected lexicon type: ${def.type}`)
          };
      }
    }
    function boolean(lexicons, path, def, value) {
      def = def;
      const type = typeof value;
      if (type === "undefined") {
        if (typeof def.default === "boolean") {
          return { success: true, value: def.default };
        }
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a boolean`)
        };
      } else if (type !== "boolean") {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a boolean`)
        };
      }
      if (typeof def.const === "boolean") {
        if (value !== def.const) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be ${def.const}`)
          };
        }
      }
      return { success: true, value };
    }
    function integer(lexicons, path, def, value) {
      def = def;
      const type = typeof value;
      if (type === "undefined") {
        if (typeof def.default === "number") {
          return { success: true, value: def.default };
        }
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an integer`)
        };
      } else if (!Number.isInteger(value)) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an integer`)
        };
      }
      if (typeof def.const === "number") {
        if (value !== def.const) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be ${def.const}`)
          };
        }
      }
      if (Array.isArray(def.enum)) {
        if (!def.enum.includes(value)) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be one of (${def.enum.join("|")})`)
          };
        }
      }
      if (typeof def.maximum === "number") {
        if (value > def.maximum) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} can not be greater than ${def.maximum}`)
          };
        }
      }
      if (typeof def.minimum === "number") {
        if (value < def.minimum) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} can not be less than ${def.minimum}`)
          };
        }
      }
      return { success: true, value };
    }
    function string2(lexicons, path, def, value) {
      def = def;
      if (typeof value === "undefined") {
        if (typeof def.default === "string") {
          return { success: true, value: def.default };
        }
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a string`)
        };
      } else if (typeof value !== "string") {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a string`)
        };
      }
      if (typeof def.const === "string") {
        if (value !== def.const) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be ${def.const}`)
          };
        }
      }
      if (Array.isArray(def.enum)) {
        if (!def.enum.includes(value)) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be one of (${def.enum.join("|")})`)
          };
        }
      }
      if (typeof def.minLength === "number" || typeof def.maxLength === "number") {
        if (typeof def.minLength === "number" && value.length * 3 < def.minLength) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must not be shorter than ${def.minLength} characters`)
          };
        }
        let canSkipUtf8LenChecks = false;
        if (typeof def.minLength === "undefined" && typeof def.maxLength === "number" && value.length * 3 <= def.maxLength) {
          canSkipUtf8LenChecks = true;
        }
        if (!canSkipUtf8LenChecks) {
          const len = (0, common_web_1.utf8Len)(value);
          if (typeof def.maxLength === "number") {
            if (len > def.maxLength) {
              return {
                success: false,
                error: new types_1.ValidationError(`${path} must not be longer than ${def.maxLength} characters`)
              };
            }
          }
          if (typeof def.minLength === "number") {
            if (len < def.minLength) {
              return {
                success: false,
                error: new types_1.ValidationError(`${path} must not be shorter than ${def.minLength} characters`)
              };
            }
          }
        }
      }
      if (typeof def.maxGraphemes === "number" || typeof def.minGraphemes === "number") {
        let needsMaxGraphemesCheck = false;
        let needsMinGraphemesCheck = false;
        if (typeof def.maxGraphemes === "number") {
          if (value.length <= def.maxGraphemes) {
            needsMaxGraphemesCheck = false;
          } else {
            needsMaxGraphemesCheck = true;
          }
        }
        if (typeof def.minGraphemes === "number") {
          if (value.length < def.minGraphemes) {
            return {
              success: false,
              error: new types_1.ValidationError(`${path} must not be shorter than ${def.minGraphemes} graphemes`)
            };
          } else {
            needsMinGraphemesCheck = true;
          }
        }
        if (needsMaxGraphemesCheck || needsMinGraphemesCheck) {
          const len = (0, common_web_1.graphemeLen)(value);
          if (typeof def.maxGraphemes === "number") {
            if (len > def.maxGraphemes) {
              return {
                success: false,
                error: new types_1.ValidationError(`${path} must not be longer than ${def.maxGraphemes} graphemes`)
              };
            }
          }
          if (typeof def.minGraphemes === "number") {
            if (len < def.minGraphemes) {
              return {
                success: false,
                error: new types_1.ValidationError(`${path} must not be shorter than ${def.minGraphemes} graphemes`)
              };
            }
          }
        }
      }
      if (typeof def.format === "string") {
        switch (def.format) {
          case "datetime":
            return formats.datetime(path, value);
          case "uri":
            return formats.uri(path, value);
          case "at-uri":
            return formats.atUri(path, value);
          case "did":
            return formats.did(path, value);
          case "handle":
            return formats.handle(path, value);
          case "at-identifier":
            return formats.atIdentifier(path, value);
          case "nsid":
            return formats.nsid(path, value);
          case "cid":
            return formats.cid(path, value);
          case "language":
            return formats.language(path, value);
          case "tid":
            return formats.tid(path, value);
          case "record-key":
            return formats.recordKey(path, value);
        }
      }
      return { success: true, value };
    }
    function bytes(lexicons, path, def, value) {
      def = def;
      if (!value || !(value instanceof Uint8Array)) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a byte array`)
        };
      }
      if (typeof def.maxLength === "number") {
        if (value.byteLength > def.maxLength) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must not be larger than ${def.maxLength} bytes`)
          };
        }
      }
      if (typeof def.minLength === "number") {
        if (value.byteLength < def.minLength) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must not be smaller than ${def.minLength} bytes`)
          };
        }
      }
      return { success: true, value };
    }
    function cidLink(lexicons, path, def, value) {
      if (cid_1.CID.asCID(value) === null) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a CID`)
        };
      }
      return { success: true, value };
    }
    function unknown(lexicons, path, def, value) {
      if (!value || typeof value !== "object") {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an object`)
        };
      }
      return { success: true, value };
    }
  }
});

// node_modules/@atproto/lexicon/dist/validators/complex.js
var require_complex = __commonJS({
  "node_modules/@atproto/lexicon/dist/validators/complex.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.validate = validate;
    exports.array = array;
    exports.object = object;
    exports.validateOneOf = validateOneOf;
    var types_1 = require_types3();
    var util_1 = require_util4();
    var blob_1 = require_blob3();
    var primitives_1 = require_primitives();
    function validate(lexicons, path, def, value) {
      switch (def.type) {
        case "object":
          return object(lexicons, path, def, value);
        case "array":
          return array(lexicons, path, def, value);
        case "blob":
          return (0, blob_1.blob)(lexicons, path, def, value);
        default:
          return (0, primitives_1.validate)(lexicons, path, def, value);
      }
    }
    function array(lexicons, path, def, value) {
      if (!Array.isArray(value)) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an array`)
        };
      }
      if (typeof def.maxLength === "number") {
        if (value.length > def.maxLength) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must not have more than ${def.maxLength} elements`)
          };
        }
      }
      if (typeof def.minLength === "number") {
        if (value.length < def.minLength) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must not have fewer than ${def.minLength} elements`)
          };
        }
      }
      const itemsDef = def.items;
      for (let i = 0; i < value.length; i++) {
        const itemValue = value[i];
        const itemPath = `${path}/${i}`;
        const res = validateOneOf(lexicons, itemPath, itemsDef, itemValue);
        if (!res.success) {
          return res;
        }
      }
      return { success: true, value };
    }
    function object(lexicons, path, def, value) {
      if (!(0, types_1.isObj)(value)) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an object`)
        };
      }
      let resultValue = value;
      if ("properties" in def && def.properties != null) {
        for (const key in def.properties) {
          const keyValue = value[key];
          if (keyValue === null && def.nullable?.includes(key)) {
            continue;
          }
          const propDef = def.properties[key];
          if (keyValue === void 0 && !def.required?.includes(key)) {
            if (propDef.type === "integer" || propDef.type === "boolean" || propDef.type === "string") {
              if (propDef.default === void 0) {
                continue;
              }
            } else {
              continue;
            }
          }
          const propPath = `${path}/${key}`;
          const validated = validateOneOf(lexicons, propPath, propDef, keyValue);
          const propValue = validated.success ? validated.value : keyValue;
          if (propValue === void 0) {
            if (def.required?.includes(key)) {
              return {
                success: false,
                error: new types_1.ValidationError(`${path} must have the property "${key}"`)
              };
            }
          } else {
            if (!validated.success) {
              return validated;
            }
          }
          if (propValue !== keyValue) {
            if (resultValue === value) {
              resultValue = { ...value };
            }
            resultValue[key] = propValue;
          }
        }
      }
      return { success: true, value: resultValue };
    }
    function validateOneOf(lexicons, path, def, value, mustBeObj = false) {
      let concreteDef;
      if (def.type === "union") {
        if (!(0, types_1.isDiscriminatedObject)(value)) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be an object which includes the "$type" property`)
          };
        }
        if (!refsContainType(def.refs, value.$type)) {
          if (def.closed) {
            return {
              success: false,
              error: new types_1.ValidationError(`${path} $type must be one of ${def.refs.join(", ")}`)
            };
          }
          return { success: true, value };
        } else {
          concreteDef = lexicons.getDefOrThrow(value.$type);
        }
      } else if (def.type === "ref") {
        concreteDef = lexicons.getDefOrThrow(def.ref);
      } else {
        concreteDef = def;
      }
      return mustBeObj ? object(lexicons, path, concreteDef, value) : validate(lexicons, path, concreteDef, value);
    }
    var refsContainType = (refs, type) => {
      const lexUri = (0, util_1.toLexUri)(type);
      if (refs.includes(lexUri)) {
        return true;
      }
      if (lexUri.endsWith("#main")) {
        return refs.includes(lexUri.slice(0, -5));
      } else {
        return !lexUri.includes("#") && refs.includes(`${lexUri}#main`);
      }
    };
  }
});

// node_modules/@atproto/lexicon/dist/validators/xrpc.js
var require_xrpc = __commonJS({
  "node_modules/@atproto/lexicon/dist/validators/xrpc.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __setModuleDefault2 = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    } : function(o, v) {
      o["default"] = v;
    });
    var __importStar2 = exports && exports.__importStar || /* @__PURE__ */ function() {
      var ownKeys2 = function(o) {
        ownKeys2 = 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 ownKeys2(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]);
        }
        __setModuleDefault2(result, mod);
        return result;
      };
    }();
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.params = params;
    var types_1 = require_types3();
    var complex_1 = require_complex();
    var PrimitiveValidators = __importStar2(require_primitives());
    function params(lexicons, path, def, val) {
      const value = val && typeof val === "object" ? val : {};
      const requiredProps = new Set(def.required ?? []);
      let resultValue = value;
      if (typeof def.properties === "object") {
        for (const key in def.properties) {
          const propDef = def.properties[key];
          const validated = propDef.type === "array" ? (0, complex_1.array)(lexicons, key, propDef, value[key]) : PrimitiveValidators.validate(lexicons, key, propDef, value[key]);
          const propValue = validated.success ? validated.value : value[key];
          const propIsUndefined = typeof propValue === "undefined";
          if (propIsUndefined && requiredProps.has(key)) {
            return {
              success: false,
              error: new types_1.ValidationError(`${path} must have the property "${key}"`)
            };
          } else if (!propIsUndefined && !validated.success) {
            return validated;
          }
          if (propValue !== value[key]) {
            if (resultValue === value) {
              resultValue = { ...value };
            }
            resultValue[key] = propValue;
          }
        }
      }
      return { success: true, value: resultValue };
    }
  }
});

// node_modules/@atproto/lexicon/dist/validation.js
var require_validation = __commonJS({
  "node_modules/@atproto/lexicon/dist/validation.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.assertValidRecord = assertValidRecord;
    exports.assertValidXrpcParams = assertValidXrpcParams;
    exports.assertValidXrpcInput = assertValidXrpcInput;
    exports.assertValidXrpcOutput = assertValidXrpcOutput;
    exports.assertValidXrpcMessage = assertValidXrpcMessage;
    var complex_1 = require_complex();
    var xrpc_1 = require_xrpc();
    function assertValidRecord(lexicons, def, value) {
      const res = (0, complex_1.object)(lexicons, "Record", def.record, value);
      if (!res.success)
        throw res.error;
      return res.value;
    }
    function assertValidXrpcParams(lexicons, def, value) {
      if (def.parameters) {
        const res = (0, xrpc_1.params)(lexicons, "Params", def.parameters, value);
        if (!res.success)
          throw res.error;
        return res.value;
      }
    }
    function assertValidXrpcInput(lexicons, def, value) {
      if (def.input?.schema) {
        return assertValidOneOf(lexicons, "Input", def.input.schema, value, true);
      }
    }
    function assertValidXrpcOutput(lexicons, def, value) {
      if (def.output?.schema) {
        return assertValidOneOf(lexicons, "Output", def.output.schema, value, true);
      }
    }
    function assertValidXrpcMessage(lexicons, def, value) {
      if (def.message?.schema) {
        return assertValidOneOf(lexicons, "Message", def.message.schema, value, true);
      }
    }
    function assertValidOneOf(lexicons, path, def, value, mustBeObj = false) {
      const res = (0, complex_1.validateOneOf)(lexicons, path, def, value, mustBeObj);
      if (!res.success)
        throw res.error;
      return res.value;
    }
  }
});

// node_modules/@atproto/lexicon/dist/lexicons.js
var require_lexicons = __commonJS({
  "node_modules/@atproto/lexicon/dist/lexicons.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Lexicons = void 0;
    var types_1 = require_types3();
    var util_1 = require_util4();
    var validation_1 = require_validation();
    var complex_1 = require_complex();
    var Lexicons = class {
      constructor(docs) {
        Object.defineProperty(this, "docs", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map()
        });
        Object.defineProperty(this, "defs", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map()
        });
        if (docs) {
          for (const doc of docs) {
            this.add(doc);
          }
        }
      }
      /**
       * @example clone a lexicon:
       * ```ts
       * const clone = new Lexicons(originalLexicon)
       * ```
       *
       * @example get docs array:
       * ```ts
       * const docs = Array.from(lexicons)
       * ```
       */
      [Symbol.iterator]() {
        return this.docs.values();
      }
      /**
       * Add a lexicon doc.
       */
      add(doc) {
        const uri = (0, util_1.toLexUri)(doc.id);
        if (this.docs.has(uri)) {
          throw new Error(`${uri} has already been registered`);
        }
        resolveRefUris(doc, uri);
        this.docs.set(uri, doc);
        for (const [defUri, def] of iterDefs(doc)) {
          this.defs.set(defUri, def);
        }
      }
      /**
       * Remove a lexicon doc.
       */
      remove(uri) {
        uri = (0, util_1.toLexUri)(uri);
        const doc = this.docs.get(uri);
        if (!doc) {
          throw new Error(`Unable to remove "${uri}": does not exist`);
        }
        for (const [defUri, _def] of iterDefs(doc)) {
          this.defs.delete(defUri);
        }
        this.docs.delete(uri);
      }
      /**
       * Get a lexicon doc.
       */
      get(uri) {
        uri = (0, util_1.toLexUri)(uri);
        return this.docs.get(uri);
      }
      /**
       * Get a definition.
       */
      getDef(uri) {
        uri = (0, util_1.toLexUri)(uri);
        return this.defs.get(uri);
      }
      getDefOrThrow(uri, types2) {
        const def = this.getDef(uri);
        if (!def) {
          throw new types_1.LexiconDefNotFoundError(`Lexicon not found: ${uri}`);
        }
        if (types2 && !types2.includes(def.type)) {
          throw new types_1.InvalidLexiconError(`Not a ${types2.join(" or ")} lexicon: ${uri}`);
        }
        return def;
      }
      /**
       * Validate a record or object.
       */
      validate(lexUri, value) {
        if (!(0, types_1.isObj)(value)) {
          throw new types_1.ValidationError(`Value must be an object`);
        }
        const lexUriNormalized = (0, util_1.toLexUri)(lexUri);
        const def = this.getDefOrThrow(lexUriNormalized, ["record", "object"]);
        if (def.type === "record") {
          return (0, complex_1.object)(this, "Record", def.record, value);
        } else if (def.type === "object") {
          return (0, complex_1.object)(this, "Object", def, value);
        } else {
          throw new types_1.InvalidLexiconError("Definition must be a record or object");
        }
      }
      /**
       * Validate a record and throw on any error.
       */
      assertValidRecord(lexUri, value) {
        if (!(0, types_1.isObj)(value)) {
          throw new types_1.ValidationError(`Record must be an object`);
        }
        if (!("$type" in value)) {
          throw new types_1.ValidationError(`Record/$type must be a string`);
        }
        const { $type } = value;
        if (typeof $type !== "string") {
          throw new types_1.ValidationError(`Record/$type must be a string`);
        }
        const lexUriNormalized = (0, util_1.toLexUri)(lexUri);
        if ((0, util_1.toLexUri)($type) !== lexUriNormalized) {
          throw new types_1.ValidationError(`Invalid $type: must be ${lexUriNormalized}, got ${$type}`);
        }
        const def = this.getDefOrThrow(lexUriNormalized, ["record"]);
        return (0, validation_1.assertValidRecord)(this, def, value);
      }
      /**
       * Validate xrpc query params and throw on any error.
       */
      assertValidXrpcParams(lexUri, value) {
        lexUri = (0, util_1.toLexUri)(lexUri);
        const def = this.getDefOrThrow(lexUri, [
          "query",
          "procedure",
          "subscription"
        ]);
        return (0, validation_1.assertValidXrpcParams)(this, def, value);
      }
      /**
       * Validate xrpc input body and throw on any error.
       */
      assertValidXrpcInput(lexUri, value) {
        lexUri = (0, util_1.toLexUri)(lexUri);
        const def = this.getDefOrThrow(lexUri, ["procedure"]);
        return (0, validation_1.assertValidXrpcInput)(this, def, value);
      }
      /**
       * Validate xrpc output body and throw on any error.
       */
      assertValidXrpcOutput(lexUri, value) {
        lexUri = (0, util_1.toLexUri)(lexUri);
        const def = this.getDefOrThrow(lexUri, ["query", "procedure"]);
        return (0, validation_1.assertValidXrpcOutput)(this, def, value);
      }
      /**
       * Validate xrpc subscription message and throw on any error.
       */
      assertValidXrpcMessage(lexUri, value) {
        lexUri = (0, util_1.toLexUri)(lexUri);
        const def = this.getDefOrThrow(lexUri, ["subscription"]);
        return (0, validation_1.assertValidXrpcMessage)(this, def, value);
      }
      /**
       * Resolve a lex uri given a ref
       */
      resolveLexUri(lexUri, ref) {
        lexUri = (0, util_1.toLexUri)(lexUri);
        return (0, util_1.toLexUri)(ref, lexUri);
      }
    };
    exports.Lexicons = Lexicons;
    function* iterDefs(doc) {
      for (const defId in doc.defs) {
        yield [`lex:${doc.id}#${defId}`, doc.defs[defId]];
        if (defId === "main") {
          yield [`lex:${doc.id}`, doc.defs[defId]];
        }
      }
    }
    function resolveRefUris(obj, baseUri) {
      for (const k in obj) {
        if (obj.type === "ref") {
          obj.ref = (0, util_1.toLexUri)(obj.ref, baseUri);
        } else if (obj.type === "union") {
          obj.refs = obj.refs.map((ref) => (0, util_1.toLexUri)(ref, baseUri));
        } else if (Array.isArray(obj[k])) {
          obj[k] = obj[k].map((item) => {
            if (typeof item === "string") {
              return item.startsWith("#") ? (0, util_1.toLexUri)(item, baseUri) : item;
            } else if (item && typeof item === "object") {
              return resolveRefUris(item, baseUri);
            }
            return item;
          });
        } else if (obj[k] && typeof obj[k] === "object") {
          obj[k] = resolveRefUris(obj[k], baseUri);
        }
      }
      return obj;
    }
  }
});

// node_modules/@atproto/lexicon/dist/serialize.js
var require_serialize = __commonJS({
  "node_modules/@atproto/lexicon/dist/serialize.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.jsonStringToLex = exports.jsonToLex = exports.stringifyLex = exports.lexToJson = exports.ipldToLex = exports.lexToIpld = void 0;
    var cid_1 = (init_cid(), __toCommonJS(cid_exports));
    var common_web_1 = require_dist4();
    var blob_refs_1 = require_blob_refs();
    var lexToIpld = (val) => {
      if (Array.isArray(val)) {
        return val.map((item) => (0, exports.lexToIpld)(item));
      }
      if (val && typeof val === "object") {
        if (val instanceof blob_refs_1.BlobRef) {
          return val.original;
        }
        if (cid_1.CID.asCID(val) || val instanceof Uint8Array) {
          return val;
        }
        const toReturn = {};
        for (const key of Object.keys(val)) {
          toReturn[key] = (0, exports.lexToIpld)(val[key]);
        }
        return toReturn;
      }
      return val;
    };
    exports.lexToIpld = lexToIpld;
    var ipldToLex = (val) => {
      if (Array.isArray(val)) {
        return val.map((item) => (0, exports.ipldToLex)(item));
      }
      if (val && typeof val === "object") {
        if ((val["$type"] === "blob" || typeof val["cid"] === "string" && typeof val["mimeType"] === "string") && common_web_1.check.is(val, blob_refs_1.jsonBlobRef)) {
          return blob_refs_1.BlobRef.fromJsonRef(val);
        }
        if (cid_1.CID.asCID(val) || val instanceof Uint8Array) {
          return val;
        }
        const toReturn = {};
        for (const key of Object.keys(val)) {
          toReturn[key] = (0, exports.ipldToLex)(val[key]);
        }
        return toReturn;
      }
      return val;
    };
    exports.ipldToLex = ipldToLex;
    var lexToJson = (val) => {
      return (0, common_web_1.ipldToJson)((0, exports.lexToIpld)(val));
    };
    exports.lexToJson = lexToJson;
    var stringifyLex = (val) => {
      return JSON.stringify((0, exports.lexToJson)(val));
    };
    exports.stringifyLex = stringifyLex;
    var jsonToLex = (val) => {
      return (0, exports.ipldToLex)((0, common_web_1.jsonToIpld)(val));
    };
    exports.jsonToLex = jsonToLex;
    var jsonStringToLex = (val) => {
      return (0, exports.jsonToLex)(JSON.parse(val));
    };
    exports.jsonStringToLex = jsonStringToLex;
  }
});

// node_modules/@atproto/lexicon/dist/index.js
var require_dist7 = __commonJS({
  "node_modules/@atproto/lexicon/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_types3(), exports);
    __exportStar2(require_lexicons(), exports);
    __exportStar2(require_blob_refs(), exports);
    __exportStar2(require_serialize(), exports);
  }
});

// node_modules/@atproto/api/dist/client/util.js
var require_util5 = __commonJS({
  "node_modules/@atproto/api/dist/client/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.is$typed = is$typed;
    exports.maybe$typed = maybe$typed;
    exports.asPredicate = asPredicate;
    function isObject2(v) {
      return v != null && typeof v === "object";
    }
    function is$type($type, id, hash) {
      return hash === "main" ? $type === id : (
        // $type === `${id}#${hash}`
        typeof $type === "string" && $type.length === id.length + 1 + hash.length && $type.charCodeAt(id.length) === 35 && $type.startsWith(id) && $type.endsWith(hash)
      );
    }
    function is$typed(v, id, hash) {
      return isObject2(v) && "$type" in v && is$type(v.$type, id, hash);
    }
    function maybe$typed(v, id, hash) {
      return isObject2(v) && ("$type" in v ? v.$type === void 0 || is$type(v.$type, id, hash) : true);
    }
    function asPredicate(validate) {
      return function(v) {
        return validate(v).success;
      };
    }
  }
});

// node_modules/@atproto/api/dist/client/lexicons.js
var require_lexicons2 = __commonJS({
  "node_modules/@atproto/api/dist/client/lexicons.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ids = exports.lexicons = exports.schemas = exports.schemaDict = void 0;
    exports.validate = validate;
    var lexicon_1 = require_dist7();
    var util_js_1 = require_util5();
    exports.schemaDict = {
      AppBskyActorDefs: {
        lexicon: 1,
        id: "app.bsky.actor.defs",
        defs: {
          profileViewBasic: {
            type: "object",
            required: ["did", "handle"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              handle: {
                type: "string",
                format: "handle"
              },
              displayName: {
                type: "string",
                maxGraphemes: 64,
                maxLength: 640
              },
              avatar: {
                type: "string",
                format: "uri"
              },
              associated: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileAssociated"
              },
              viewer: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#viewerState"
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              verification: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#verificationState"
              },
              status: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#statusView"
              }
            }
          },
          profileView: {
            type: "object",
            required: ["did", "handle"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              handle: {
                type: "string",
                format: "handle"
              },
              displayName: {
                type: "string",
                maxGraphemes: 64,
                maxLength: 640
              },
              description: {
                type: "string",
                maxGraphemes: 256,
                maxLength: 2560
              },
              avatar: {
                type: "string",
                format: "uri"
              },
              associated: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileAssociated"
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              viewer: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#viewerState"
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              verification: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#verificationState"
              },
              status: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#statusView"
              }
            }
          },
          profileViewDetailed: {
            type: "object",
            required: ["did", "handle"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              handle: {
                type: "string",
                format: "handle"
              },
              displayName: {
                type: "string",
                maxGraphemes: 64,
                maxLength: 640
              },
              description: {
                type: "string",
                maxGraphemes: 256,
                maxLength: 2560
              },
              avatar: {
                type: "string",
                format: "uri"
              },
              banner: {
                type: "string",
                format: "uri"
              },
              followersCount: {
                type: "integer"
              },
              followsCount: {
                type: "integer"
              },
              postsCount: {
                type: "integer"
              },
              associated: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileAssociated"
              },
              joinedViaStarterPack: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#starterPackViewBasic"
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              viewer: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#viewerState"
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              pinnedPost: {
                type: "ref",
                ref: "lex:com.atproto.repo.strongRef"
              },
              verification: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#verificationState"
              },
              status: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#statusView"
              }
            }
          },
          profileAssociated: {
            type: "object",
            properties: {
              lists: {
                type: "integer"
              },
              feedgens: {
                type: "integer"
              },
              starterPacks: {
                type: "integer"
              },
              labeler: {
                type: "boolean"
              },
              chat: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileAssociatedChat"
              },
              activitySubscription: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileAssociatedActivitySubscription"
              }
            }
          },
          profileAssociatedChat: {
            type: "object",
            required: ["allowIncoming"],
            properties: {
              allowIncoming: {
                type: "string",
                knownValues: ["all", "none", "following"]
              }
            }
          },
          profileAssociatedActivitySubscription: {
            type: "object",
            required: ["allowSubscriptions"],
            properties: {
              allowSubscriptions: {
                type: "string",
                knownValues: ["followers", "mutuals", "none"]
              }
            }
          },
          viewerState: {
            type: "object",
            description: "Metadata about the requesting account's relationship with the subject account. Only has meaningful content for authed requests.",
            properties: {
              muted: {
                type: "boolean"
              },
              mutedByList: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#listViewBasic"
              },
              blockedBy: {
                type: "boolean"
              },
              blocking: {
                type: "string",
                format: "at-uri"
              },
              blockingByList: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#listViewBasic"
              },
              following: {
                type: "string",
                format: "at-uri"
              },
              followedBy: {
                type: "string",
                format: "at-uri"
              },
              knownFollowers: {
                description: "This property is present only in selected cases, as an optimization.",
                type: "ref",
                ref: "lex:app.bsky.actor.defs#knownFollowers"
              },
              activitySubscription: {
                description: "This property is present only in selected cases, as an optimization.",
                type: "ref",
                ref: "lex:app.bsky.notification.defs#activitySubscription"
              }
            }
          },
          knownFollowers: {
            type: "object",
            description: "The subject's followers whom you also follow",
            required: ["count", "followers"],
            properties: {
              count: {
                type: "integer"
              },
              followers: {
                type: "array",
                minLength: 0,
                maxLength: 5,
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.actor.defs#profileViewBasic"
                }
              }
            }
          },
          verificationState: {
            type: "object",
            description: "Represents the verification information about the user this object is attached to.",
            required: ["verifications", "verifiedStatus", "trustedVerifierStatus"],
            properties: {
              verifications: {
                type: "array",
                description: "All verifications issued by trusted verifiers on behalf of this user. Verifications by untrusted verifiers are not included.",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.actor.defs#verificationView"
                }
              },
              verifiedStatus: {
                type: "string",
                description: "The user's status as a verified account.",
                knownValues: ["valid", "invalid", "none"]
              },
              trustedVerifierStatus: {
                type: "string",
                description: "The user's status as a trusted verifier.",
                knownValues: ["valid", "invalid", "none"]
              }
            }
          },
          verificationView: {
            type: "object",
            description: "An individual verification for an associated subject.",
            required: ["issuer", "uri", "isValid", "createdAt"],
            properties: {
              issuer: {
                type: "string",
                description: "The user who issued this verification.",
                format: "did"
              },
              uri: {
                type: "string",
                description: "The AT-URI of the verification record.",
                format: "at-uri"
              },
              isValid: {
                type: "boolean",
                description: "True if the verification passes validation, otherwise false."
              },
              createdAt: {
                type: "string",
                description: "Timestamp when the verification was created.",
                format: "datetime"
              }
            }
          },
          preferences: {
            type: "array",
            items: {
              type: "union",
              refs: [
                "lex:app.bsky.actor.defs#adultContentPref",
                "lex:app.bsky.actor.defs#contentLabelPref",
                "lex:app.bsky.actor.defs#savedFeedsPref",
                "lex:app.bsky.actor.defs#savedFeedsPrefV2",
                "lex:app.bsky.actor.defs#personalDetailsPref",
                "lex:app.bsky.actor.defs#feedViewPref",
                "lex:app.bsky.actor.defs#threadViewPref",
                "lex:app.bsky.actor.defs#interestsPref",
                "lex:app.bsky.actor.defs#mutedWordsPref",
                "lex:app.bsky.actor.defs#hiddenPostsPref",
                "lex:app.bsky.actor.defs#bskyAppStatePref",
                "lex:app.bsky.actor.defs#labelersPref",
                "lex:app.bsky.actor.defs#postInteractionSettingsPref",
                "lex:app.bsky.actor.defs#verificationPrefs"
              ]
            }
          },
          adultContentPref: {
            type: "object",
            required: ["enabled"],
            properties: {
              enabled: {
                type: "boolean",
                default: false
              }
            }
          },
          contentLabelPref: {
            type: "object",
            required: ["label", "visibility"],
            properties: {
              labelerDid: {
                type: "string",
                description: "Which labeler does this preference apply to? If undefined, applies globally.",
                format: "did"
              },
              label: {
                type: "string"
              },
              visibility: {
                type: "string",
                knownValues: ["ignore", "show", "warn", "hide"]
              }
            }
          },
          savedFeed: {
            type: "object",
            required: ["id", "type", "value", "pinned"],
            properties: {
              id: {
                type: "string"
              },
              type: {
                type: "string",
                knownValues: ["feed", "list", "timeline"]
              },
              value: {
                type: "string"
              },
              pinned: {
                type: "boolean"
              }
            }
          },
          savedFeedsPrefV2: {
            type: "object",
            required: ["items"],
            properties: {
              items: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.actor.defs#savedFeed"
                }
              }
            }
          },
          savedFeedsPref: {
            type: "object",
            required: ["pinned", "saved"],
            properties: {
              pinned: {
                type: "array",
                items: {
                  type: "string",
                  format: "at-uri"
                }
              },
              saved: {
                type: "array",
                items: {
                  type: "string",
                  format: "at-uri"
                }
              },
              timelineIndex: {
                type: "integer"
              }
            }
          },
          personalDetailsPref: {
            type: "object",
            properties: {
              birthDate: {
                type: "string",
                format: "datetime",
                description: "The birth date of account owner."
              }
            }
          },
          feedViewPref: {
            type: "object",
            required: ["feed"],
            properties: {
              feed: {
                type: "string",
                description: "The URI of the feed, or an identifier which describes the feed."
              },
              hideReplies: {
                type: "boolean",
                description: "Hide replies in the feed."
              },
              hideRepliesByUnfollowed: {
                type: "boolean",
                description: "Hide replies in the feed if they are not by followed users.",
                default: true
              },
              hideRepliesByLikeCount: {
                type: "integer",
                description: "Hide replies in the feed if they do not have this number of likes."
              },
              hideReposts: {
                type: "boolean",
                description: "Hide reposts in the feed."
              },
              hideQuotePosts: {
                type: "boolean",
                description: "Hide quote posts in the feed."
              }
            }
          },
          threadViewPref: {
            type: "object",
            properties: {
              sort: {
                type: "string",
                description: "Sorting mode for threads.",
                knownValues: [
                  "oldest",
                  "newest",
                  "most-likes",
                  "random",
                  "hotness"
                ]
              },
              prioritizeFollowedUsers: {
                type: "boolean",
                description: "Show followed users at the top of all replies."
              }
            }
          },
          interestsPref: {
            type: "object",
            required: ["tags"],
            properties: {
              tags: {
                type: "array",
                maxLength: 100,
                items: {
                  type: "string",
                  maxLength: 640,
                  maxGraphemes: 64
                },
                description: "A list of tags which describe the account owner's interests gathered during onboarding."
              }
            }
          },
          mutedWordTarget: {
            type: "string",
            knownValues: ["content", "tag"],
            maxLength: 640,
            maxGraphemes: 64
          },
          mutedWord: {
            type: "object",
            description: "A word that the account owner has muted.",
            required: ["value", "targets"],
            properties: {
              id: {
                type: "string"
              },
              value: {
                type: "string",
                description: "The muted word itself.",
                maxLength: 1e4,
                maxGraphemes: 1e3
              },
              targets: {
                type: "array",
                description: "The intended targets of the muted word.",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.actor.defs#mutedWordTarget"
                }
              },
              actorTarget: {
                type: "string",
                description: "Groups of users to apply the muted word to. If undefined, applies to all users.",
                knownValues: ["all", "exclude-following"],
                default: "all"
              },
              expiresAt: {
                type: "string",
                format: "datetime",
                description: "The date and time at which the muted word will expire and no longer be applied."
              }
            }
          },
          mutedWordsPref: {
            type: "object",
            required: ["items"],
            properties: {
              items: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.actor.defs#mutedWord"
                },
                description: "A list of words the account owner has muted."
              }
            }
          },
          hiddenPostsPref: {
            type: "object",
            required: ["items"],
            properties: {
              items: {
                type: "array",
                items: {
                  type: "string",
                  format: "at-uri"
                },
                description: "A list of URIs of posts the account owner has hidden."
              }
            }
          },
          labelersPref: {
            type: "object",
            required: ["labelers"],
            properties: {
              labelers: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.actor.defs#labelerPrefItem"
                }
              }
            }
          },
          labelerPrefItem: {
            type: "object",
            required: ["did"],
            properties: {
              did: {
                type: "string",
                format: "did"
              }
            }
          },
          bskyAppStatePref: {
            description: "A grab bag of state that's specific to the bsky.app program. Third-party apps shouldn't use this.",
            type: "object",
            properties: {
              activeProgressGuide: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#bskyAppProgressGuide"
              },
              queuedNudges: {
                description: "An array of tokens which identify nudges (modals, popups, tours, highlight dots) that should be shown to the user.",
                type: "array",
                maxLength: 1e3,
                items: {
                  type: "string",
                  maxLength: 100
                }
              },
              nuxs: {
                description: "Storage for NUXs the user has encountered.",
                type: "array",
                maxLength: 100,
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.actor.defs#nux"
                }
              }
            }
          },
          bskyAppProgressGuide: {
            description: "If set, an active progress guide. Once completed, can be set to undefined. Should have unspecced fields tracking progress.",
            type: "object",
            required: ["guide"],
            properties: {
              guide: {
                type: "string",
                maxLength: 100
              }
            }
          },
          nux: {
            type: "object",
            description: "A new user experiences (NUX) storage object",
            required: ["id", "completed"],
            properties: {
              id: {
                type: "string",
                maxLength: 100
              },
              completed: {
                type: "boolean",
                default: false
              },
              data: {
                description: "Arbitrary data for the NUX. The structure is defined by the NUX itself. Limited to 300 characters.",
                type: "string",
                maxLength: 3e3,
                maxGraphemes: 300
              },
              expiresAt: {
                type: "string",
                format: "datetime",
                description: "The date and time at which the NUX will expire and should be considered completed."
              }
            }
          },
          verificationPrefs: {
            type: "object",
            description: "Preferences for how verified accounts appear in the app.",
            required: [],
            properties: {
              hideBadges: {
                description: "Hide the blue check badges for verified accounts and trusted verifiers.",
                type: "boolean",
                default: false
              }
            }
          },
          postInteractionSettingsPref: {
            type: "object",
            description: "Default post interaction settings for the account. These values should be applied as default values when creating new posts. These refs should mirror the threadgate and postgate records exactly.",
            required: [],
            properties: {
              threadgateAllowRules: {
                description: "Matches threadgate record. List of rules defining who can reply to this users posts. If value is an empty array, no one can reply. If value is undefined, anyone can reply.",
                type: "array",
                maxLength: 5,
                items: {
                  type: "union",
                  refs: [
                    "lex:app.bsky.feed.threadgate#mentionRule",
                    "lex:app.bsky.feed.threadgate#followerRule",
                    "lex:app.bsky.feed.threadgate#followingRule",
                    "lex:app.bsky.feed.threadgate#listRule"
                  ]
                }
              },
              postgateEmbeddingRules: {
                description: "Matches postgate record. List of rules defining who can embed this users posts. If value is an empty array or is undefined, no particular rules apply and anyone can embed.",
                type: "array",
                maxLength: 5,
                items: {
                  type: "union",
                  refs: ["lex:app.bsky.feed.postgate#disableRule"]
                }
              }
            }
          },
          statusView: {
            type: "object",
            required: ["status", "record"],
            properties: {
              status: {
                type: "string",
                description: "The status for the account.",
                knownValues: ["app.bsky.actor.status#live"]
              },
              record: {
                type: "unknown"
              },
              embed: {
                type: "union",
                description: "An optional embed associated with the status.",
                refs: ["lex:app.bsky.embed.external#view"]
              },
              expiresAt: {
                type: "string",
                description: "The date when this status will expire. The application might choose to no longer return the status after expiration.",
                format: "datetime"
              },
              isActive: {
                type: "boolean",
                description: "True if the status is not expired, false if it is expired. Only present if expiration was set."
              }
            }
          }
        }
      },
      AppBskyActorGetPreferences: {
        lexicon: 1,
        id: "app.bsky.actor.getPreferences",
        defs: {
          main: {
            type: "query",
            description: "Get private preferences attached to the current account. Expected use is synchronization between multiple devices, and import/export during account migration. Requires auth.",
            parameters: {
              type: "params",
              properties: {}
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["preferences"],
                properties: {
                  preferences: {
                    type: "ref",
                    ref: "lex:app.bsky.actor.defs#preferences"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyActorGetProfile: {
        lexicon: 1,
        id: "app.bsky.actor.getProfile",
        defs: {
          main: {
            type: "query",
            description: "Get detailed profile view of an actor. Does not require auth, but contains relevant metadata with auth.",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier",
                  description: "Handle or DID of account to fetch profile of."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileViewDetailed"
              }
            }
          }
        }
      },
      AppBskyActorGetProfiles: {
        lexicon: 1,
        id: "app.bsky.actor.getProfiles",
        defs: {
          main: {
            type: "query",
            description: "Get detailed profile views of multiple actors.",
            parameters: {
              type: "params",
              required: ["actors"],
              properties: {
                actors: {
                  type: "array",
                  items: {
                    type: "string",
                    format: "at-identifier"
                  },
                  maxLength: 25
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["profiles"],
                properties: {
                  profiles: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileViewDetailed"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyActorGetSuggestions: {
        lexicon: 1,
        id: "app.bsky.actor.getSuggestions",
        defs: {
          main: {
            type: "query",
            description: "Get a list of suggested actors. Expected use is discovery of accounts to follow during new account onboarding.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["actors"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  actors: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileView"
                    }
                  },
                  recId: {
                    type: "integer",
                    description: "Snowflake for this recommendation, use when submitting recommendation events."
                  }
                }
              }
            }
          }
        }
      },
      AppBskyActorProfile: {
        lexicon: 1,
        id: "app.bsky.actor.profile",
        defs: {
          main: {
            type: "record",
            description: "A declaration of a Bluesky account profile.",
            key: "literal:self",
            record: {
              type: "object",
              properties: {
                displayName: {
                  type: "string",
                  maxGraphemes: 64,
                  maxLength: 640
                },
                description: {
                  type: "string",
                  description: "Free-form profile description text.",
                  maxGraphemes: 256,
                  maxLength: 2560
                },
                avatar: {
                  type: "blob",
                  description: "Small image to be displayed next to posts from account. AKA, 'profile picture'",
                  accept: ["image/png", "image/jpeg"],
                  maxSize: 1e6
                },
                banner: {
                  type: "blob",
                  description: "Larger horizontal image to display behind profile view.",
                  accept: ["image/png", "image/jpeg"],
                  maxSize: 1e6
                },
                labels: {
                  type: "union",
                  description: "Self-label values, specific to the Bluesky application, on the overall account.",
                  refs: ["lex:com.atproto.label.defs#selfLabels"]
                },
                joinedViaStarterPack: {
                  type: "ref",
                  ref: "lex:com.atproto.repo.strongRef"
                },
                pinnedPost: {
                  type: "ref",
                  ref: "lex:com.atproto.repo.strongRef"
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                }
              }
            }
          }
        }
      },
      AppBskyActorPutPreferences: {
        lexicon: 1,
        id: "app.bsky.actor.putPreferences",
        defs: {
          main: {
            type: "procedure",
            description: "Set the private preferences attached to the account.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["preferences"],
                properties: {
                  preferences: {
                    type: "ref",
                    ref: "lex:app.bsky.actor.defs#preferences"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyActorSearchActors: {
        lexicon: 1,
        id: "app.bsky.actor.searchActors",
        defs: {
          main: {
            type: "query",
            description: "Find actors (profiles) matching search criteria. Does not require auth.",
            parameters: {
              type: "params",
              properties: {
                term: {
                  type: "string",
                  description: "DEPRECATED: use 'q' instead."
                },
                q: {
                  type: "string",
                  description: "Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 25
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["actors"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  actors: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyActorSearchActorsTypeahead: {
        lexicon: 1,
        id: "app.bsky.actor.searchActorsTypeahead",
        defs: {
          main: {
            type: "query",
            description: "Find actor suggestions for a prefix search term. Expected use is for auto-completion during text field entry. Does not require auth.",
            parameters: {
              type: "params",
              properties: {
                term: {
                  type: "string",
                  description: "DEPRECATED: use 'q' instead."
                },
                q: {
                  type: "string",
                  description: "Search query prefix; not a full query string."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 10
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["actors"],
                properties: {
                  actors: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileViewBasic"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyActorStatus: {
        lexicon: 1,
        id: "app.bsky.actor.status",
        defs: {
          main: {
            type: "record",
            description: "A declaration of a Bluesky account status.",
            key: "literal:self",
            record: {
              type: "object",
              required: ["status", "createdAt"],
              properties: {
                status: {
                  type: "string",
                  description: "The status for the account.",
                  knownValues: ["app.bsky.actor.status#live"]
                },
                embed: {
                  type: "union",
                  description: "An optional embed associated with the status.",
                  refs: ["lex:app.bsky.embed.external"]
                },
                durationMinutes: {
                  type: "integer",
                  description: "The duration of the status in minutes. Applications can choose to impose minimum and maximum limits.",
                  minimum: 1
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                }
              }
            }
          },
          live: {
            type: "token",
            description: "Advertises an account as currently offering live content."
          }
        }
      },
      AppBskyBookmarkCreateBookmark: {
        lexicon: 1,
        id: "app.bsky.bookmark.createBookmark",
        defs: {
          main: {
            type: "procedure",
            description: "Creates a private bookmark for the specified record. Currently, only `app.bsky.feed.post` records are supported. Requires authentication.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["uri", "cid"],
                properties: {
                  uri: {
                    type: "string",
                    format: "at-uri"
                  },
                  cid: {
                    type: "string",
                    format: "cid"
                  }
                }
              }
            },
            errors: [
              {
                name: "UnsupportedCollection",
                description: "The URI to be bookmarked is for an unsupported collection."
              }
            ]
          }
        }
      },
      AppBskyBookmarkDefs: {
        lexicon: 1,
        id: "app.bsky.bookmark.defs",
        defs: {
          bookmark: {
            description: "Object used to store bookmark data in stash.",
            type: "object",
            required: ["subject"],
            properties: {
              subject: {
                description: "A strong ref to the record to be bookmarked. Currently, only `app.bsky.feed.post` records are supported.",
                type: "ref",
                ref: "lex:com.atproto.repo.strongRef"
              }
            }
          },
          bookmarkView: {
            type: "object",
            required: ["subject", "item"],
            properties: {
              subject: {
                description: "A strong ref to the bookmarked record.",
                type: "ref",
                ref: "lex:com.atproto.repo.strongRef"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              item: {
                type: "union",
                refs: [
                  "lex:app.bsky.feed.defs#blockedPost",
                  "lex:app.bsky.feed.defs#notFoundPost",
                  "lex:app.bsky.feed.defs#postView"
                ]
              }
            }
          }
        }
      },
      AppBskyBookmarkDeleteBookmark: {
        lexicon: 1,
        id: "app.bsky.bookmark.deleteBookmark",
        defs: {
          main: {
            type: "procedure",
            description: "Deletes a private bookmark for the specified record. Currently, only `app.bsky.feed.post` records are supported. Requires authentication.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["uri"],
                properties: {
                  uri: {
                    type: "string",
                    format: "at-uri"
                  }
                }
              }
            },
            errors: [
              {
                name: "UnsupportedCollection",
                description: "The URI to be bookmarked is for an unsupported collection."
              }
            ]
          }
        }
      },
      AppBskyBookmarkGetBookmarks: {
        lexicon: 1,
        id: "app.bsky.bookmark.getBookmarks",
        defs: {
          main: {
            type: "query",
            description: "Gets views of records bookmarked by the authenticated user. Requires authentication.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["bookmarks"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  bookmarks: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.bookmark.defs#bookmarkView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyEmbedDefs: {
        lexicon: 1,
        id: "app.bsky.embed.defs",
        defs: {
          aspectRatio: {
            type: "object",
            description: "width:height represents an aspect ratio. It may be approximate, and may not correspond to absolute dimensions in any given unit.",
            required: ["width", "height"],
            properties: {
              width: {
                type: "integer",
                minimum: 1
              },
              height: {
                type: "integer",
                minimum: 1
              }
            }
          }
        }
      },
      AppBskyEmbedExternal: {
        lexicon: 1,
        id: "app.bsky.embed.external",
        defs: {
          main: {
            type: "object",
            description: "A representation of some externally linked content (eg, a URL and 'card'), embedded in a Bluesky record (eg, a post).",
            required: ["external"],
            properties: {
              external: {
                type: "ref",
                ref: "lex:app.bsky.embed.external#external"
              }
            }
          },
          external: {
            type: "object",
            required: ["uri", "title", "description"],
            properties: {
              uri: {
                type: "string",
                format: "uri"
              },
              title: {
                type: "string"
              },
              description: {
                type: "string"
              },
              thumb: {
                type: "blob",
                accept: ["image/*"],
                maxSize: 1e6
              }
            }
          },
          view: {
            type: "object",
            required: ["external"],
            properties: {
              external: {
                type: "ref",
                ref: "lex:app.bsky.embed.external#viewExternal"
              }
            }
          },
          viewExternal: {
            type: "object",
            required: ["uri", "title", "description"],
            properties: {
              uri: {
                type: "string",
                format: "uri"
              },
              title: {
                type: "string"
              },
              description: {
                type: "string"
              },
              thumb: {
                type: "string",
                format: "uri"
              }
            }
          }
        }
      },
      AppBskyEmbedImages: {
        lexicon: 1,
        id: "app.bsky.embed.images",
        description: "A set of images embedded in a Bluesky record (eg, a post).",
        defs: {
          main: {
            type: "object",
            required: ["images"],
            properties: {
              images: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.embed.images#image"
                },
                maxLength: 4
              }
            }
          },
          image: {
            type: "object",
            required: ["image", "alt"],
            properties: {
              image: {
                type: "blob",
                accept: ["image/*"],
                maxSize: 1e6
              },
              alt: {
                type: "string",
                description: "Alt text description of the image, for accessibility."
              },
              aspectRatio: {
                type: "ref",
                ref: "lex:app.bsky.embed.defs#aspectRatio"
              }
            }
          },
          view: {
            type: "object",
            required: ["images"],
            properties: {
              images: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.embed.images#viewImage"
                },
                maxLength: 4
              }
            }
          },
          viewImage: {
            type: "object",
            required: ["thumb", "fullsize", "alt"],
            properties: {
              thumb: {
                type: "string",
                format: "uri",
                description: "Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View."
              },
              fullsize: {
                type: "string",
                format: "uri",
                description: "Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View."
              },
              alt: {
                type: "string",
                description: "Alt text description of the image, for accessibility."
              },
              aspectRatio: {
                type: "ref",
                ref: "lex:app.bsky.embed.defs#aspectRatio"
              }
            }
          }
        }
      },
      AppBskyEmbedRecord: {
        lexicon: 1,
        id: "app.bsky.embed.record",
        description: "A representation of a record embedded in a Bluesky record (eg, a post). For example, a quote-post, or sharing a feed generator record.",
        defs: {
          main: {
            type: "object",
            required: ["record"],
            properties: {
              record: {
                type: "ref",
                ref: "lex:com.atproto.repo.strongRef"
              }
            }
          },
          view: {
            type: "object",
            required: ["record"],
            properties: {
              record: {
                type: "union",
                refs: [
                  "lex:app.bsky.embed.record#viewRecord",
                  "lex:app.bsky.embed.record#viewNotFound",
                  "lex:app.bsky.embed.record#viewBlocked",
                  "lex:app.bsky.embed.record#viewDetached",
                  "lex:app.bsky.feed.defs#generatorView",
                  "lex:app.bsky.graph.defs#listView",
                  "lex:app.bsky.labeler.defs#labelerView",
                  "lex:app.bsky.graph.defs#starterPackViewBasic"
                ]
              }
            }
          },
          viewRecord: {
            type: "object",
            required: ["uri", "cid", "author", "value", "indexedAt"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              author: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileViewBasic"
              },
              value: {
                type: "unknown",
                description: "The record data itself."
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              replyCount: {
                type: "integer"
              },
              repostCount: {
                type: "integer"
              },
              likeCount: {
                type: "integer"
              },
              quoteCount: {
                type: "integer"
              },
              embeds: {
                type: "array",
                items: {
                  type: "union",
                  refs: [
                    "lex:app.bsky.embed.images#view",
                    "lex:app.bsky.embed.video#view",
                    "lex:app.bsky.embed.external#view",
                    "lex:app.bsky.embed.record#view",
                    "lex:app.bsky.embed.recordWithMedia#view"
                  ]
                }
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          viewNotFound: {
            type: "object",
            required: ["uri", "notFound"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              notFound: {
                type: "boolean",
                const: true
              }
            }
          },
          viewBlocked: {
            type: "object",
            required: ["uri", "blocked", "author"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              blocked: {
                type: "boolean",
                const: true
              },
              author: {
                type: "ref",
                ref: "lex:app.bsky.feed.defs#blockedAuthor"
              }
            }
          },
          viewDetached: {
            type: "object",
            required: ["uri", "detached"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              detached: {
                type: "boolean",
                const: true
              }
            }
          }
        }
      },
      AppBskyEmbedRecordWithMedia: {
        lexicon: 1,
        id: "app.bsky.embed.recordWithMedia",
        description: "A representation of a record embedded in a Bluesky record (eg, a post), alongside other compatible embeds. For example, a quote post and image, or a quote post and external URL card.",
        defs: {
          main: {
            type: "object",
            required: ["record", "media"],
            properties: {
              record: {
                type: "ref",
                ref: "lex:app.bsky.embed.record"
              },
              media: {
                type: "union",
                refs: [
                  "lex:app.bsky.embed.images",
                  "lex:app.bsky.embed.video",
                  "lex:app.bsky.embed.external"
                ]
              }
            }
          },
          view: {
            type: "object",
            required: ["record", "media"],
            properties: {
              record: {
                type: "ref",
                ref: "lex:app.bsky.embed.record#view"
              },
              media: {
                type: "union",
                refs: [
                  "lex:app.bsky.embed.images#view",
                  "lex:app.bsky.embed.video#view",
                  "lex:app.bsky.embed.external#view"
                ]
              }
            }
          }
        }
      },
      AppBskyEmbedVideo: {
        lexicon: 1,
        id: "app.bsky.embed.video",
        description: "A video embedded in a Bluesky record (eg, a post).",
        defs: {
          main: {
            type: "object",
            required: ["video"],
            properties: {
              video: {
                type: "blob",
                description: "The mp4 video file. May be up to 100mb, formerly limited to 50mb.",
                accept: ["video/mp4"],
                maxSize: 1e8
              },
              captions: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.embed.video#caption"
                },
                maxLength: 20
              },
              alt: {
                type: "string",
                description: "Alt text description of the video, for accessibility.",
                maxGraphemes: 1e3,
                maxLength: 1e4
              },
              aspectRatio: {
                type: "ref",
                ref: "lex:app.bsky.embed.defs#aspectRatio"
              }
            }
          },
          caption: {
            type: "object",
            required: ["lang", "file"],
            properties: {
              lang: {
                type: "string",
                format: "language"
              },
              file: {
                type: "blob",
                accept: ["text/vtt"],
                maxSize: 2e4
              }
            }
          },
          view: {
            type: "object",
            required: ["cid", "playlist"],
            properties: {
              cid: {
                type: "string",
                format: "cid"
              },
              playlist: {
                type: "string",
                format: "uri"
              },
              thumbnail: {
                type: "string",
                format: "uri"
              },
              alt: {
                type: "string",
                maxGraphemes: 1e3,
                maxLength: 1e4
              },
              aspectRatio: {
                type: "ref",
                ref: "lex:app.bsky.embed.defs#aspectRatio"
              }
            }
          }
        }
      },
      AppBskyFeedDefs: {
        lexicon: 1,
        id: "app.bsky.feed.defs",
        defs: {
          postView: {
            type: "object",
            required: ["uri", "cid", "author", "record", "indexedAt"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              author: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileViewBasic"
              },
              record: {
                type: "unknown"
              },
              embed: {
                type: "union",
                refs: [
                  "lex:app.bsky.embed.images#view",
                  "lex:app.bsky.embed.video#view",
                  "lex:app.bsky.embed.external#view",
                  "lex:app.bsky.embed.record#view",
                  "lex:app.bsky.embed.recordWithMedia#view"
                ]
              },
              bookmarkCount: {
                type: "integer"
              },
              replyCount: {
                type: "integer"
              },
              repostCount: {
                type: "integer"
              },
              likeCount: {
                type: "integer"
              },
              quoteCount: {
                type: "integer"
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              viewer: {
                type: "ref",
                ref: "lex:app.bsky.feed.defs#viewerState"
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              threadgate: {
                type: "ref",
                ref: "lex:app.bsky.feed.defs#threadgateView"
              }
            }
          },
          viewerState: {
            type: "object",
            description: "Metadata about the requesting account's relationship with the subject content. Only has meaningful content for authed requests.",
            properties: {
              repost: {
                type: "string",
                format: "at-uri"
              },
              like: {
                type: "string",
                format: "at-uri"
              },
              bookmarked: {
                type: "boolean"
              },
              threadMuted: {
                type: "boolean"
              },
              replyDisabled: {
                type: "boolean"
              },
              embeddingDisabled: {
                type: "boolean"
              },
              pinned: {
                type: "boolean"
              }
            }
          },
          threadContext: {
            type: "object",
            description: "Metadata about this post within the context of the thread it is in.",
            properties: {
              rootAuthorLike: {
                type: "string",
                format: "at-uri"
              }
            }
          },
          feedViewPost: {
            type: "object",
            required: ["post"],
            properties: {
              post: {
                type: "ref",
                ref: "lex:app.bsky.feed.defs#postView"
              },
              reply: {
                type: "ref",
                ref: "lex:app.bsky.feed.defs#replyRef"
              },
              reason: {
                type: "union",
                refs: [
                  "lex:app.bsky.feed.defs#reasonRepost",
                  "lex:app.bsky.feed.defs#reasonPin"
                ]
              },
              feedContext: {
                type: "string",
                description: "Context provided by feed generator that may be passed back alongside interactions.",
                maxLength: 2e3
              },
              reqId: {
                type: "string",
                description: "Unique identifier per request that may be passed back alongside interactions.",
                maxLength: 100
              }
            }
          },
          replyRef: {
            type: "object",
            required: ["root", "parent"],
            properties: {
              root: {
                type: "union",
                refs: [
                  "lex:app.bsky.feed.defs#postView",
                  "lex:app.bsky.feed.defs#notFoundPost",
                  "lex:app.bsky.feed.defs#blockedPost"
                ]
              },
              parent: {
                type: "union",
                refs: [
                  "lex:app.bsky.feed.defs#postView",
                  "lex:app.bsky.feed.defs#notFoundPost",
                  "lex:app.bsky.feed.defs#blockedPost"
                ]
              },
              grandparentAuthor: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileViewBasic",
                description: "When parent is a reply to another post, this is the author of that post."
              }
            }
          },
          reasonRepost: {
            type: "object",
            required: ["by", "indexedAt"],
            properties: {
              by: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileViewBasic"
              },
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          reasonPin: {
            type: "object",
            properties: {}
          },
          threadViewPost: {
            type: "object",
            required: ["post"],
            properties: {
              post: {
                type: "ref",
                ref: "lex:app.bsky.feed.defs#postView"
              },
              parent: {
                type: "union",
                refs: [
                  "lex:app.bsky.feed.defs#threadViewPost",
                  "lex:app.bsky.feed.defs#notFoundPost",
                  "lex:app.bsky.feed.defs#blockedPost"
                ]
              },
              replies: {
                type: "array",
                items: {
                  type: "union",
                  refs: [
                    "lex:app.bsky.feed.defs#threadViewPost",
                    "lex:app.bsky.feed.defs#notFoundPost",
                    "lex:app.bsky.feed.defs#blockedPost"
                  ]
                }
              },
              threadContext: {
                type: "ref",
                ref: "lex:app.bsky.feed.defs#threadContext"
              }
            }
          },
          notFoundPost: {
            type: "object",
            required: ["uri", "notFound"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              notFound: {
                type: "boolean",
                const: true
              }
            }
          },
          blockedPost: {
            type: "object",
            required: ["uri", "blocked", "author"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              blocked: {
                type: "boolean",
                const: true
              },
              author: {
                type: "ref",
                ref: "lex:app.bsky.feed.defs#blockedAuthor"
              }
            }
          },
          blockedAuthor: {
            type: "object",
            required: ["did"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              viewer: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#viewerState"
              }
            }
          },
          generatorView: {
            type: "object",
            required: ["uri", "cid", "did", "creator", "displayName", "indexedAt"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              did: {
                type: "string",
                format: "did"
              },
              creator: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileView"
              },
              displayName: {
                type: "string"
              },
              description: {
                type: "string",
                maxGraphemes: 300,
                maxLength: 3e3
              },
              descriptionFacets: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.richtext.facet"
                }
              },
              avatar: {
                type: "string",
                format: "uri"
              },
              likeCount: {
                type: "integer",
                minimum: 0
              },
              acceptsInteractions: {
                type: "boolean"
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              viewer: {
                type: "ref",
                ref: "lex:app.bsky.feed.defs#generatorViewerState"
              },
              contentMode: {
                type: "string",
                knownValues: [
                  "app.bsky.feed.defs#contentModeUnspecified",
                  "app.bsky.feed.defs#contentModeVideo"
                ]
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          generatorViewerState: {
            type: "object",
            properties: {
              like: {
                type: "string",
                format: "at-uri"
              }
            }
          },
          skeletonFeedPost: {
            type: "object",
            required: ["post"],
            properties: {
              post: {
                type: "string",
                format: "at-uri"
              },
              reason: {
                type: "union",
                refs: [
                  "lex:app.bsky.feed.defs#skeletonReasonRepost",
                  "lex:app.bsky.feed.defs#skeletonReasonPin"
                ]
              },
              feedContext: {
                type: "string",
                description: "Context that will be passed through to client and may be passed to feed generator back alongside interactions.",
                maxLength: 2e3
              }
            }
          },
          skeletonReasonRepost: {
            type: "object",
            required: ["repost"],
            properties: {
              repost: {
                type: "string",
                format: "at-uri"
              }
            }
          },
          skeletonReasonPin: {
            type: "object",
            properties: {}
          },
          threadgateView: {
            type: "object",
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              record: {
                type: "unknown"
              },
              lists: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.graph.defs#listViewBasic"
                }
              }
            }
          },
          interaction: {
            type: "object",
            properties: {
              item: {
                type: "string",
                format: "at-uri"
              },
              event: {
                type: "string",
                knownValues: [
                  "app.bsky.feed.defs#requestLess",
                  "app.bsky.feed.defs#requestMore",
                  "app.bsky.feed.defs#clickthroughItem",
                  "app.bsky.feed.defs#clickthroughAuthor",
                  "app.bsky.feed.defs#clickthroughReposter",
                  "app.bsky.feed.defs#clickthroughEmbed",
                  "app.bsky.feed.defs#interactionSeen",
                  "app.bsky.feed.defs#interactionLike",
                  "app.bsky.feed.defs#interactionRepost",
                  "app.bsky.feed.defs#interactionReply",
                  "app.bsky.feed.defs#interactionQuote",
                  "app.bsky.feed.defs#interactionShare"
                ]
              },
              feedContext: {
                type: "string",
                description: "Context on a feed item that was originally supplied by the feed generator on getFeedSkeleton.",
                maxLength: 2e3
              },
              reqId: {
                type: "string",
                description: "Unique identifier per request that may be passed back alongside interactions.",
                maxLength: 100
              }
            }
          },
          requestLess: {
            type: "token",
            description: "Request that less content like the given feed item be shown in the feed"
          },
          requestMore: {
            type: "token",
            description: "Request that more content like the given feed item be shown in the feed"
          },
          clickthroughItem: {
            type: "token",
            description: "User clicked through to the feed item"
          },
          clickthroughAuthor: {
            type: "token",
            description: "User clicked through to the author of the feed item"
          },
          clickthroughReposter: {
            type: "token",
            description: "User clicked through to the reposter of the feed item"
          },
          clickthroughEmbed: {
            type: "token",
            description: "User clicked through to the embedded content of the feed item"
          },
          contentModeUnspecified: {
            type: "token",
            description: "Declares the feed generator returns any types of posts."
          },
          contentModeVideo: {
            type: "token",
            description: "Declares the feed generator returns posts containing app.bsky.embed.video embeds."
          },
          interactionSeen: {
            type: "token",
            description: "Feed item was seen by user"
          },
          interactionLike: {
            type: "token",
            description: "User liked the feed item"
          },
          interactionRepost: {
            type: "token",
            description: "User reposted the feed item"
          },
          interactionReply: {
            type: "token",
            description: "User replied to the feed item"
          },
          interactionQuote: {
            type: "token",
            description: "User quoted the feed item"
          },
          interactionShare: {
            type: "token",
            description: "User shared the feed item"
          }
        }
      },
      AppBskyFeedDescribeFeedGenerator: {
        lexicon: 1,
        id: "app.bsky.feed.describeFeedGenerator",
        defs: {
          main: {
            type: "query",
            description: "Get information about a feed generator, including policies and offered feed URIs. Does not require auth; implemented by Feed Generator services (not App View).",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did", "feeds"],
                properties: {
                  did: {
                    type: "string",
                    format: "did"
                  },
                  feeds: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.describeFeedGenerator#feed"
                    }
                  },
                  links: {
                    type: "ref",
                    ref: "lex:app.bsky.feed.describeFeedGenerator#links"
                  }
                }
              }
            }
          },
          feed: {
            type: "object",
            required: ["uri"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              }
            }
          },
          links: {
            type: "object",
            properties: {
              privacyPolicy: {
                type: "string"
              },
              termsOfService: {
                type: "string"
              }
            }
          }
        }
      },
      AppBskyFeedGenerator: {
        lexicon: 1,
        id: "app.bsky.feed.generator",
        defs: {
          main: {
            type: "record",
            description: "Record declaring of the existence of a feed generator, and containing metadata about it. The record can exist in any repository.",
            key: "any",
            record: {
              type: "object",
              required: ["did", "displayName", "createdAt"],
              properties: {
                did: {
                  type: "string",
                  format: "did"
                },
                displayName: {
                  type: "string",
                  maxGraphemes: 24,
                  maxLength: 240
                },
                description: {
                  type: "string",
                  maxGraphemes: 300,
                  maxLength: 3e3
                },
                descriptionFacets: {
                  type: "array",
                  items: {
                    type: "ref",
                    ref: "lex:app.bsky.richtext.facet"
                  }
                },
                avatar: {
                  type: "blob",
                  accept: ["image/png", "image/jpeg"],
                  maxSize: 1e6
                },
                acceptsInteractions: {
                  type: "boolean",
                  description: "Declaration that a feed accepts feedback interactions from a client through app.bsky.feed.sendInteractions"
                },
                labels: {
                  type: "union",
                  description: "Self-label values",
                  refs: ["lex:com.atproto.label.defs#selfLabels"]
                },
                contentMode: {
                  type: "string",
                  knownValues: [
                    "app.bsky.feed.defs#contentModeUnspecified",
                    "app.bsky.feed.defs#contentModeVideo"
                  ]
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                }
              }
            }
          }
        }
      },
      AppBskyFeedGetActorFeeds: {
        lexicon: 1,
        id: "app.bsky.feed.getActorFeeds",
        defs: {
          main: {
            type: "query",
            description: "Get a list of feeds (feed generator records) created by the actor (in the actor's repo).",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feeds"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  feeds: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#generatorView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyFeedGetActorLikes: {
        lexicon: 1,
        id: "app.bsky.feed.getActorLikes",
        defs: {
          main: {
            type: "query",
            description: "Get a list of posts liked by an actor. Requires auth, actor must be the requesting account.",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feed"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  feed: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#feedViewPost"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "BlockedActor"
              },
              {
                name: "BlockedByActor"
              }
            ]
          }
        }
      },
      AppBskyFeedGetAuthorFeed: {
        lexicon: 1,
        id: "app.bsky.feed.getAuthorFeed",
        defs: {
          main: {
            type: "query",
            description: "Get a view of an actor's 'author feed' (post and reposts by the author). Does not require auth.",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                },
                filter: {
                  type: "string",
                  description: "Combinations of post/repost types to include in response.",
                  knownValues: [
                    "posts_with_replies",
                    "posts_no_replies",
                    "posts_with_media",
                    "posts_and_author_threads",
                    "posts_with_video"
                  ],
                  default: "posts_with_replies"
                },
                includePins: {
                  type: "boolean",
                  default: false
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feed"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  feed: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#feedViewPost"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "BlockedActor"
              },
              {
                name: "BlockedByActor"
              }
            ]
          }
        }
      },
      AppBskyFeedGetFeed: {
        lexicon: 1,
        id: "app.bsky.feed.getFeed",
        defs: {
          main: {
            type: "query",
            description: "Get a hydrated feed from an actor's selected feed generator. Implemented by App View.",
            parameters: {
              type: "params",
              required: ["feed"],
              properties: {
                feed: {
                  type: "string",
                  format: "at-uri"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feed"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  feed: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#feedViewPost"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "UnknownFeed"
              }
            ]
          }
        }
      },
      AppBskyFeedGetFeedGenerator: {
        lexicon: 1,
        id: "app.bsky.feed.getFeedGenerator",
        defs: {
          main: {
            type: "query",
            description: "Get information about a feed generator. Implemented by AppView.",
            parameters: {
              type: "params",
              required: ["feed"],
              properties: {
                feed: {
                  type: "string",
                  format: "at-uri",
                  description: "AT-URI of the feed generator record."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["view", "isOnline", "isValid"],
                properties: {
                  view: {
                    type: "ref",
                    ref: "lex:app.bsky.feed.defs#generatorView"
                  },
                  isOnline: {
                    type: "boolean",
                    description: "Indicates whether the feed generator service has been online recently, or else seems to be inactive."
                  },
                  isValid: {
                    type: "boolean",
                    description: "Indicates whether the feed generator service is compatible with the record declaration."
                  }
                }
              }
            }
          }
        }
      },
      AppBskyFeedGetFeedGenerators: {
        lexicon: 1,
        id: "app.bsky.feed.getFeedGenerators",
        defs: {
          main: {
            type: "query",
            description: "Get information about a list of feed generators.",
            parameters: {
              type: "params",
              required: ["feeds"],
              properties: {
                feeds: {
                  type: "array",
                  items: {
                    type: "string",
                    format: "at-uri"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feeds"],
                properties: {
                  feeds: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#generatorView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyFeedGetFeedSkeleton: {
        lexicon: 1,
        id: "app.bsky.feed.getFeedSkeleton",
        defs: {
          main: {
            type: "query",
            description: "Get a skeleton of a feed provided by a feed generator. Auth is optional, depending on provider requirements, and provides the DID of the requester. Implemented by Feed Generator Service.",
            parameters: {
              type: "params",
              required: ["feed"],
              properties: {
                feed: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference to feed generator record describing the specific feed being requested."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feed"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  feed: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#skeletonFeedPost"
                    }
                  },
                  reqId: {
                    type: "string",
                    description: "Unique identifier per request that may be passed back alongside interactions.",
                    maxLength: 100
                  }
                }
              }
            },
            errors: [
              {
                name: "UnknownFeed"
              }
            ]
          }
        }
      },
      AppBskyFeedGetLikes: {
        lexicon: 1,
        id: "app.bsky.feed.getLikes",
        defs: {
          main: {
            type: "query",
            description: "Get like records which reference a subject (by AT-URI and CID).",
            parameters: {
              type: "params",
              required: ["uri"],
              properties: {
                uri: {
                  type: "string",
                  format: "at-uri",
                  description: "AT-URI of the subject (eg, a post record)."
                },
                cid: {
                  type: "string",
                  format: "cid",
                  description: "CID of the subject record (aka, specific version of record), to filter likes."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["uri", "likes"],
                properties: {
                  uri: {
                    type: "string",
                    format: "at-uri"
                  },
                  cid: {
                    type: "string",
                    format: "cid"
                  },
                  cursor: {
                    type: "string"
                  },
                  likes: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.getLikes#like"
                    }
                  }
                }
              }
            }
          },
          like: {
            type: "object",
            required: ["indexedAt", "createdAt", "actor"],
            properties: {
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              actor: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileView"
              }
            }
          }
        }
      },
      AppBskyFeedGetListFeed: {
        lexicon: 1,
        id: "app.bsky.feed.getListFeed",
        defs: {
          main: {
            type: "query",
            description: "Get a feed of recent posts from a list (posts and reposts from any actors on the list). Does not require auth.",
            parameters: {
              type: "params",
              required: ["list"],
              properties: {
                list: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) to the list record."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feed"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  feed: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#feedViewPost"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "UnknownList"
              }
            ]
          }
        }
      },
      AppBskyFeedGetPostThread: {
        lexicon: 1,
        id: "app.bsky.feed.getPostThread",
        defs: {
          main: {
            type: "query",
            description: "Get posts in a thread. Does not require auth, but additional metadata and filtering will be applied for authed requests.",
            parameters: {
              type: "params",
              required: ["uri"],
              properties: {
                uri: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) to post record."
                },
                depth: {
                  type: "integer",
                  description: "How many levels of reply depth should be included in response.",
                  default: 6,
                  minimum: 0,
                  maximum: 1e3
                },
                parentHeight: {
                  type: "integer",
                  description: "How many levels of parent (and grandparent, etc) post to include.",
                  default: 80,
                  minimum: 0,
                  maximum: 1e3
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["thread"],
                properties: {
                  thread: {
                    type: "union",
                    refs: [
                      "lex:app.bsky.feed.defs#threadViewPost",
                      "lex:app.bsky.feed.defs#notFoundPost",
                      "lex:app.bsky.feed.defs#blockedPost"
                    ]
                  },
                  threadgate: {
                    type: "ref",
                    ref: "lex:app.bsky.feed.defs#threadgateView"
                  }
                }
              }
            },
            errors: [
              {
                name: "NotFound"
              }
            ]
          }
        }
      },
      AppBskyFeedGetPosts: {
        lexicon: 1,
        id: "app.bsky.feed.getPosts",
        defs: {
          main: {
            type: "query",
            description: "Gets post views for a specified list of posts (by AT-URI). This is sometimes referred to as 'hydrating' a 'feed skeleton'.",
            parameters: {
              type: "params",
              required: ["uris"],
              properties: {
                uris: {
                  type: "array",
                  description: "List of post AT-URIs to return hydrated views for.",
                  items: {
                    type: "string",
                    format: "at-uri"
                  },
                  maxLength: 25
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["posts"],
                properties: {
                  posts: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#postView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyFeedGetQuotes: {
        lexicon: 1,
        id: "app.bsky.feed.getQuotes",
        defs: {
          main: {
            type: "query",
            description: "Get a list of quotes for a given post.",
            parameters: {
              type: "params",
              required: ["uri"],
              properties: {
                uri: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) of post record"
                },
                cid: {
                  type: "string",
                  format: "cid",
                  description: "If supplied, filters to quotes of specific version (by CID) of the post record."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["uri", "posts"],
                properties: {
                  uri: {
                    type: "string",
                    format: "at-uri"
                  },
                  cid: {
                    type: "string",
                    format: "cid"
                  },
                  cursor: {
                    type: "string"
                  },
                  posts: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#postView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyFeedGetRepostedBy: {
        lexicon: 1,
        id: "app.bsky.feed.getRepostedBy",
        defs: {
          main: {
            type: "query",
            description: "Get a list of reposts for a given post.",
            parameters: {
              type: "params",
              required: ["uri"],
              properties: {
                uri: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) of post record"
                },
                cid: {
                  type: "string",
                  format: "cid",
                  description: "If supplied, filters to reposts of specific version (by CID) of the post record."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["uri", "repostedBy"],
                properties: {
                  uri: {
                    type: "string",
                    format: "at-uri"
                  },
                  cid: {
                    type: "string",
                    format: "cid"
                  },
                  cursor: {
                    type: "string"
                  },
                  repostedBy: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyFeedGetSuggestedFeeds: {
        lexicon: 1,
        id: "app.bsky.feed.getSuggestedFeeds",
        defs: {
          main: {
            type: "query",
            description: "Get a list of suggested feeds (feed generators) for the requesting account.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feeds"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  feeds: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#generatorView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyFeedGetTimeline: {
        lexicon: 1,
        id: "app.bsky.feed.getTimeline",
        defs: {
          main: {
            type: "query",
            description: "Get a view of the requesting account's home timeline. This is expected to be some form of reverse-chronological feed.",
            parameters: {
              type: "params",
              properties: {
                algorithm: {
                  type: "string",
                  description: "Variant 'algorithm' for timeline. Implementation-specific. NOTE: most feed flexibility has been moved to feed generator mechanism."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feed"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  feed: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#feedViewPost"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyFeedLike: {
        lexicon: 1,
        id: "app.bsky.feed.like",
        defs: {
          main: {
            type: "record",
            description: "Record declaring a 'like' of a piece of subject content.",
            key: "tid",
            record: {
              type: "object",
              required: ["subject", "createdAt"],
              properties: {
                subject: {
                  type: "ref",
                  ref: "lex:com.atproto.repo.strongRef"
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                },
                via: {
                  type: "ref",
                  ref: "lex:com.atproto.repo.strongRef"
                }
              }
            }
          }
        }
      },
      AppBskyFeedPost: {
        lexicon: 1,
        id: "app.bsky.feed.post",
        defs: {
          main: {
            type: "record",
            description: "Record containing a Bluesky post.",
            key: "tid",
            record: {
              type: "object",
              required: ["text", "createdAt"],
              properties: {
                text: {
                  type: "string",
                  maxLength: 3e3,
                  maxGraphemes: 300,
                  description: "The primary post content. May be an empty string, if there are embeds."
                },
                entities: {
                  type: "array",
                  description: "DEPRECATED: replaced by app.bsky.richtext.facet.",
                  items: {
                    type: "ref",
                    ref: "lex:app.bsky.feed.post#entity"
                  }
                },
                facets: {
                  type: "array",
                  description: "Annotations of text (mentions, URLs, hashtags, etc)",
                  items: {
                    type: "ref",
                    ref: "lex:app.bsky.richtext.facet"
                  }
                },
                reply: {
                  type: "ref",
                  ref: "lex:app.bsky.feed.post#replyRef"
                },
                embed: {
                  type: "union",
                  refs: [
                    "lex:app.bsky.embed.images",
                    "lex:app.bsky.embed.video",
                    "lex:app.bsky.embed.external",
                    "lex:app.bsky.embed.record",
                    "lex:app.bsky.embed.recordWithMedia"
                  ]
                },
                langs: {
                  type: "array",
                  description: "Indicates human language of post primary text content.",
                  maxLength: 3,
                  items: {
                    type: "string",
                    format: "language"
                  }
                },
                labels: {
                  type: "union",
                  description: "Self-label values for this post. Effectively content warnings.",
                  refs: ["lex:com.atproto.label.defs#selfLabels"]
                },
                tags: {
                  type: "array",
                  description: "Additional hashtags, in addition to any included in post text and facets.",
                  maxLength: 8,
                  items: {
                    type: "string",
                    maxLength: 640,
                    maxGraphemes: 64
                  }
                },
                createdAt: {
                  type: "string",
                  format: "datetime",
                  description: "Client-declared timestamp when this post was originally created."
                }
              }
            }
          },
          replyRef: {
            type: "object",
            required: ["root", "parent"],
            properties: {
              root: {
                type: "ref",
                ref: "lex:com.atproto.repo.strongRef"
              },
              parent: {
                type: "ref",
                ref: "lex:com.atproto.repo.strongRef"
              }
            }
          },
          entity: {
            type: "object",
            description: "Deprecated: use facets instead.",
            required: ["index", "type", "value"],
            properties: {
              index: {
                type: "ref",
                ref: "lex:app.bsky.feed.post#textSlice"
              },
              type: {
                type: "string",
                description: "Expected values are 'mention' and 'link'."
              },
              value: {
                type: "string"
              }
            }
          },
          textSlice: {
            type: "object",
            description: "Deprecated. Use app.bsky.richtext instead -- A text segment. Start is inclusive, end is exclusive. Indices are for utf16-encoded strings.",
            required: ["start", "end"],
            properties: {
              start: {
                type: "integer",
                minimum: 0
              },
              end: {
                type: "integer",
                minimum: 0
              }
            }
          }
        }
      },
      AppBskyFeedPostgate: {
        lexicon: 1,
        id: "app.bsky.feed.postgate",
        defs: {
          main: {
            type: "record",
            key: "tid",
            description: "Record defining interaction rules for a post. The record key (rkey) of the postgate record must match the record key of the post, and that record must be in the same repository.",
            record: {
              type: "object",
              required: ["post", "createdAt"],
              properties: {
                createdAt: {
                  type: "string",
                  format: "datetime"
                },
                post: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) to the post record."
                },
                detachedEmbeddingUris: {
                  type: "array",
                  maxLength: 50,
                  items: {
                    type: "string",
                    format: "at-uri"
                  },
                  description: "List of AT-URIs embedding this post that the author has detached from."
                },
                embeddingRules: {
                  description: "List of rules defining who can embed this post. If value is an empty array or is undefined, no particular rules apply and anyone can embed.",
                  type: "array",
                  maxLength: 5,
                  items: {
                    type: "union",
                    refs: ["lex:app.bsky.feed.postgate#disableRule"]
                  }
                }
              }
            }
          },
          disableRule: {
            type: "object",
            description: "Disables embedding of this post.",
            properties: {}
          }
        }
      },
      AppBskyFeedRepost: {
        lexicon: 1,
        id: "app.bsky.feed.repost",
        defs: {
          main: {
            description: "Record representing a 'repost' of an existing Bluesky post.",
            type: "record",
            key: "tid",
            record: {
              type: "object",
              required: ["subject", "createdAt"],
              properties: {
                subject: {
                  type: "ref",
                  ref: "lex:com.atproto.repo.strongRef"
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                },
                via: {
                  type: "ref",
                  ref: "lex:com.atproto.repo.strongRef"
                }
              }
            }
          }
        }
      },
      AppBskyFeedSearchPosts: {
        lexicon: 1,
        id: "app.bsky.feed.searchPosts",
        defs: {
          main: {
            type: "query",
            description: "Find posts matching search criteria, returning views of those posts. Note that this API endpoint may require authentication (eg, not public) for some service providers and implementations.",
            parameters: {
              type: "params",
              required: ["q"],
              properties: {
                q: {
                  type: "string",
                  description: "Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended."
                },
                sort: {
                  type: "string",
                  knownValues: ["top", "latest"],
                  default: "latest",
                  description: "Specifies the ranking order of results."
                },
                since: {
                  type: "string",
                  description: "Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD)."
                },
                until: {
                  type: "string",
                  description: "Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD)."
                },
                mentions: {
                  type: "string",
                  format: "at-identifier",
                  description: "Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions."
                },
                author: {
                  type: "string",
                  format: "at-identifier",
                  description: "Filter to posts by the given account. Handles are resolved to DID before query-time."
                },
                lang: {
                  type: "string",
                  format: "language",
                  description: "Filter to posts in the given language. Expected to be based on post language field, though server may override language detection."
                },
                domain: {
                  type: "string",
                  description: "Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization."
                },
                url: {
                  type: "string",
                  format: "uri",
                  description: "Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching."
                },
                tag: {
                  type: "array",
                  items: {
                    type: "string",
                    maxLength: 640,
                    maxGraphemes: 64
                  },
                  description: "Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 25
                },
                cursor: {
                  type: "string",
                  description: "Optional pagination mechanism; may not necessarily allow scrolling through entire result set."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["posts"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  hitsTotal: {
                    type: "integer",
                    description: "Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits."
                  },
                  posts: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#postView"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "BadQueryString"
              }
            ]
          }
        }
      },
      AppBskyFeedSendInteractions: {
        lexicon: 1,
        id: "app.bsky.feed.sendInteractions",
        defs: {
          main: {
            type: "procedure",
            description: "Send information about interactions with feed items back to the feed generator that served them.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["interactions"],
                properties: {
                  interactions: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#interaction"
                    }
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {}
              }
            }
          }
        }
      },
      AppBskyFeedThreadgate: {
        lexicon: 1,
        id: "app.bsky.feed.threadgate",
        defs: {
          main: {
            type: "record",
            key: "tid",
            description: "Record defining interaction gating rules for a thread (aka, reply controls). The record key (rkey) of the threadgate record must match the record key of the thread's root post, and that record must be in the same repository.",
            record: {
              type: "object",
              required: ["post", "createdAt"],
              properties: {
                post: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) to the post record."
                },
                allow: {
                  description: "List of rules defining who can reply to this post. If value is an empty array, no one can reply. If value is undefined, anyone can reply.",
                  type: "array",
                  maxLength: 5,
                  items: {
                    type: "union",
                    refs: [
                      "lex:app.bsky.feed.threadgate#mentionRule",
                      "lex:app.bsky.feed.threadgate#followerRule",
                      "lex:app.bsky.feed.threadgate#followingRule",
                      "lex:app.bsky.feed.threadgate#listRule"
                    ]
                  }
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                },
                hiddenReplies: {
                  type: "array",
                  maxLength: 50,
                  items: {
                    type: "string",
                    format: "at-uri"
                  },
                  description: "List of hidden reply URIs."
                }
              }
            }
          },
          mentionRule: {
            type: "object",
            description: "Allow replies from actors mentioned in your post.",
            properties: {}
          },
          followerRule: {
            type: "object",
            description: "Allow replies from actors who follow you.",
            properties: {}
          },
          followingRule: {
            type: "object",
            description: "Allow replies from actors you follow.",
            properties: {}
          },
          listRule: {
            type: "object",
            description: "Allow replies from actors on a list.",
            required: ["list"],
            properties: {
              list: {
                type: "string",
                format: "at-uri"
              }
            }
          }
        }
      },
      AppBskyGraphBlock: {
        lexicon: 1,
        id: "app.bsky.graph.block",
        defs: {
          main: {
            type: "record",
            description: "Record declaring a 'block' relationship against another account. NOTE: blocks are public in Bluesky; see blog posts for details.",
            key: "tid",
            record: {
              type: "object",
              required: ["subject", "createdAt"],
              properties: {
                subject: {
                  type: "string",
                  format: "did",
                  description: "DID of the account to be blocked."
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                }
              }
            }
          }
        }
      },
      AppBskyGraphDefs: {
        lexicon: 1,
        id: "app.bsky.graph.defs",
        defs: {
          listViewBasic: {
            type: "object",
            required: ["uri", "cid", "name", "purpose"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              name: {
                type: "string",
                maxLength: 64,
                minLength: 1
              },
              purpose: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#listPurpose"
              },
              avatar: {
                type: "string",
                format: "uri"
              },
              listItemCount: {
                type: "integer",
                minimum: 0
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              viewer: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#listViewerState"
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          listView: {
            type: "object",
            required: ["uri", "cid", "creator", "name", "purpose", "indexedAt"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              creator: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileView"
              },
              name: {
                type: "string",
                maxLength: 64,
                minLength: 1
              },
              purpose: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#listPurpose"
              },
              description: {
                type: "string",
                maxGraphemes: 300,
                maxLength: 3e3
              },
              descriptionFacets: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.richtext.facet"
                }
              },
              avatar: {
                type: "string",
                format: "uri"
              },
              listItemCount: {
                type: "integer",
                minimum: 0
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              viewer: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#listViewerState"
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          listItemView: {
            type: "object",
            required: ["uri", "subject"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              subject: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileView"
              }
            }
          },
          starterPackView: {
            type: "object",
            required: ["uri", "cid", "record", "creator", "indexedAt"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              record: {
                type: "unknown"
              },
              creator: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileViewBasic"
              },
              list: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#listViewBasic"
              },
              listItemsSample: {
                type: "array",
                maxLength: 12,
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.graph.defs#listItemView"
                }
              },
              feeds: {
                type: "array",
                maxLength: 3,
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.feed.defs#generatorView"
                }
              },
              joinedWeekCount: {
                type: "integer",
                minimum: 0
              },
              joinedAllTimeCount: {
                type: "integer",
                minimum: 0
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          starterPackViewBasic: {
            type: "object",
            required: ["uri", "cid", "record", "creator", "indexedAt"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              record: {
                type: "unknown"
              },
              creator: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileViewBasic"
              },
              listItemCount: {
                type: "integer",
                minimum: 0
              },
              joinedWeekCount: {
                type: "integer",
                minimum: 0
              },
              joinedAllTimeCount: {
                type: "integer",
                minimum: 0
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          listPurpose: {
            type: "string",
            knownValues: [
              "app.bsky.graph.defs#modlist",
              "app.bsky.graph.defs#curatelist",
              "app.bsky.graph.defs#referencelist"
            ]
          },
          modlist: {
            type: "token",
            description: "A list of actors to apply an aggregate moderation action (mute/block) on."
          },
          curatelist: {
            type: "token",
            description: "A list of actors used for curation purposes such as list feeds or interaction gating."
          },
          referencelist: {
            type: "token",
            description: "A list of actors used for only for reference purposes such as within a starter pack."
          },
          listViewerState: {
            type: "object",
            properties: {
              muted: {
                type: "boolean"
              },
              blocked: {
                type: "string",
                format: "at-uri"
              }
            }
          },
          notFoundActor: {
            type: "object",
            description: "indicates that a handle or DID could not be resolved",
            required: ["actor", "notFound"],
            properties: {
              actor: {
                type: "string",
                format: "at-identifier"
              },
              notFound: {
                type: "boolean",
                const: true
              }
            }
          },
          relationship: {
            type: "object",
            description: "lists the bi-directional graph relationships between one actor (not indicated in the object), and the target actors (the DID included in the object)",
            required: ["did"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              following: {
                type: "string",
                format: "at-uri",
                description: "if the actor follows this DID, this is the AT-URI of the follow record"
              },
              followedBy: {
                type: "string",
                format: "at-uri",
                description: "if the actor is followed by this DID, contains the AT-URI of the follow record"
              }
            }
          }
        }
      },
      AppBskyGraphFollow: {
        lexicon: 1,
        id: "app.bsky.graph.follow",
        defs: {
          main: {
            type: "record",
            description: "Record declaring a social 'follow' relationship of another account. Duplicate follows will be ignored by the AppView.",
            key: "tid",
            record: {
              type: "object",
              required: ["subject", "createdAt"],
              properties: {
                subject: {
                  type: "string",
                  format: "did"
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetActorStarterPacks: {
        lexicon: 1,
        id: "app.bsky.graph.getActorStarterPacks",
        defs: {
          main: {
            type: "query",
            description: "Get a list of starter packs created by the actor.",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["starterPacks"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  starterPacks: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.graph.defs#starterPackViewBasic"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetBlocks: {
        lexicon: 1,
        id: "app.bsky.graph.getBlocks",
        defs: {
          main: {
            type: "query",
            description: "Enumerates which accounts the requesting account is currently blocking. Requires auth.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["blocks"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  blocks: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetFollowers: {
        lexicon: 1,
        id: "app.bsky.graph.getFollowers",
        defs: {
          main: {
            type: "query",
            description: "Enumerates accounts which follow a specified account (actor).",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subject", "followers"],
                properties: {
                  subject: {
                    type: "ref",
                    ref: "lex:app.bsky.actor.defs#profileView"
                  },
                  cursor: {
                    type: "string"
                  },
                  followers: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetFollows: {
        lexicon: 1,
        id: "app.bsky.graph.getFollows",
        defs: {
          main: {
            type: "query",
            description: "Enumerates accounts which a specified account (actor) follows.",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subject", "follows"],
                properties: {
                  subject: {
                    type: "ref",
                    ref: "lex:app.bsky.actor.defs#profileView"
                  },
                  cursor: {
                    type: "string"
                  },
                  follows: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetKnownFollowers: {
        lexicon: 1,
        id: "app.bsky.graph.getKnownFollowers",
        defs: {
          main: {
            type: "query",
            description: "Enumerates accounts which follow a specified account (actor) and are followed by the viewer.",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subject", "followers"],
                properties: {
                  subject: {
                    type: "ref",
                    ref: "lex:app.bsky.actor.defs#profileView"
                  },
                  cursor: {
                    type: "string"
                  },
                  followers: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetList: {
        lexicon: 1,
        id: "app.bsky.graph.getList",
        defs: {
          main: {
            type: "query",
            description: "Gets a 'view' (with additional context) of a specified list.",
            parameters: {
              type: "params",
              required: ["list"],
              properties: {
                list: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) of the list record to hydrate."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["list", "items"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  list: {
                    type: "ref",
                    ref: "lex:app.bsky.graph.defs#listView"
                  },
                  items: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.graph.defs#listItemView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetListBlocks: {
        lexicon: 1,
        id: "app.bsky.graph.getListBlocks",
        defs: {
          main: {
            type: "query",
            description: "Get mod lists that the requesting account (actor) is blocking. Requires auth.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["lists"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  lists: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.graph.defs#listView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetListMutes: {
        lexicon: 1,
        id: "app.bsky.graph.getListMutes",
        defs: {
          main: {
            type: "query",
            description: "Enumerates mod lists that the requesting account (actor) currently has muted. Requires auth.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["lists"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  lists: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.graph.defs#listView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetLists: {
        lexicon: 1,
        id: "app.bsky.graph.getLists",
        defs: {
          main: {
            type: "query",
            description: "Enumerates the lists created by a specified account (actor).",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier",
                  description: "The account (actor) to enumerate lists from."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                },
                purposes: {
                  type: "array",
                  description: "Optional filter by list purpose. If not specified, all supported types are returned.",
                  items: {
                    type: "string",
                    knownValues: ["modlist", "curatelist"]
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["lists"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  lists: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.graph.defs#listView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetListsWithMembership: {
        lexicon: 1,
        id: "app.bsky.graph.getListsWithMembership",
        defs: {
          main: {
            type: "query",
            description: "Enumerates the lists created by the session user, and includes membership information about `actor` in those lists. Only supports curation and moderation lists (no reference lists, used in starter packs). Requires auth.",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier",
                  description: "The account (actor) to check for membership."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                },
                purposes: {
                  type: "array",
                  description: "Optional filter by list purpose. If not specified, all supported types are returned.",
                  items: {
                    type: "string",
                    knownValues: ["modlist", "curatelist"]
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["listsWithMembership"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  listsWithMembership: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.graph.getListsWithMembership#listWithMembership"
                    }
                  }
                }
              }
            }
          },
          listWithMembership: {
            description: "A list and an optional list item indicating membership of a target user to that list.",
            type: "object",
            required: ["list"],
            properties: {
              list: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#listView"
              },
              listItem: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#listItemView"
              }
            }
          }
        }
      },
      AppBskyGraphGetMutes: {
        lexicon: 1,
        id: "app.bsky.graph.getMutes",
        defs: {
          main: {
            type: "query",
            description: "Enumerates accounts that the requesting account (actor) currently has muted. Requires auth.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["mutes"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  mutes: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetRelationships: {
        lexicon: 1,
        id: "app.bsky.graph.getRelationships",
        defs: {
          main: {
            type: "query",
            description: "Enumerates public relationships between one account, and a list of other accounts. Does not require auth.",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier",
                  description: "Primary account requesting relationships for."
                },
                others: {
                  type: "array",
                  description: "List of 'other' accounts to be related back to the primary.",
                  maxLength: 30,
                  items: {
                    type: "string",
                    format: "at-identifier"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["relationships"],
                properties: {
                  actor: {
                    type: "string",
                    format: "did"
                  },
                  relationships: {
                    type: "array",
                    items: {
                      type: "union",
                      refs: [
                        "lex:app.bsky.graph.defs#relationship",
                        "lex:app.bsky.graph.defs#notFoundActor"
                      ]
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "ActorNotFound",
                description: "the primary actor at-identifier could not be resolved"
              }
            ]
          }
        }
      },
      AppBskyGraphGetStarterPack: {
        lexicon: 1,
        id: "app.bsky.graph.getStarterPack",
        defs: {
          main: {
            type: "query",
            description: "Gets a view of a starter pack.",
            parameters: {
              type: "params",
              required: ["starterPack"],
              properties: {
                starterPack: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) of the starter pack record."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["starterPack"],
                properties: {
                  starterPack: {
                    type: "ref",
                    ref: "lex:app.bsky.graph.defs#starterPackView"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetStarterPacks: {
        lexicon: 1,
        id: "app.bsky.graph.getStarterPacks",
        defs: {
          main: {
            type: "query",
            description: "Get views for a list of starter packs.",
            parameters: {
              type: "params",
              required: ["uris"],
              properties: {
                uris: {
                  type: "array",
                  items: {
                    type: "string",
                    format: "at-uri"
                  },
                  maxLength: 25
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["starterPacks"],
                properties: {
                  starterPacks: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.graph.defs#starterPackViewBasic"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphGetStarterPacksWithMembership: {
        lexicon: 1,
        id: "app.bsky.graph.getStarterPacksWithMembership",
        defs: {
          main: {
            type: "query",
            description: "Enumerates the starter packs created by the session user, and includes membership information about `actor` in those starter packs. Requires auth.",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier",
                  description: "The account (actor) to check for membership."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["starterPacksWithMembership"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  starterPacksWithMembership: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.graph.getStarterPacksWithMembership#starterPackWithMembership"
                    }
                  }
                }
              }
            }
          },
          starterPackWithMembership: {
            description: "A starter pack and an optional list item indicating membership of a target user to that starter pack.",
            type: "object",
            required: ["starterPack"],
            properties: {
              starterPack: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#starterPackView"
              },
              listItem: {
                type: "ref",
                ref: "lex:app.bsky.graph.defs#listItemView"
              }
            }
          }
        }
      },
      AppBskyGraphGetSuggestedFollowsByActor: {
        lexicon: 1,
        id: "app.bsky.graph.getSuggestedFollowsByActor",
        defs: {
          main: {
            type: "query",
            description: "Enumerates follows similar to a given account (actor). Expected use is to recommend additional accounts immediately after following one account.",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "at-identifier"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["suggestions"],
                properties: {
                  suggestions: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileView"
                    }
                  },
                  isFallback: {
                    type: "boolean",
                    description: "If true, response has fallen-back to generic results, and is not scoped using relativeToDid",
                    default: false
                  },
                  recId: {
                    type: "integer",
                    description: "Snowflake for this recommendation, use when submitting recommendation events."
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphList: {
        lexicon: 1,
        id: "app.bsky.graph.list",
        defs: {
          main: {
            type: "record",
            description: "Record representing a list of accounts (actors). Scope includes both moderation-oriented lists and curration-oriented lists.",
            key: "tid",
            record: {
              type: "object",
              required: ["name", "purpose", "createdAt"],
              properties: {
                purpose: {
                  type: "ref",
                  description: "Defines the purpose of the list (aka, moderation-oriented or curration-oriented)",
                  ref: "lex:app.bsky.graph.defs#listPurpose"
                },
                name: {
                  type: "string",
                  maxLength: 64,
                  minLength: 1,
                  description: "Display name for list; can not be empty."
                },
                description: {
                  type: "string",
                  maxGraphemes: 300,
                  maxLength: 3e3
                },
                descriptionFacets: {
                  type: "array",
                  items: {
                    type: "ref",
                    ref: "lex:app.bsky.richtext.facet"
                  }
                },
                avatar: {
                  type: "blob",
                  accept: ["image/png", "image/jpeg"],
                  maxSize: 1e6
                },
                labels: {
                  type: "union",
                  refs: ["lex:com.atproto.label.defs#selfLabels"]
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                }
              }
            }
          }
        }
      },
      AppBskyGraphListblock: {
        lexicon: 1,
        id: "app.bsky.graph.listblock",
        defs: {
          main: {
            type: "record",
            description: "Record representing a block relationship against an entire an entire list of accounts (actors).",
            key: "tid",
            record: {
              type: "object",
              required: ["subject", "createdAt"],
              properties: {
                subject: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) to the mod list record."
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                }
              }
            }
          }
        }
      },
      AppBskyGraphListitem: {
        lexicon: 1,
        id: "app.bsky.graph.listitem",
        defs: {
          main: {
            type: "record",
            description: "Record representing an account's inclusion on a specific list. The AppView will ignore duplicate listitem records.",
            key: "tid",
            record: {
              type: "object",
              required: ["subject", "list", "createdAt"],
              properties: {
                subject: {
                  type: "string",
                  format: "did",
                  description: "The account which is included on the list."
                },
                list: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) to the list record (app.bsky.graph.list)."
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                }
              }
            }
          }
        }
      },
      AppBskyGraphMuteActor: {
        lexicon: 1,
        id: "app.bsky.graph.muteActor",
        defs: {
          main: {
            type: "procedure",
            description: "Creates a mute relationship for the specified account. Mutes are private in Bluesky. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["actor"],
                properties: {
                  actor: {
                    type: "string",
                    format: "at-identifier"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphMuteActorList: {
        lexicon: 1,
        id: "app.bsky.graph.muteActorList",
        defs: {
          main: {
            type: "procedure",
            description: "Creates a mute relationship for the specified list of accounts. Mutes are private in Bluesky. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["list"],
                properties: {
                  list: {
                    type: "string",
                    format: "at-uri"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphMuteThread: {
        lexicon: 1,
        id: "app.bsky.graph.muteThread",
        defs: {
          main: {
            type: "procedure",
            description: "Mutes a thread preventing notifications from the thread and any of its children. Mutes are private in Bluesky. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["root"],
                properties: {
                  root: {
                    type: "string",
                    format: "at-uri"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphSearchStarterPacks: {
        lexicon: 1,
        id: "app.bsky.graph.searchStarterPacks",
        defs: {
          main: {
            type: "query",
            description: "Find starter packs matching search criteria. Does not require auth.",
            parameters: {
              type: "params",
              required: ["q"],
              properties: {
                q: {
                  type: "string",
                  description: "Search query string. Syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 25
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["starterPacks"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  starterPacks: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.graph.defs#starterPackViewBasic"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphStarterpack: {
        lexicon: 1,
        id: "app.bsky.graph.starterpack",
        defs: {
          main: {
            type: "record",
            description: "Record defining a starter pack of actors and feeds for new users.",
            key: "tid",
            record: {
              type: "object",
              required: ["name", "list", "createdAt"],
              properties: {
                name: {
                  type: "string",
                  maxGraphemes: 50,
                  maxLength: 500,
                  minLength: 1,
                  description: "Display name for starter pack; can not be empty."
                },
                description: {
                  type: "string",
                  maxGraphemes: 300,
                  maxLength: 3e3
                },
                descriptionFacets: {
                  type: "array",
                  items: {
                    type: "ref",
                    ref: "lex:app.bsky.richtext.facet"
                  }
                },
                list: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) to the list record."
                },
                feeds: {
                  type: "array",
                  maxLength: 3,
                  items: {
                    type: "ref",
                    ref: "lex:app.bsky.graph.starterpack#feedItem"
                  }
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                }
              }
            }
          },
          feedItem: {
            type: "object",
            required: ["uri"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              }
            }
          }
        }
      },
      AppBskyGraphUnmuteActor: {
        lexicon: 1,
        id: "app.bsky.graph.unmuteActor",
        defs: {
          main: {
            type: "procedure",
            description: "Unmutes the specified account. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["actor"],
                properties: {
                  actor: {
                    type: "string",
                    format: "at-identifier"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphUnmuteActorList: {
        lexicon: 1,
        id: "app.bsky.graph.unmuteActorList",
        defs: {
          main: {
            type: "procedure",
            description: "Unmutes the specified list of accounts. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["list"],
                properties: {
                  list: {
                    type: "string",
                    format: "at-uri"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphUnmuteThread: {
        lexicon: 1,
        id: "app.bsky.graph.unmuteThread",
        defs: {
          main: {
            type: "procedure",
            description: "Unmutes the specified thread. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["root"],
                properties: {
                  root: {
                    type: "string",
                    format: "at-uri"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyGraphVerification: {
        lexicon: 1,
        id: "app.bsky.graph.verification",
        defs: {
          main: {
            type: "record",
            description: "Record declaring a verification relationship between two accounts. Verifications are only considered valid by an app if issued by an account the app considers trusted.",
            key: "tid",
            record: {
              type: "object",
              required: ["subject", "handle", "displayName", "createdAt"],
              properties: {
                subject: {
                  description: "DID of the subject the verification applies to.",
                  type: "string",
                  format: "did"
                },
                handle: {
                  description: "Handle of the subject the verification applies to at the moment of verifying, which might not be the same at the time of viewing. The verification is only valid if the current handle matches the one at the time of verifying.",
                  type: "string",
                  format: "handle"
                },
                displayName: {
                  description: "Display name of the subject the verification applies to at the moment of verifying, which might not be the same at the time of viewing. The verification is only valid if the current displayName matches the one at the time of verifying.",
                  type: "string"
                },
                createdAt: {
                  description: "Date of when the verification was created.",
                  type: "string",
                  format: "datetime"
                }
              }
            }
          }
        }
      },
      AppBskyLabelerDefs: {
        lexicon: 1,
        id: "app.bsky.labeler.defs",
        defs: {
          labelerView: {
            type: "object",
            required: ["uri", "cid", "creator", "indexedAt"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              creator: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileView"
              },
              likeCount: {
                type: "integer",
                minimum: 0
              },
              viewer: {
                type: "ref",
                ref: "lex:app.bsky.labeler.defs#labelerViewerState"
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              }
            }
          },
          labelerViewDetailed: {
            type: "object",
            required: ["uri", "cid", "creator", "policies", "indexedAt"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              creator: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileView"
              },
              policies: {
                type: "ref",
                ref: "lex:app.bsky.labeler.defs#labelerPolicies"
              },
              likeCount: {
                type: "integer",
                minimum: 0
              },
              viewer: {
                type: "ref",
                ref: "lex:app.bsky.labeler.defs#labelerViewerState"
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              reasonTypes: {
                description: "The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed.",
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.moderation.defs#reasonType"
                }
              },
              subjectTypes: {
                description: "The set of subject types (account, record, etc) this service accepts reports on.",
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.moderation.defs#subjectType"
                }
              },
              subjectCollections: {
                type: "array",
                description: "Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type.",
                items: {
                  type: "string",
                  format: "nsid"
                }
              }
            }
          },
          labelerViewerState: {
            type: "object",
            properties: {
              like: {
                type: "string",
                format: "at-uri"
              }
            }
          },
          labelerPolicies: {
            type: "object",
            required: ["labelValues"],
            properties: {
              labelValues: {
                type: "array",
                description: "The label values which this labeler publishes. May include global or custom labels.",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#labelValue"
                }
              },
              labelValueDefinitions: {
                type: "array",
                description: "Label values created by this labeler and scoped exclusively to it. Labels defined here will override global label definitions for this labeler.",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#labelValueDefinition"
                }
              }
            }
          }
        }
      },
      AppBskyLabelerGetServices: {
        lexicon: 1,
        id: "app.bsky.labeler.getServices",
        defs: {
          main: {
            type: "query",
            description: "Get information about a list of labeler services.",
            parameters: {
              type: "params",
              required: ["dids"],
              properties: {
                dids: {
                  type: "array",
                  items: {
                    type: "string",
                    format: "did"
                  }
                },
                detailed: {
                  type: "boolean",
                  default: false
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["views"],
                properties: {
                  views: {
                    type: "array",
                    items: {
                      type: "union",
                      refs: [
                        "lex:app.bsky.labeler.defs#labelerView",
                        "lex:app.bsky.labeler.defs#labelerViewDetailed"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyLabelerService: {
        lexicon: 1,
        id: "app.bsky.labeler.service",
        defs: {
          main: {
            type: "record",
            description: "A declaration of the existence of labeler service.",
            key: "literal:self",
            record: {
              type: "object",
              required: ["policies", "createdAt"],
              properties: {
                policies: {
                  type: "ref",
                  ref: "lex:app.bsky.labeler.defs#labelerPolicies"
                },
                labels: {
                  type: "union",
                  refs: ["lex:com.atproto.label.defs#selfLabels"]
                },
                createdAt: {
                  type: "string",
                  format: "datetime"
                },
                reasonTypes: {
                  description: "The set of report reason 'codes' which are in-scope for this service to review and action. These usually align to policy categories. If not defined (distinct from empty array), all reason types are allowed.",
                  type: "array",
                  items: {
                    type: "ref",
                    ref: "lex:com.atproto.moderation.defs#reasonType"
                  }
                },
                subjectTypes: {
                  description: "The set of subject types (account, record, etc) this service accepts reports on.",
                  type: "array",
                  items: {
                    type: "ref",
                    ref: "lex:com.atproto.moderation.defs#subjectType"
                  }
                },
                subjectCollections: {
                  type: "array",
                  description: "Set of record types (collection NSIDs) which can be reported to this service. If not defined (distinct from empty array), default is any record type.",
                  items: {
                    type: "string",
                    format: "nsid"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyNotificationDeclaration: {
        lexicon: 1,
        id: "app.bsky.notification.declaration",
        defs: {
          main: {
            type: "record",
            description: "A declaration of the user's choices related to notifications that can be produced by them.",
            key: "literal:self",
            record: {
              type: "object",
              required: ["allowSubscriptions"],
              properties: {
                allowSubscriptions: {
                  type: "string",
                  description: "A declaration of the user's preference for allowing activity subscriptions from other users. Absence of a record implies 'followers'.",
                  knownValues: ["followers", "mutuals", "none"]
                }
              }
            }
          }
        }
      },
      AppBskyNotificationDefs: {
        lexicon: 1,
        id: "app.bsky.notification.defs",
        defs: {
          recordDeleted: {
            type: "object",
            properties: {}
          },
          chatPreference: {
            type: "object",
            required: ["include", "push"],
            properties: {
              include: {
                type: "string",
                knownValues: ["all", "accepted"]
              },
              push: {
                type: "boolean"
              }
            }
          },
          filterablePreference: {
            type: "object",
            required: ["include", "list", "push"],
            properties: {
              include: {
                type: "string",
                knownValues: ["all", "follows"]
              },
              list: {
                type: "boolean"
              },
              push: {
                type: "boolean"
              }
            }
          },
          preference: {
            type: "object",
            required: ["list", "push"],
            properties: {
              list: {
                type: "boolean"
              },
              push: {
                type: "boolean"
              }
            }
          },
          preferences: {
            type: "object",
            required: [
              "chat",
              "follow",
              "like",
              "likeViaRepost",
              "mention",
              "quote",
              "reply",
              "repost",
              "repostViaRepost",
              "starterpackJoined",
              "subscribedPost",
              "unverified",
              "verified"
            ],
            properties: {
              chat: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#chatPreference"
              },
              follow: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#filterablePreference"
              },
              like: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#filterablePreference"
              },
              likeViaRepost: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#filterablePreference"
              },
              mention: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#filterablePreference"
              },
              quote: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#filterablePreference"
              },
              reply: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#filterablePreference"
              },
              repost: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#filterablePreference"
              },
              repostViaRepost: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#filterablePreference"
              },
              starterpackJoined: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#preference"
              },
              subscribedPost: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#preference"
              },
              unverified: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#preference"
              },
              verified: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#preference"
              }
            }
          },
          activitySubscription: {
            type: "object",
            required: ["post", "reply"],
            properties: {
              post: {
                type: "boolean"
              },
              reply: {
                type: "boolean"
              }
            }
          },
          subjectActivitySubscription: {
            description: "Object used to store activity subscription data in stash.",
            type: "object",
            required: ["subject", "activitySubscription"],
            properties: {
              subject: {
                type: "string",
                format: "did"
              },
              activitySubscription: {
                type: "ref",
                ref: "lex:app.bsky.notification.defs#activitySubscription"
              }
            }
          }
        }
      },
      AppBskyNotificationGetPreferences: {
        lexicon: 1,
        id: "app.bsky.notification.getPreferences",
        defs: {
          main: {
            type: "query",
            description: "Get notification-related preferences for an account. Requires auth.",
            parameters: {
              type: "params",
              properties: {}
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["preferences"],
                properties: {
                  preferences: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#preferences"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyNotificationGetUnreadCount: {
        lexicon: 1,
        id: "app.bsky.notification.getUnreadCount",
        defs: {
          main: {
            type: "query",
            description: "Count the number of unread notifications for the requesting account. Requires auth.",
            parameters: {
              type: "params",
              properties: {
                priority: {
                  type: "boolean"
                },
                seenAt: {
                  type: "string",
                  format: "datetime"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["count"],
                properties: {
                  count: {
                    type: "integer"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyNotificationListActivitySubscriptions: {
        lexicon: 1,
        id: "app.bsky.notification.listActivitySubscriptions",
        defs: {
          main: {
            type: "query",
            description: "Enumerate all accounts to which the requesting account is subscribed to receive notifications for. Requires auth.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subscriptions"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  subscriptions: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyNotificationListNotifications: {
        lexicon: 1,
        id: "app.bsky.notification.listNotifications",
        defs: {
          main: {
            type: "query",
            description: "Enumerate notifications for the requesting account. Requires auth.",
            parameters: {
              type: "params",
              properties: {
                reasons: {
                  description: "Notification reasons to include in response.",
                  type: "array",
                  items: {
                    type: "string",
                    description: "A reason that matches the reason property of #notification."
                  }
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                priority: {
                  type: "boolean"
                },
                cursor: {
                  type: "string"
                },
                seenAt: {
                  type: "string",
                  format: "datetime"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["notifications"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  notifications: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.notification.listNotifications#notification"
                    }
                  },
                  priority: {
                    type: "boolean"
                  },
                  seenAt: {
                    type: "string",
                    format: "datetime"
                  }
                }
              }
            }
          },
          notification: {
            type: "object",
            required: [
              "uri",
              "cid",
              "author",
              "reason",
              "record",
              "isRead",
              "indexedAt"
            ],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              author: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileView"
              },
              reason: {
                type: "string",
                description: "The reason why this notification was delivered - e.g. your post was liked, or you received a new follower.",
                knownValues: [
                  "like",
                  "repost",
                  "follow",
                  "mention",
                  "reply",
                  "quote",
                  "starterpack-joined",
                  "verified",
                  "unverified",
                  "like-via-repost",
                  "repost-via-repost",
                  "subscribed-post"
                ]
              },
              reasonSubject: {
                type: "string",
                format: "at-uri"
              },
              record: {
                type: "unknown"
              },
              isRead: {
                type: "boolean"
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              }
            }
          }
        }
      },
      AppBskyNotificationPutActivitySubscription: {
        lexicon: 1,
        id: "app.bsky.notification.putActivitySubscription",
        defs: {
          main: {
            type: "procedure",
            description: "Puts an activity subscription entry. The key should be omitted for creation and provided for updates. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subject", "activitySubscription"],
                properties: {
                  subject: {
                    type: "string",
                    format: "did"
                  },
                  activitySubscription: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#activitySubscription"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subject"],
                properties: {
                  subject: {
                    type: "string",
                    format: "did"
                  },
                  activitySubscription: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#activitySubscription"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyNotificationPutPreferences: {
        lexicon: 1,
        id: "app.bsky.notification.putPreferences",
        defs: {
          main: {
            type: "procedure",
            description: "Set notification-related preferences for an account. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["priority"],
                properties: {
                  priority: {
                    type: "boolean"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyNotificationPutPreferencesV2: {
        lexicon: 1,
        id: "app.bsky.notification.putPreferencesV2",
        defs: {
          main: {
            type: "procedure",
            description: "Set notification-related preferences for an account. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  chat: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#chatPreference"
                  },
                  follow: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#filterablePreference"
                  },
                  like: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#filterablePreference"
                  },
                  likeViaRepost: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#filterablePreference"
                  },
                  mention: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#filterablePreference"
                  },
                  quote: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#filterablePreference"
                  },
                  reply: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#filterablePreference"
                  },
                  repost: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#filterablePreference"
                  },
                  repostViaRepost: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#filterablePreference"
                  },
                  starterpackJoined: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#preference"
                  },
                  subscribedPost: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#preference"
                  },
                  unverified: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#preference"
                  },
                  verified: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#preference"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["preferences"],
                properties: {
                  preferences: {
                    type: "ref",
                    ref: "lex:app.bsky.notification.defs#preferences"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyNotificationRegisterPush: {
        lexicon: 1,
        id: "app.bsky.notification.registerPush",
        defs: {
          main: {
            type: "procedure",
            description: "Register to receive push notifications, via a specified service, for the requesting account. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["serviceDid", "token", "platform", "appId"],
                properties: {
                  serviceDid: {
                    type: "string",
                    format: "did"
                  },
                  token: {
                    type: "string"
                  },
                  platform: {
                    type: "string",
                    knownValues: ["ios", "android", "web"]
                  },
                  appId: {
                    type: "string"
                  },
                  ageRestricted: {
                    type: "boolean",
                    description: "Set to true when the actor is age restricted"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyNotificationUnregisterPush: {
        lexicon: 1,
        id: "app.bsky.notification.unregisterPush",
        defs: {
          main: {
            type: "procedure",
            description: "The inverse of registerPush - inform a specified service that push notifications should no longer be sent to the given token for the requesting account. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["serviceDid", "token", "platform", "appId"],
                properties: {
                  serviceDid: {
                    type: "string",
                    format: "did"
                  },
                  token: {
                    type: "string"
                  },
                  platform: {
                    type: "string",
                    knownValues: ["ios", "android", "web"]
                  },
                  appId: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyNotificationUpdateSeen: {
        lexicon: 1,
        id: "app.bsky.notification.updateSeen",
        defs: {
          main: {
            type: "procedure",
            description: "Notify server that the requesting account has seen notifications. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["seenAt"],
                properties: {
                  seenAt: {
                    type: "string",
                    format: "datetime"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyRichtextFacet: {
        lexicon: 1,
        id: "app.bsky.richtext.facet",
        defs: {
          main: {
            type: "object",
            description: "Annotation of a sub-string within rich text.",
            required: ["index", "features"],
            properties: {
              index: {
                type: "ref",
                ref: "lex:app.bsky.richtext.facet#byteSlice"
              },
              features: {
                type: "array",
                items: {
                  type: "union",
                  refs: [
                    "lex:app.bsky.richtext.facet#mention",
                    "lex:app.bsky.richtext.facet#link",
                    "lex:app.bsky.richtext.facet#tag"
                  ]
                }
              }
            }
          },
          mention: {
            type: "object",
            description: "Facet feature for mention of another account. The text is usually a handle, including a '@' prefix, but the facet reference is a DID.",
            required: ["did"],
            properties: {
              did: {
                type: "string",
                format: "did"
              }
            }
          },
          link: {
            type: "object",
            description: "Facet feature for a URL. The text URL may have been simplified or truncated, but the facet reference should be a complete URL.",
            required: ["uri"],
            properties: {
              uri: {
                type: "string",
                format: "uri"
              }
            }
          },
          tag: {
            type: "object",
            description: "Facet feature for a hashtag. The text usually includes a '#' prefix, but the facet reference should not (except in the case of 'double hash tags').",
            required: ["tag"],
            properties: {
              tag: {
                type: "string",
                maxLength: 640,
                maxGraphemes: 64
              }
            }
          },
          byteSlice: {
            type: "object",
            description: "Specifies the sub-string range a facet feature applies to. Start index is inclusive, end index is exclusive. Indices are zero-indexed, counting bytes of the UTF-8 encoded text. NOTE: some languages, like Javascript, use UTF-16 or Unicode codepoints for string slice indexing; in these languages, convert to byte arrays before working with facets.",
            required: ["byteStart", "byteEnd"],
            properties: {
              byteStart: {
                type: "integer",
                minimum: 0
              },
              byteEnd: {
                type: "integer",
                minimum: 0
              }
            }
          }
        }
      },
      AppBskyUnspeccedDefs: {
        lexicon: 1,
        id: "app.bsky.unspecced.defs",
        defs: {
          skeletonSearchPost: {
            type: "object",
            required: ["uri"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              }
            }
          },
          skeletonSearchActor: {
            type: "object",
            required: ["did"],
            properties: {
              did: {
                type: "string",
                format: "did"
              }
            }
          },
          skeletonSearchStarterPack: {
            type: "object",
            required: ["uri"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              }
            }
          },
          trendingTopic: {
            type: "object",
            required: ["topic", "link"],
            properties: {
              topic: {
                type: "string"
              },
              displayName: {
                type: "string"
              },
              description: {
                type: "string"
              },
              link: {
                type: "string"
              }
            }
          },
          skeletonTrend: {
            type: "object",
            required: [
              "topic",
              "displayName",
              "link",
              "startedAt",
              "postCount",
              "dids"
            ],
            properties: {
              topic: {
                type: "string"
              },
              displayName: {
                type: "string"
              },
              link: {
                type: "string"
              },
              startedAt: {
                type: "string",
                format: "datetime"
              },
              postCount: {
                type: "integer"
              },
              status: {
                type: "string",
                knownValues: ["hot"]
              },
              category: {
                type: "string"
              },
              dids: {
                type: "array",
                items: {
                  type: "string",
                  format: "did"
                }
              }
            }
          },
          trendView: {
            type: "object",
            required: [
              "topic",
              "displayName",
              "link",
              "startedAt",
              "postCount",
              "actors"
            ],
            properties: {
              topic: {
                type: "string"
              },
              displayName: {
                type: "string"
              },
              link: {
                type: "string"
              },
              startedAt: {
                type: "string",
                format: "datetime"
              },
              postCount: {
                type: "integer"
              },
              status: {
                type: "string",
                knownValues: ["hot"]
              },
              category: {
                type: "string"
              },
              actors: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.actor.defs#profileViewBasic"
                }
              }
            }
          },
          threadItemPost: {
            type: "object",
            required: [
              "post",
              "moreParents",
              "moreReplies",
              "opThread",
              "hiddenByThreadgate",
              "mutedByViewer"
            ],
            properties: {
              post: {
                type: "ref",
                ref: "lex:app.bsky.feed.defs#postView"
              },
              moreParents: {
                type: "boolean",
                description: "This post has more parents that were not present in the response. This is just a boolean, without the number of parents."
              },
              moreReplies: {
                type: "integer",
                description: "This post has more replies that were not present in the response. This is a numeric value, which is best-effort and might not be accurate."
              },
              opThread: {
                type: "boolean",
                description: "This post is part of a contiguous thread by the OP from the thread root. Many different OP threads can happen in the same thread."
              },
              hiddenByThreadgate: {
                type: "boolean",
                description: "The threadgate created by the author indicates this post as a reply to be hidden for everyone consuming the thread."
              },
              mutedByViewer: {
                type: "boolean",
                description: "This is by an account muted by the viewer requesting it."
              }
            }
          },
          threadItemNoUnauthenticated: {
            type: "object",
            properties: {}
          },
          threadItemNotFound: {
            type: "object",
            properties: {}
          },
          threadItemBlocked: {
            type: "object",
            required: ["author"],
            properties: {
              author: {
                type: "ref",
                ref: "lex:app.bsky.feed.defs#blockedAuthor"
              }
            }
          },
          ageAssuranceState: {
            type: "object",
            description: "The computed state of the age assurance process, returned to the user in question on certain authenticated requests.",
            required: ["status"],
            properties: {
              lastInitiatedAt: {
                type: "string",
                format: "datetime",
                description: "The timestamp when this state was last updated."
              },
              status: {
                type: "string",
                description: "The status of the age assurance process.",
                knownValues: ["unknown", "pending", "assured", "blocked"]
              }
            }
          },
          ageAssuranceEvent: {
            type: "object",
            description: "Object used to store age assurance data in stash.",
            required: ["createdAt", "status", "attemptId"],
            properties: {
              createdAt: {
                type: "string",
                format: "datetime",
                description: "The date and time of this write operation."
              },
              status: {
                type: "string",
                description: "The status of the age assurance process.",
                knownValues: ["unknown", "pending", "assured"]
              },
              attemptId: {
                type: "string",
                description: "The unique identifier for this instance of the age assurance flow, in UUID format."
              },
              email: {
                type: "string",
                description: "The email used for AA."
              },
              initIp: {
                type: "string",
                description: "The IP address used when initiating the AA flow."
              },
              initUa: {
                type: "string",
                description: "The user agent used when initiating the AA flow."
              },
              completeIp: {
                type: "string",
                description: "The IP address used when completing the AA flow."
              },
              completeUa: {
                type: "string",
                description: "The user agent used when completing the AA flow."
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetAgeAssuranceState: {
        lexicon: 1,
        id: "app.bsky.unspecced.getAgeAssuranceState",
        defs: {
          main: {
            type: "query",
            description: "Returns the current state of the age assurance process for an account. This is used to check if the user has completed age assurance or if further action is required.",
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:app.bsky.unspecced.defs#ageAssuranceState"
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetConfig: {
        lexicon: 1,
        id: "app.bsky.unspecced.getConfig",
        defs: {
          main: {
            type: "query",
            description: "Get miscellaneous runtime configuration.",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: [],
                properties: {
                  checkEmailConfirmed: {
                    type: "boolean"
                  },
                  liveNow: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.getConfig#liveNowConfig"
                    }
                  }
                }
              }
            }
          },
          liveNowConfig: {
            type: "object",
            required: ["did", "domains"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              domains: {
                type: "array",
                items: {
                  type: "string"
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetPopularFeedGenerators: {
        lexicon: 1,
        id: "app.bsky.unspecced.getPopularFeedGenerators",
        defs: {
          main: {
            type: "query",
            description: "An unspecced view of globally popular feed generators.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                },
                query: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feeds"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  feeds: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#generatorView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetPostThreadOtherV2: {
        lexicon: 1,
        id: "app.bsky.unspecced.getPostThreadOtherV2",
        defs: {
          main: {
            type: "query",
            description: "(NOTE: this endpoint is under development and WILL change without notice. Don't use it until it is moved out of `unspecced` or your application WILL break) Get additional posts under a thread e.g. replies hidden by threadgate. Based on an anchor post at any depth of the tree, returns top-level replies below that anchor. It does not include ancestors nor the anchor itself. This should be called after exhausting `app.bsky.unspecced.getPostThreadV2`. Does not require auth, but additional metadata and filtering will be applied for authed requests.",
            parameters: {
              type: "params",
              required: ["anchor"],
              properties: {
                anchor: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) to post record. This is the anchor post."
                },
                prioritizeFollowedUsers: {
                  type: "boolean",
                  description: "Whether to prioritize posts from followed users. It only has effect when the user is authenticated.",
                  default: false
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["thread"],
                properties: {
                  thread: {
                    type: "array",
                    description: "A flat list of other thread items. The depth of each item is indicated by the depth property inside the item.",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.getPostThreadOtherV2#threadItem"
                    }
                  }
                }
              }
            }
          },
          threadItem: {
            type: "object",
            required: ["uri", "depth", "value"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              depth: {
                type: "integer",
                description: "The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths."
              },
              value: {
                type: "union",
                refs: ["lex:app.bsky.unspecced.defs#threadItemPost"]
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetPostThreadV2: {
        lexicon: 1,
        id: "app.bsky.unspecced.getPostThreadV2",
        defs: {
          main: {
            type: "query",
            description: "(NOTE: this endpoint is under development and WILL change without notice. Don't use it until it is moved out of `unspecced` or your application WILL break) Get posts in a thread. It is based in an anchor post at any depth of the tree, and returns posts above it (recursively resolving the parent, without further branching to their replies) and below it (recursive replies, with branching to their replies). Does not require auth, but additional metadata and filtering will be applied for authed requests.",
            parameters: {
              type: "params",
              required: ["anchor"],
              properties: {
                anchor: {
                  type: "string",
                  format: "at-uri",
                  description: "Reference (AT-URI) to post record. This is the anchor post, and the thread will be built around it. It can be any post in the tree, not necessarily a root post."
                },
                above: {
                  type: "boolean",
                  description: "Whether to include parents above the anchor.",
                  default: true
                },
                below: {
                  type: "integer",
                  description: "How many levels of replies to include below the anchor.",
                  default: 6,
                  minimum: 0,
                  maximum: 20
                },
                branchingFactor: {
                  type: "integer",
                  description: "Maximum of replies to include at each level of the thread, except for the direct replies to the anchor, which are (NOTE: currently, during unspecced phase) all returned (NOTE: later they might be paginated).",
                  default: 10,
                  minimum: 0,
                  maximum: 100
                },
                prioritizeFollowedUsers: {
                  type: "boolean",
                  description: "Whether to prioritize posts from followed users. It only has effect when the user is authenticated.",
                  default: false
                },
                sort: {
                  type: "string",
                  description: "Sorting for the thread replies.",
                  knownValues: ["newest", "oldest", "top"],
                  default: "oldest"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["thread", "hasOtherReplies"],
                properties: {
                  thread: {
                    type: "array",
                    description: "A flat list of thread items. The depth of each item is indicated by the depth property inside the item.",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.getPostThreadV2#threadItem"
                    }
                  },
                  threadgate: {
                    type: "ref",
                    ref: "lex:app.bsky.feed.defs#threadgateView"
                  },
                  hasOtherReplies: {
                    type: "boolean",
                    description: "Whether this thread has additional replies. If true, a call can be made to the `getPostThreadOtherV2` endpoint to retrieve them."
                  }
                }
              }
            }
          },
          threadItem: {
            type: "object",
            required: ["uri", "depth", "value"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              depth: {
                type: "integer",
                description: "The nesting level of this item in the thread. Depth 0 means the anchor item. Items above have negative depths, items below have positive depths."
              },
              value: {
                type: "union",
                refs: [
                  "lex:app.bsky.unspecced.defs#threadItemPost",
                  "lex:app.bsky.unspecced.defs#threadItemNoUnauthenticated",
                  "lex:app.bsky.unspecced.defs#threadItemNotFound",
                  "lex:app.bsky.unspecced.defs#threadItemBlocked"
                ]
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetSuggestedFeeds: {
        lexicon: 1,
        id: "app.bsky.unspecced.getSuggestedFeeds",
        defs: {
          main: {
            type: "query",
            description: "Get a list of suggested feeds",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 25,
                  default: 10
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feeds"],
                properties: {
                  feeds: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.feed.defs#generatorView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetSuggestedFeedsSkeleton: {
        lexicon: 1,
        id: "app.bsky.unspecced.getSuggestedFeedsSkeleton",
        defs: {
          main: {
            type: "query",
            description: "Get a skeleton of suggested feeds. Intended to be called and hydrated by app.bsky.unspecced.getSuggestedFeeds",
            parameters: {
              type: "params",
              properties: {
                viewer: {
                  type: "string",
                  format: "did",
                  description: "DID of the account making the request (not included for public/unauthenticated queries)."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 25,
                  default: 10
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["feeds"],
                properties: {
                  feeds: {
                    type: "array",
                    items: {
                      type: "string",
                      format: "at-uri"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetSuggestedStarterPacks: {
        lexicon: 1,
        id: "app.bsky.unspecced.getSuggestedStarterPacks",
        defs: {
          main: {
            type: "query",
            description: "Get a list of suggested starterpacks",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 25,
                  default: 10
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["starterPacks"],
                properties: {
                  starterPacks: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.graph.defs#starterPackView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetSuggestedStarterPacksSkeleton: {
        lexicon: 1,
        id: "app.bsky.unspecced.getSuggestedStarterPacksSkeleton",
        defs: {
          main: {
            type: "query",
            description: "Get a skeleton of suggested starterpacks. Intended to be called and hydrated by app.bsky.unspecced.getSuggestedStarterpacks",
            parameters: {
              type: "params",
              properties: {
                viewer: {
                  type: "string",
                  format: "did",
                  description: "DID of the account making the request (not included for public/unauthenticated queries)."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 25,
                  default: 10
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["starterPacks"],
                properties: {
                  starterPacks: {
                    type: "array",
                    items: {
                      type: "string",
                      format: "at-uri"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetSuggestedUsers: {
        lexicon: 1,
        id: "app.bsky.unspecced.getSuggestedUsers",
        defs: {
          main: {
            type: "query",
            description: "Get a list of suggested users",
            parameters: {
              type: "params",
              properties: {
                category: {
                  type: "string",
                  description: "Category of users to get suggestions for."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 50,
                  default: 25
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["actors"],
                properties: {
                  actors: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.actor.defs#profileView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetSuggestedUsersSkeleton: {
        lexicon: 1,
        id: "app.bsky.unspecced.getSuggestedUsersSkeleton",
        defs: {
          main: {
            type: "query",
            description: "Get a skeleton of suggested users. Intended to be called and hydrated by app.bsky.unspecced.getSuggestedUsers",
            parameters: {
              type: "params",
              properties: {
                viewer: {
                  type: "string",
                  format: "did",
                  description: "DID of the account making the request (not included for public/unauthenticated queries)."
                },
                category: {
                  type: "string",
                  description: "Category of users to get suggestions for."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 50,
                  default: 25
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["dids"],
                properties: {
                  dids: {
                    type: "array",
                    items: {
                      type: "string",
                      format: "did"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetSuggestionsSkeleton: {
        lexicon: 1,
        id: "app.bsky.unspecced.getSuggestionsSkeleton",
        defs: {
          main: {
            type: "query",
            description: "Get a skeleton of suggested actors. Intended to be called and then hydrated through app.bsky.actor.getSuggestions",
            parameters: {
              type: "params",
              properties: {
                viewer: {
                  type: "string",
                  format: "did",
                  description: "DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                },
                relativeToDid: {
                  type: "string",
                  format: "did",
                  description: "DID of the account to get suggestions relative to. If not provided, suggestions will be based on the viewer."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["actors"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  actors: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.defs#skeletonSearchActor"
                    }
                  },
                  relativeToDid: {
                    type: "string",
                    format: "did",
                    description: "DID of the account these suggestions are relative to. If this is returned undefined, suggestions are based on the viewer."
                  },
                  recId: {
                    type: "integer",
                    description: "Snowflake for this recommendation, use when submitting recommendation events."
                  }
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetTaggedSuggestions: {
        lexicon: 1,
        id: "app.bsky.unspecced.getTaggedSuggestions",
        defs: {
          main: {
            type: "query",
            description: "Get a list of suggestions (feeds and users) tagged with categories",
            parameters: {
              type: "params",
              properties: {}
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["suggestions"],
                properties: {
                  suggestions: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.getTaggedSuggestions#suggestion"
                    }
                  }
                }
              }
            }
          },
          suggestion: {
            type: "object",
            required: ["tag", "subjectType", "subject"],
            properties: {
              tag: {
                type: "string"
              },
              subjectType: {
                type: "string",
                knownValues: ["actor", "feed"]
              },
              subject: {
                type: "string",
                format: "uri"
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetTrendingTopics: {
        lexicon: 1,
        id: "app.bsky.unspecced.getTrendingTopics",
        defs: {
          main: {
            type: "query",
            description: "Get a list of trending topics",
            parameters: {
              type: "params",
              properties: {
                viewer: {
                  type: "string",
                  format: "did",
                  description: "DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 25,
                  default: 10
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["topics", "suggested"],
                properties: {
                  topics: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.defs#trendingTopic"
                    }
                  },
                  suggested: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.defs#trendingTopic"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetTrends: {
        lexicon: 1,
        id: "app.bsky.unspecced.getTrends",
        defs: {
          main: {
            type: "query",
            description: "Get the current trends on the network",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 25,
                  default: 10
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["trends"],
                properties: {
                  trends: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.defs#trendView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedGetTrendsSkeleton: {
        lexicon: 1,
        id: "app.bsky.unspecced.getTrendsSkeleton",
        defs: {
          main: {
            type: "query",
            description: "Get the skeleton of trends on the network. Intended to be called and then hydrated through app.bsky.unspecced.getTrends",
            parameters: {
              type: "params",
              properties: {
                viewer: {
                  type: "string",
                  format: "did",
                  description: "DID of the account making the request (not included for public/unauthenticated queries)."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 25,
                  default: 10
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["trends"],
                properties: {
                  trends: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.defs#skeletonTrend"
                    }
                  }
                }
              }
            }
          }
        }
      },
      AppBskyUnspeccedInitAgeAssurance: {
        lexicon: 1,
        id: "app.bsky.unspecced.initAgeAssurance",
        defs: {
          main: {
            type: "procedure",
            description: "Initiate age assurance for an account. This is a one-time action that will start the process of verifying the user's age.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["email", "language", "countryCode"],
                properties: {
                  email: {
                    type: "string",
                    description: "The user's email address to receive assurance instructions."
                  },
                  language: {
                    type: "string",
                    description: "The user's preferred language for communication during the assurance process."
                  },
                  countryCode: {
                    type: "string",
                    description: "An ISO 3166-1 alpha-2 code of the user's location."
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:app.bsky.unspecced.defs#ageAssuranceState"
              }
            },
            errors: [
              {
                name: "InvalidEmail"
              },
              {
                name: "DidTooLong"
              },
              {
                name: "InvalidInitiation"
              }
            ]
          }
        }
      },
      AppBskyUnspeccedSearchActorsSkeleton: {
        lexicon: 1,
        id: "app.bsky.unspecced.searchActorsSkeleton",
        defs: {
          main: {
            type: "query",
            description: "Backend Actors (profile) search, returns only skeleton.",
            parameters: {
              type: "params",
              required: ["q"],
              properties: {
                q: {
                  type: "string",
                  description: "Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended. For typeahead search, only simple term match is supported, not full syntax."
                },
                viewer: {
                  type: "string",
                  format: "did",
                  description: "DID of the account making the request (not included for public/unauthenticated queries). Used to boost followed accounts in ranking."
                },
                typeahead: {
                  type: "boolean",
                  description: "If true, acts as fast/simple 'typeahead' query."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 25
                },
                cursor: {
                  type: "string",
                  description: "Optional pagination mechanism; may not necessarily allow scrolling through entire result set."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["actors"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  hitsTotal: {
                    type: "integer",
                    description: "Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits."
                  },
                  actors: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.defs#skeletonSearchActor"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "BadQueryString"
              }
            ]
          }
        }
      },
      AppBskyUnspeccedSearchPostsSkeleton: {
        lexicon: 1,
        id: "app.bsky.unspecced.searchPostsSkeleton",
        defs: {
          main: {
            type: "query",
            description: "Backend Posts search, returns only skeleton",
            parameters: {
              type: "params",
              required: ["q"],
              properties: {
                q: {
                  type: "string",
                  description: "Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended."
                },
                sort: {
                  type: "string",
                  knownValues: ["top", "latest"],
                  default: "latest",
                  description: "Specifies the ranking order of results."
                },
                since: {
                  type: "string",
                  description: "Filter results for posts after the indicated datetime (inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYYY-MM-DD)."
                },
                until: {
                  type: "string",
                  description: "Filter results for posts before the indicated datetime (not inclusive). Expected to use 'sortAt' timestamp, which may not match 'createdAt'. Can be a datetime, or just an ISO date (YYY-MM-DD)."
                },
                mentions: {
                  type: "string",
                  format: "at-identifier",
                  description: "Filter to posts which mention the given account. Handles are resolved to DID before query-time. Only matches rich-text facet mentions."
                },
                author: {
                  type: "string",
                  format: "at-identifier",
                  description: "Filter to posts by the given account. Handles are resolved to DID before query-time."
                },
                lang: {
                  type: "string",
                  format: "language",
                  description: "Filter to posts in the given language. Expected to be based on post language field, though server may override language detection."
                },
                domain: {
                  type: "string",
                  description: "Filter to posts with URLs (facet links or embeds) linking to the given domain (hostname). Server may apply hostname normalization."
                },
                url: {
                  type: "string",
                  format: "uri",
                  description: "Filter to posts with links (facet links or embeds) pointing to this URL. Server may apply URL normalization or fuzzy matching."
                },
                tag: {
                  type: "array",
                  items: {
                    type: "string",
                    maxLength: 640,
                    maxGraphemes: 64
                  },
                  description: "Filter to posts with the given tag (hashtag), based on rich-text facet or tag field. Do not include the hash (#) prefix. Multiple tags can be specified, with 'AND' matching."
                },
                viewer: {
                  type: "string",
                  format: "did",
                  description: "DID of the account making the request (not included for public/unauthenticated queries). Used for 'from:me' queries."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 25
                },
                cursor: {
                  type: "string",
                  description: "Optional pagination mechanism; may not necessarily allow scrolling through entire result set."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["posts"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  hitsTotal: {
                    type: "integer",
                    description: "Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits."
                  },
                  posts: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.defs#skeletonSearchPost"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "BadQueryString"
              }
            ]
          }
        }
      },
      AppBskyUnspeccedSearchStarterPacksSkeleton: {
        lexicon: 1,
        id: "app.bsky.unspecced.searchStarterPacksSkeleton",
        defs: {
          main: {
            type: "query",
            description: "Backend Starter Pack search, returns only skeleton.",
            parameters: {
              type: "params",
              required: ["q"],
              properties: {
                q: {
                  type: "string",
                  description: "Search query string; syntax, phrase, boolean, and faceting is unspecified, but Lucene query syntax is recommended."
                },
                viewer: {
                  type: "string",
                  format: "did",
                  description: "DID of the account making the request (not included for public/unauthenticated queries)."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 25
                },
                cursor: {
                  type: "string",
                  description: "Optional pagination mechanism; may not necessarily allow scrolling through entire result set."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["starterPacks"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  hitsTotal: {
                    type: "integer",
                    description: "Count of search hits. Optional, may be rounded/truncated, and may not be possible to paginate through all hits."
                  },
                  starterPacks: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:app.bsky.unspecced.defs#skeletonSearchStarterPack"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "BadQueryString"
              }
            ]
          }
        }
      },
      AppBskyVideoDefs: {
        lexicon: 1,
        id: "app.bsky.video.defs",
        defs: {
          jobStatus: {
            type: "object",
            required: ["jobId", "did", "state"],
            properties: {
              jobId: {
                type: "string"
              },
              did: {
                type: "string",
                format: "did"
              },
              state: {
                type: "string",
                description: "The state of the video processing job. All values not listed as a known value indicate that the job is in process.",
                knownValues: ["JOB_STATE_COMPLETED", "JOB_STATE_FAILED"]
              },
              progress: {
                type: "integer",
                minimum: 0,
                maximum: 100,
                description: "Progress within the current processing state."
              },
              blob: {
                type: "blob"
              },
              error: {
                type: "string"
              },
              message: {
                type: "string"
              }
            }
          }
        }
      },
      AppBskyVideoGetJobStatus: {
        lexicon: 1,
        id: "app.bsky.video.getJobStatus",
        defs: {
          main: {
            type: "query",
            description: "Get status details for a video processing job.",
            parameters: {
              type: "params",
              required: ["jobId"],
              properties: {
                jobId: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["jobStatus"],
                properties: {
                  jobStatus: {
                    type: "ref",
                    ref: "lex:app.bsky.video.defs#jobStatus"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyVideoGetUploadLimits: {
        lexicon: 1,
        id: "app.bsky.video.getUploadLimits",
        defs: {
          main: {
            type: "query",
            description: "Get video upload limits for the authenticated user.",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["canUpload"],
                properties: {
                  canUpload: {
                    type: "boolean"
                  },
                  remainingDailyVideos: {
                    type: "integer"
                  },
                  remainingDailyBytes: {
                    type: "integer"
                  },
                  message: {
                    type: "string"
                  },
                  error: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      AppBskyVideoUploadVideo: {
        lexicon: 1,
        id: "app.bsky.video.uploadVideo",
        defs: {
          main: {
            type: "procedure",
            description: "Upload a video to be processed then stored on the PDS.",
            input: {
              encoding: "video/mp4"
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["jobStatus"],
                properties: {
                  jobStatus: {
                    type: "ref",
                    ref: "lex:app.bsky.video.defs#jobStatus"
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyActorDeclaration: {
        lexicon: 1,
        id: "chat.bsky.actor.declaration",
        defs: {
          main: {
            type: "record",
            description: "A declaration of a Bluesky chat account.",
            key: "literal:self",
            record: {
              type: "object",
              required: ["allowIncoming"],
              properties: {
                allowIncoming: {
                  type: "string",
                  knownValues: ["all", "none", "following"]
                }
              }
            }
          }
        }
      },
      ChatBskyActorDefs: {
        lexicon: 1,
        id: "chat.bsky.actor.defs",
        defs: {
          profileViewBasic: {
            type: "object",
            required: ["did", "handle"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              handle: {
                type: "string",
                format: "handle"
              },
              displayName: {
                type: "string",
                maxGraphemes: 64,
                maxLength: 640
              },
              avatar: {
                type: "string",
                format: "uri"
              },
              associated: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileAssociated"
              },
              viewer: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#viewerState"
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              chatDisabled: {
                type: "boolean",
                description: "Set to true when the actor cannot actively participate in conversations"
              },
              verification: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#verificationState"
              }
            }
          }
        }
      },
      ChatBskyActorDeleteAccount: {
        lexicon: 1,
        id: "chat.bsky.actor.deleteAccount",
        defs: {
          main: {
            type: "procedure",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {}
              }
            }
          }
        }
      },
      ChatBskyActorExportAccountData: {
        lexicon: 1,
        id: "chat.bsky.actor.exportAccountData",
        defs: {
          main: {
            type: "query",
            output: {
              encoding: "application/jsonl"
            }
          }
        }
      },
      ChatBskyConvoAcceptConvo: {
        lexicon: 1,
        id: "chat.bsky.convo.acceptConvo",
        defs: {
          main: {
            type: "procedure",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convoId"],
                properties: {
                  convoId: {
                    type: "string"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  rev: {
                    description: "Rev when the convo was accepted. If not present, the convo was already accepted.",
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyConvoAddReaction: {
        lexicon: 1,
        id: "chat.bsky.convo.addReaction",
        defs: {
          main: {
            type: "procedure",
            description: "Adds an emoji reaction to a message. Requires authentication. It is idempotent, so multiple calls from the same user with the same emoji result in a single reaction.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convoId", "messageId", "value"],
                properties: {
                  convoId: {
                    type: "string"
                  },
                  messageId: {
                    type: "string"
                  },
                  value: {
                    type: "string",
                    minLength: 1,
                    maxLength: 64,
                    minGraphemes: 1,
                    maxGraphemes: 1
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["message"],
                properties: {
                  message: {
                    type: "ref",
                    ref: "lex:chat.bsky.convo.defs#messageView"
                  }
                }
              }
            },
            errors: [
              {
                name: "ReactionMessageDeleted",
                description: "Indicates that the message has been deleted and reactions can no longer be added/removed."
              },
              {
                name: "ReactionLimitReached",
                description: "Indicates that the message has the maximum number of reactions allowed for a single user, and the requested reaction wasn't yet present. If it was already present, the request will not fail since it is idempotent."
              },
              {
                name: "ReactionInvalidValue",
                description: "Indicates the value for the reaction is not acceptable. In general, this means it is not an emoji."
              }
            ]
          }
        }
      },
      ChatBskyConvoDefs: {
        lexicon: 1,
        id: "chat.bsky.convo.defs",
        defs: {
          messageRef: {
            type: "object",
            required: ["did", "messageId", "convoId"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              convoId: {
                type: "string"
              },
              messageId: {
                type: "string"
              }
            }
          },
          messageInput: {
            type: "object",
            required: ["text"],
            properties: {
              text: {
                type: "string",
                maxLength: 1e4,
                maxGraphemes: 1e3
              },
              facets: {
                type: "array",
                description: "Annotations of text (mentions, URLs, hashtags, etc)",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.richtext.facet"
                }
              },
              embed: {
                type: "union",
                refs: ["lex:app.bsky.embed.record"]
              }
            }
          },
          messageView: {
            type: "object",
            required: ["id", "rev", "text", "sender", "sentAt"],
            properties: {
              id: {
                type: "string"
              },
              rev: {
                type: "string"
              },
              text: {
                type: "string",
                maxLength: 1e4,
                maxGraphemes: 1e3
              },
              facets: {
                type: "array",
                description: "Annotations of text (mentions, URLs, hashtags, etc)",
                items: {
                  type: "ref",
                  ref: "lex:app.bsky.richtext.facet"
                }
              },
              embed: {
                type: "union",
                refs: ["lex:app.bsky.embed.record#view"]
              },
              reactions: {
                type: "array",
                description: "Reactions to this message, in ascending order of creation time.",
                items: {
                  type: "ref",
                  ref: "lex:chat.bsky.convo.defs#reactionView"
                }
              },
              sender: {
                type: "ref",
                ref: "lex:chat.bsky.convo.defs#messageViewSender"
              },
              sentAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          deletedMessageView: {
            type: "object",
            required: ["id", "rev", "sender", "sentAt"],
            properties: {
              id: {
                type: "string"
              },
              rev: {
                type: "string"
              },
              sender: {
                type: "ref",
                ref: "lex:chat.bsky.convo.defs#messageViewSender"
              },
              sentAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          messageViewSender: {
            type: "object",
            required: ["did"],
            properties: {
              did: {
                type: "string",
                format: "did"
              }
            }
          },
          reactionView: {
            type: "object",
            required: ["value", "sender", "createdAt"],
            properties: {
              value: {
                type: "string"
              },
              sender: {
                type: "ref",
                ref: "lex:chat.bsky.convo.defs#reactionViewSender"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          reactionViewSender: {
            type: "object",
            required: ["did"],
            properties: {
              did: {
                type: "string",
                format: "did"
              }
            }
          },
          messageAndReactionView: {
            type: "object",
            required: ["message", "reaction"],
            properties: {
              message: {
                type: "ref",
                ref: "lex:chat.bsky.convo.defs#messageView"
              },
              reaction: {
                type: "ref",
                ref: "lex:chat.bsky.convo.defs#reactionView"
              }
            }
          },
          convoView: {
            type: "object",
            required: ["id", "rev", "members", "muted", "unreadCount"],
            properties: {
              id: {
                type: "string"
              },
              rev: {
                type: "string"
              },
              members: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:chat.bsky.actor.defs#profileViewBasic"
                }
              },
              lastMessage: {
                type: "union",
                refs: [
                  "lex:chat.bsky.convo.defs#messageView",
                  "lex:chat.bsky.convo.defs#deletedMessageView"
                ]
              },
              lastReaction: {
                type: "union",
                refs: ["lex:chat.bsky.convo.defs#messageAndReactionView"]
              },
              muted: {
                type: "boolean"
              },
              status: {
                type: "string",
                knownValues: ["request", "accepted"]
              },
              unreadCount: {
                type: "integer"
              }
            }
          },
          logBeginConvo: {
            type: "object",
            required: ["rev", "convoId"],
            properties: {
              rev: {
                type: "string"
              },
              convoId: {
                type: "string"
              }
            }
          },
          logAcceptConvo: {
            type: "object",
            required: ["rev", "convoId"],
            properties: {
              rev: {
                type: "string"
              },
              convoId: {
                type: "string"
              }
            }
          },
          logLeaveConvo: {
            type: "object",
            required: ["rev", "convoId"],
            properties: {
              rev: {
                type: "string"
              },
              convoId: {
                type: "string"
              }
            }
          },
          logMuteConvo: {
            type: "object",
            required: ["rev", "convoId"],
            properties: {
              rev: {
                type: "string"
              },
              convoId: {
                type: "string"
              }
            }
          },
          logUnmuteConvo: {
            type: "object",
            required: ["rev", "convoId"],
            properties: {
              rev: {
                type: "string"
              },
              convoId: {
                type: "string"
              }
            }
          },
          logCreateMessage: {
            type: "object",
            required: ["rev", "convoId", "message"],
            properties: {
              rev: {
                type: "string"
              },
              convoId: {
                type: "string"
              },
              message: {
                type: "union",
                refs: [
                  "lex:chat.bsky.convo.defs#messageView",
                  "lex:chat.bsky.convo.defs#deletedMessageView"
                ]
              }
            }
          },
          logDeleteMessage: {
            type: "object",
            required: ["rev", "convoId", "message"],
            properties: {
              rev: {
                type: "string"
              },
              convoId: {
                type: "string"
              },
              message: {
                type: "union",
                refs: [
                  "lex:chat.bsky.convo.defs#messageView",
                  "lex:chat.bsky.convo.defs#deletedMessageView"
                ]
              }
            }
          },
          logReadMessage: {
            type: "object",
            required: ["rev", "convoId", "message"],
            properties: {
              rev: {
                type: "string"
              },
              convoId: {
                type: "string"
              },
              message: {
                type: "union",
                refs: [
                  "lex:chat.bsky.convo.defs#messageView",
                  "lex:chat.bsky.convo.defs#deletedMessageView"
                ]
              }
            }
          },
          logAddReaction: {
            type: "object",
            required: ["rev", "convoId", "message", "reaction"],
            properties: {
              rev: {
                type: "string"
              },
              convoId: {
                type: "string"
              },
              message: {
                type: "union",
                refs: [
                  "lex:chat.bsky.convo.defs#messageView",
                  "lex:chat.bsky.convo.defs#deletedMessageView"
                ]
              },
              reaction: {
                type: "ref",
                ref: "lex:chat.bsky.convo.defs#reactionView"
              }
            }
          },
          logRemoveReaction: {
            type: "object",
            required: ["rev", "convoId", "message", "reaction"],
            properties: {
              rev: {
                type: "string"
              },
              convoId: {
                type: "string"
              },
              message: {
                type: "union",
                refs: [
                  "lex:chat.bsky.convo.defs#messageView",
                  "lex:chat.bsky.convo.defs#deletedMessageView"
                ]
              },
              reaction: {
                type: "ref",
                ref: "lex:chat.bsky.convo.defs#reactionView"
              }
            }
          }
        }
      },
      ChatBskyConvoDeleteMessageForSelf: {
        lexicon: 1,
        id: "chat.bsky.convo.deleteMessageForSelf",
        defs: {
          main: {
            type: "procedure",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convoId", "messageId"],
                properties: {
                  convoId: {
                    type: "string"
                  },
                  messageId: {
                    type: "string"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:chat.bsky.convo.defs#deletedMessageView"
              }
            }
          }
        }
      },
      ChatBskyConvoGetConvo: {
        lexicon: 1,
        id: "chat.bsky.convo.getConvo",
        defs: {
          main: {
            type: "query",
            parameters: {
              type: "params",
              required: ["convoId"],
              properties: {
                convoId: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convo"],
                properties: {
                  convo: {
                    type: "ref",
                    ref: "lex:chat.bsky.convo.defs#convoView"
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyConvoGetConvoAvailability: {
        lexicon: 1,
        id: "chat.bsky.convo.getConvoAvailability",
        defs: {
          main: {
            type: "query",
            description: "Get whether the requester and the other members can chat. If an existing convo is found for these members, it is returned.",
            parameters: {
              type: "params",
              required: ["members"],
              properties: {
                members: {
                  type: "array",
                  minLength: 1,
                  maxLength: 10,
                  items: {
                    type: "string",
                    format: "did"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["canChat"],
                properties: {
                  canChat: {
                    type: "boolean"
                  },
                  convo: {
                    type: "ref",
                    ref: "lex:chat.bsky.convo.defs#convoView"
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyConvoGetConvoForMembers: {
        lexicon: 1,
        id: "chat.bsky.convo.getConvoForMembers",
        defs: {
          main: {
            type: "query",
            parameters: {
              type: "params",
              required: ["members"],
              properties: {
                members: {
                  type: "array",
                  minLength: 1,
                  maxLength: 10,
                  items: {
                    type: "string",
                    format: "did"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convo"],
                properties: {
                  convo: {
                    type: "ref",
                    ref: "lex:chat.bsky.convo.defs#convoView"
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyConvoGetLog: {
        lexicon: 1,
        id: "chat.bsky.convo.getLog",
        defs: {
          main: {
            type: "query",
            parameters: {
              type: "params",
              required: [],
              properties: {
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["logs"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  logs: {
                    type: "array",
                    items: {
                      type: "union",
                      refs: [
                        "lex:chat.bsky.convo.defs#logBeginConvo",
                        "lex:chat.bsky.convo.defs#logAcceptConvo",
                        "lex:chat.bsky.convo.defs#logLeaveConvo",
                        "lex:chat.bsky.convo.defs#logMuteConvo",
                        "lex:chat.bsky.convo.defs#logUnmuteConvo",
                        "lex:chat.bsky.convo.defs#logCreateMessage",
                        "lex:chat.bsky.convo.defs#logDeleteMessage",
                        "lex:chat.bsky.convo.defs#logReadMessage",
                        "lex:chat.bsky.convo.defs#logAddReaction",
                        "lex:chat.bsky.convo.defs#logRemoveReaction"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyConvoGetMessages: {
        lexicon: 1,
        id: "chat.bsky.convo.getMessages",
        defs: {
          main: {
            type: "query",
            parameters: {
              type: "params",
              required: ["convoId"],
              properties: {
                convoId: {
                  type: "string"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["messages"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  messages: {
                    type: "array",
                    items: {
                      type: "union",
                      refs: [
                        "lex:chat.bsky.convo.defs#messageView",
                        "lex:chat.bsky.convo.defs#deletedMessageView"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyConvoLeaveConvo: {
        lexicon: 1,
        id: "chat.bsky.convo.leaveConvo",
        defs: {
          main: {
            type: "procedure",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convoId"],
                properties: {
                  convoId: {
                    type: "string"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convoId", "rev"],
                properties: {
                  convoId: {
                    type: "string"
                  },
                  rev: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyConvoListConvos: {
        lexicon: 1,
        id: "chat.bsky.convo.listConvos",
        defs: {
          main: {
            type: "query",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                },
                readState: {
                  type: "string",
                  knownValues: ["unread"]
                },
                status: {
                  type: "string",
                  knownValues: ["request", "accepted"]
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convos"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  convos: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:chat.bsky.convo.defs#convoView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyConvoMuteConvo: {
        lexicon: 1,
        id: "chat.bsky.convo.muteConvo",
        defs: {
          main: {
            type: "procedure",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convoId"],
                properties: {
                  convoId: {
                    type: "string"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convo"],
                properties: {
                  convo: {
                    type: "ref",
                    ref: "lex:chat.bsky.convo.defs#convoView"
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyConvoRemoveReaction: {
        lexicon: 1,
        id: "chat.bsky.convo.removeReaction",
        defs: {
          main: {
            type: "procedure",
            description: "Removes an emoji reaction from a message. Requires authentication. It is idempotent, so multiple calls from the same user with the same emoji result in that reaction not being present, even if it already wasn't.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convoId", "messageId", "value"],
                properties: {
                  convoId: {
                    type: "string"
                  },
                  messageId: {
                    type: "string"
                  },
                  value: {
                    type: "string",
                    minLength: 1,
                    maxLength: 64,
                    minGraphemes: 1,
                    maxGraphemes: 1
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["message"],
                properties: {
                  message: {
                    type: "ref",
                    ref: "lex:chat.bsky.convo.defs#messageView"
                  }
                }
              }
            },
            errors: [
              {
                name: "ReactionMessageDeleted",
                description: "Indicates that the message has been deleted and reactions can no longer be added/removed."
              },
              {
                name: "ReactionInvalidValue",
                description: "Indicates the value for the reaction is not acceptable. In general, this means it is not an emoji."
              }
            ]
          }
        }
      },
      ChatBskyConvoSendMessage: {
        lexicon: 1,
        id: "chat.bsky.convo.sendMessage",
        defs: {
          main: {
            type: "procedure",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convoId", "message"],
                properties: {
                  convoId: {
                    type: "string"
                  },
                  message: {
                    type: "ref",
                    ref: "lex:chat.bsky.convo.defs#messageInput"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:chat.bsky.convo.defs#messageView"
              }
            }
          }
        }
      },
      ChatBskyConvoSendMessageBatch: {
        lexicon: 1,
        id: "chat.bsky.convo.sendMessageBatch",
        defs: {
          main: {
            type: "procedure",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["items"],
                properties: {
                  items: {
                    type: "array",
                    maxLength: 100,
                    items: {
                      type: "ref",
                      ref: "lex:chat.bsky.convo.sendMessageBatch#batchItem"
                    }
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["items"],
                properties: {
                  items: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:chat.bsky.convo.defs#messageView"
                    }
                  }
                }
              }
            }
          },
          batchItem: {
            type: "object",
            required: ["convoId", "message"],
            properties: {
              convoId: {
                type: "string"
              },
              message: {
                type: "ref",
                ref: "lex:chat.bsky.convo.defs#messageInput"
              }
            }
          }
        }
      },
      ChatBskyConvoUnmuteConvo: {
        lexicon: 1,
        id: "chat.bsky.convo.unmuteConvo",
        defs: {
          main: {
            type: "procedure",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convoId"],
                properties: {
                  convoId: {
                    type: "string"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convo"],
                properties: {
                  convo: {
                    type: "ref",
                    ref: "lex:chat.bsky.convo.defs#convoView"
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyConvoUpdateAllRead: {
        lexicon: 1,
        id: "chat.bsky.convo.updateAllRead",
        defs: {
          main: {
            type: "procedure",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  status: {
                    type: "string",
                    knownValues: ["request", "accepted"]
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["updatedCount"],
                properties: {
                  updatedCount: {
                    description: "The count of updated convos.",
                    type: "integer"
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyConvoUpdateRead: {
        lexicon: 1,
        id: "chat.bsky.convo.updateRead",
        defs: {
          main: {
            type: "procedure",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convoId"],
                properties: {
                  convoId: {
                    type: "string"
                  },
                  messageId: {
                    type: "string"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["convo"],
                properties: {
                  convo: {
                    type: "ref",
                    ref: "lex:chat.bsky.convo.defs#convoView"
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyModerationGetActorMetadata: {
        lexicon: 1,
        id: "chat.bsky.moderation.getActorMetadata",
        defs: {
          main: {
            type: "query",
            parameters: {
              type: "params",
              required: ["actor"],
              properties: {
                actor: {
                  type: "string",
                  format: "did"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["day", "month", "all"],
                properties: {
                  day: {
                    type: "ref",
                    ref: "lex:chat.bsky.moderation.getActorMetadata#metadata"
                  },
                  month: {
                    type: "ref",
                    ref: "lex:chat.bsky.moderation.getActorMetadata#metadata"
                  },
                  all: {
                    type: "ref",
                    ref: "lex:chat.bsky.moderation.getActorMetadata#metadata"
                  }
                }
              }
            }
          },
          metadata: {
            type: "object",
            required: [
              "messagesSent",
              "messagesReceived",
              "convos",
              "convosStarted"
            ],
            properties: {
              messagesSent: {
                type: "integer"
              },
              messagesReceived: {
                type: "integer"
              },
              convos: {
                type: "integer"
              },
              convosStarted: {
                type: "integer"
              }
            }
          }
        }
      },
      ChatBskyModerationGetMessageContext: {
        lexicon: 1,
        id: "chat.bsky.moderation.getMessageContext",
        defs: {
          main: {
            type: "query",
            parameters: {
              type: "params",
              required: ["messageId"],
              properties: {
                convoId: {
                  type: "string",
                  description: "Conversation that the message is from. NOTE: this field will eventually be required."
                },
                messageId: {
                  type: "string"
                },
                before: {
                  type: "integer",
                  default: 5
                },
                after: {
                  type: "integer",
                  default: 5
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["messages"],
                properties: {
                  messages: {
                    type: "array",
                    items: {
                      type: "union",
                      refs: [
                        "lex:chat.bsky.convo.defs#messageView",
                        "lex:chat.bsky.convo.defs#deletedMessageView"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      ChatBskyModerationUpdateActorAccess: {
        lexicon: 1,
        id: "chat.bsky.moderation.updateActorAccess",
        defs: {
          main: {
            type: "procedure",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["actor", "allowAccess"],
                properties: {
                  actor: {
                    type: "string",
                    format: "did"
                  },
                  allowAccess: {
                    type: "boolean"
                  },
                  ref: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminDefs: {
        lexicon: 1,
        id: "com.atproto.admin.defs",
        defs: {
          statusAttr: {
            type: "object",
            required: ["applied"],
            properties: {
              applied: {
                type: "boolean"
              },
              ref: {
                type: "string"
              }
            }
          },
          accountView: {
            type: "object",
            required: ["did", "handle", "indexedAt"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              handle: {
                type: "string",
                format: "handle"
              },
              email: {
                type: "string"
              },
              relatedRecords: {
                type: "array",
                items: {
                  type: "unknown"
                }
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              invitedBy: {
                type: "ref",
                ref: "lex:com.atproto.server.defs#inviteCode"
              },
              invites: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.server.defs#inviteCode"
                }
              },
              invitesDisabled: {
                type: "boolean"
              },
              emailConfirmedAt: {
                type: "string",
                format: "datetime"
              },
              inviteNote: {
                type: "string"
              },
              deactivatedAt: {
                type: "string",
                format: "datetime"
              },
              threatSignatures: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.admin.defs#threatSignature"
                }
              }
            }
          },
          repoRef: {
            type: "object",
            required: ["did"],
            properties: {
              did: {
                type: "string",
                format: "did"
              }
            }
          },
          repoBlobRef: {
            type: "object",
            required: ["did", "cid"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              recordUri: {
                type: "string",
                format: "at-uri"
              }
            }
          },
          threatSignature: {
            type: "object",
            required: ["property", "value"],
            properties: {
              property: {
                type: "string"
              },
              value: {
                type: "string"
              }
            }
          }
        }
      },
      ComAtprotoAdminDeleteAccount: {
        lexicon: 1,
        id: "com.atproto.admin.deleteAccount",
        defs: {
          main: {
            type: "procedure",
            description: "Delete a user account as an administrator.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did"],
                properties: {
                  did: {
                    type: "string",
                    format: "did"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminDisableAccountInvites: {
        lexicon: 1,
        id: "com.atproto.admin.disableAccountInvites",
        defs: {
          main: {
            type: "procedure",
            description: "Disable an account from receiving new invite codes, but does not invalidate existing codes.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["account"],
                properties: {
                  account: {
                    type: "string",
                    format: "did"
                  },
                  note: {
                    type: "string",
                    description: "Optional reason for disabled invites."
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminDisableInviteCodes: {
        lexicon: 1,
        id: "com.atproto.admin.disableInviteCodes",
        defs: {
          main: {
            type: "procedure",
            description: "Disable some set of codes and/or all codes associated with a set of users.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  codes: {
                    type: "array",
                    items: {
                      type: "string"
                    }
                  },
                  accounts: {
                    type: "array",
                    items: {
                      type: "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminEnableAccountInvites: {
        lexicon: 1,
        id: "com.atproto.admin.enableAccountInvites",
        defs: {
          main: {
            type: "procedure",
            description: "Re-enable an account's ability to receive invite codes.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["account"],
                properties: {
                  account: {
                    type: "string",
                    format: "did"
                  },
                  note: {
                    type: "string",
                    description: "Optional reason for enabled invites."
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminGetAccountInfo: {
        lexicon: 1,
        id: "com.atproto.admin.getAccountInfo",
        defs: {
          main: {
            type: "query",
            description: "Get details about an account.",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:com.atproto.admin.defs#accountView"
              }
            }
          }
        }
      },
      ComAtprotoAdminGetAccountInfos: {
        lexicon: 1,
        id: "com.atproto.admin.getAccountInfos",
        defs: {
          main: {
            type: "query",
            description: "Get details about some accounts.",
            parameters: {
              type: "params",
              required: ["dids"],
              properties: {
                dids: {
                  type: "array",
                  items: {
                    type: "string",
                    format: "did"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["infos"],
                properties: {
                  infos: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.admin.defs#accountView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminGetInviteCodes: {
        lexicon: 1,
        id: "com.atproto.admin.getInviteCodes",
        defs: {
          main: {
            type: "query",
            description: "Get an admin view of invite codes.",
            parameters: {
              type: "params",
              properties: {
                sort: {
                  type: "string",
                  knownValues: ["recent", "usage"],
                  default: "recent"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 500,
                  default: 100
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["codes"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  codes: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.server.defs#inviteCode"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminGetSubjectStatus: {
        lexicon: 1,
        id: "com.atproto.admin.getSubjectStatus",
        defs: {
          main: {
            type: "query",
            description: "Get the service-specific admin status of a subject (account, record, or blob).",
            parameters: {
              type: "params",
              properties: {
                did: {
                  type: "string",
                  format: "did"
                },
                uri: {
                  type: "string",
                  format: "at-uri"
                },
                blob: {
                  type: "string",
                  format: "cid"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subject"],
                properties: {
                  subject: {
                    type: "union",
                    refs: [
                      "lex:com.atproto.admin.defs#repoRef",
                      "lex:com.atproto.repo.strongRef",
                      "lex:com.atproto.admin.defs#repoBlobRef"
                    ]
                  },
                  takedown: {
                    type: "ref",
                    ref: "lex:com.atproto.admin.defs#statusAttr"
                  },
                  deactivated: {
                    type: "ref",
                    ref: "lex:com.atproto.admin.defs#statusAttr"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminSearchAccounts: {
        lexicon: 1,
        id: "com.atproto.admin.searchAccounts",
        defs: {
          main: {
            type: "query",
            description: "Get list of accounts that matches your search query.",
            parameters: {
              type: "params",
              properties: {
                email: {
                  type: "string"
                },
                cursor: {
                  type: "string"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["accounts"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  accounts: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.admin.defs#accountView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminSendEmail: {
        lexicon: 1,
        id: "com.atproto.admin.sendEmail",
        defs: {
          main: {
            type: "procedure",
            description: "Send email to a user's account email address.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["recipientDid", "content", "senderDid"],
                properties: {
                  recipientDid: {
                    type: "string",
                    format: "did"
                  },
                  content: {
                    type: "string"
                  },
                  subject: {
                    type: "string"
                  },
                  senderDid: {
                    type: "string",
                    format: "did"
                  },
                  comment: {
                    type: "string",
                    description: "Additional comment by the sender that won't be used in the email itself but helpful to provide more context for moderators/reviewers"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["sent"],
                properties: {
                  sent: {
                    type: "boolean"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminUpdateAccountEmail: {
        lexicon: 1,
        id: "com.atproto.admin.updateAccountEmail",
        defs: {
          main: {
            type: "procedure",
            description: "Administrative action to update an account's email.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["account", "email"],
                properties: {
                  account: {
                    type: "string",
                    format: "at-identifier",
                    description: "The handle or DID of the repo."
                  },
                  email: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminUpdateAccountHandle: {
        lexicon: 1,
        id: "com.atproto.admin.updateAccountHandle",
        defs: {
          main: {
            type: "procedure",
            description: "Administrative action to update an account's handle.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did", "handle"],
                properties: {
                  did: {
                    type: "string",
                    format: "did"
                  },
                  handle: {
                    type: "string",
                    format: "handle"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminUpdateAccountPassword: {
        lexicon: 1,
        id: "com.atproto.admin.updateAccountPassword",
        defs: {
          main: {
            type: "procedure",
            description: "Update the password for a user account as an administrator.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did", "password"],
                properties: {
                  did: {
                    type: "string",
                    format: "did"
                  },
                  password: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminUpdateAccountSigningKey: {
        lexicon: 1,
        id: "com.atproto.admin.updateAccountSigningKey",
        defs: {
          main: {
            type: "procedure",
            description: "Administrative action to update an account's signing key in their Did document.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did", "signingKey"],
                properties: {
                  did: {
                    type: "string",
                    format: "did"
                  },
                  signingKey: {
                    type: "string",
                    format: "did",
                    description: "Did-key formatted public key"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoAdminUpdateSubjectStatus: {
        lexicon: 1,
        id: "com.atproto.admin.updateSubjectStatus",
        defs: {
          main: {
            type: "procedure",
            description: "Update the service-specific admin status of a subject (account, record, or blob).",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subject"],
                properties: {
                  subject: {
                    type: "union",
                    refs: [
                      "lex:com.atproto.admin.defs#repoRef",
                      "lex:com.atproto.repo.strongRef",
                      "lex:com.atproto.admin.defs#repoBlobRef"
                    ]
                  },
                  takedown: {
                    type: "ref",
                    ref: "lex:com.atproto.admin.defs#statusAttr"
                  },
                  deactivated: {
                    type: "ref",
                    ref: "lex:com.atproto.admin.defs#statusAttr"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subject"],
                properties: {
                  subject: {
                    type: "union",
                    refs: [
                      "lex:com.atproto.admin.defs#repoRef",
                      "lex:com.atproto.repo.strongRef",
                      "lex:com.atproto.admin.defs#repoBlobRef"
                    ]
                  },
                  takedown: {
                    type: "ref",
                    ref: "lex:com.atproto.admin.defs#statusAttr"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoIdentityDefs: {
        lexicon: 1,
        id: "com.atproto.identity.defs",
        defs: {
          identityInfo: {
            type: "object",
            required: ["did", "handle", "didDoc"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              handle: {
                type: "string",
                format: "handle",
                description: "The validated handle of the account; or 'handle.invalid' if the handle did not bi-directionally match the DID document."
              },
              didDoc: {
                type: "unknown",
                description: "The complete DID document for the identity."
              }
            }
          }
        }
      },
      ComAtprotoIdentityGetRecommendedDidCredentials: {
        lexicon: 1,
        id: "com.atproto.identity.getRecommendedDidCredentials",
        defs: {
          main: {
            type: "query",
            description: "Describe the credentials that should be included in the DID doc of an account that is migrating to this service.",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  rotationKeys: {
                    description: "Recommended rotation keys for PLC dids. Should be undefined (or ignored) for did:webs.",
                    type: "array",
                    items: {
                      type: "string"
                    }
                  },
                  alsoKnownAs: {
                    type: "array",
                    items: {
                      type: "string"
                    }
                  },
                  verificationMethods: {
                    type: "unknown"
                  },
                  services: {
                    type: "unknown"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoIdentityRefreshIdentity: {
        lexicon: 1,
        id: "com.atproto.identity.refreshIdentity",
        defs: {
          main: {
            type: "procedure",
            description: "Request that the server re-resolve an identity (DID and handle). The server may ignore this request, or require authentication, depending on the role, implementation, and policy of the server.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["identifier"],
                properties: {
                  identifier: {
                    type: "string",
                    format: "at-identifier"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:com.atproto.identity.defs#identityInfo"
              }
            },
            errors: [
              {
                name: "HandleNotFound",
                description: "The resolution process confirmed that the handle does not resolve to any DID."
              },
              {
                name: "DidNotFound",
                description: "The DID resolution process confirmed that there is no current DID."
              },
              {
                name: "DidDeactivated",
                description: "The DID previously existed, but has been deactivated."
              }
            ]
          }
        }
      },
      ComAtprotoIdentityRequestPlcOperationSignature: {
        lexicon: 1,
        id: "com.atproto.identity.requestPlcOperationSignature",
        defs: {
          main: {
            type: "procedure",
            description: "Request an email with a code to in order to request a signed PLC operation. Requires Auth."
          }
        }
      },
      ComAtprotoIdentityResolveDid: {
        lexicon: 1,
        id: "com.atproto.identity.resolveDid",
        defs: {
          main: {
            type: "query",
            description: "Resolves DID to DID document. Does not bi-directionally verify handle.",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did",
                  description: "DID to resolve."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["didDoc"],
                properties: {
                  didDoc: {
                    type: "unknown",
                    description: "The complete DID document for the identity."
                  }
                }
              }
            },
            errors: [
              {
                name: "DidNotFound",
                description: "The DID resolution process confirmed that there is no current DID."
              },
              {
                name: "DidDeactivated",
                description: "The DID previously existed, but has been deactivated."
              }
            ]
          }
        }
      },
      ComAtprotoIdentityResolveHandle: {
        lexicon: 1,
        id: "com.atproto.identity.resolveHandle",
        defs: {
          main: {
            type: "query",
            description: "Resolves an atproto handle (hostname) to a DID. Does not necessarily bi-directionally verify against the the DID document.",
            parameters: {
              type: "params",
              required: ["handle"],
              properties: {
                handle: {
                  type: "string",
                  format: "handle",
                  description: "The handle to resolve."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did"],
                properties: {
                  did: {
                    type: "string",
                    format: "did"
                  }
                }
              }
            },
            errors: [
              {
                name: "HandleNotFound",
                description: "The resolution process confirmed that the handle does not resolve to any DID."
              }
            ]
          }
        }
      },
      ComAtprotoIdentityResolveIdentity: {
        lexicon: 1,
        id: "com.atproto.identity.resolveIdentity",
        defs: {
          main: {
            type: "query",
            description: "Resolves an identity (DID or Handle) to a full identity (DID document and verified handle).",
            parameters: {
              type: "params",
              required: ["identifier"],
              properties: {
                identifier: {
                  type: "string",
                  format: "at-identifier",
                  description: "Handle or DID to resolve."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:com.atproto.identity.defs#identityInfo"
              }
            },
            errors: [
              {
                name: "HandleNotFound",
                description: "The resolution process confirmed that the handle does not resolve to any DID."
              },
              {
                name: "DidNotFound",
                description: "The DID resolution process confirmed that there is no current DID."
              },
              {
                name: "DidDeactivated",
                description: "The DID previously existed, but has been deactivated."
              }
            ]
          }
        }
      },
      ComAtprotoIdentitySignPlcOperation: {
        lexicon: 1,
        id: "com.atproto.identity.signPlcOperation",
        defs: {
          main: {
            type: "procedure",
            description: "Signs a PLC operation to update some value(s) in the requesting DID's document.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  token: {
                    description: "A token received through com.atproto.identity.requestPlcOperationSignature",
                    type: "string"
                  },
                  rotationKeys: {
                    type: "array",
                    items: {
                      type: "string"
                    }
                  },
                  alsoKnownAs: {
                    type: "array",
                    items: {
                      type: "string"
                    }
                  },
                  verificationMethods: {
                    type: "unknown"
                  },
                  services: {
                    type: "unknown"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["operation"],
                properties: {
                  operation: {
                    type: "unknown",
                    description: "A signed DID PLC operation."
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoIdentitySubmitPlcOperation: {
        lexicon: 1,
        id: "com.atproto.identity.submitPlcOperation",
        defs: {
          main: {
            type: "procedure",
            description: "Validates a PLC operation to ensure that it doesn't violate a service's constraints or get the identity into a bad state, then submits it to the PLC registry",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["operation"],
                properties: {
                  operation: {
                    type: "unknown"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoIdentityUpdateHandle: {
        lexicon: 1,
        id: "com.atproto.identity.updateHandle",
        defs: {
          main: {
            type: "procedure",
            description: "Updates the current account's handle. Verifies handle validity, and updates did:plc document if necessary. Implemented by PDS, and requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["handle"],
                properties: {
                  handle: {
                    type: "string",
                    format: "handle",
                    description: "The new handle."
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoLabelDefs: {
        lexicon: 1,
        id: "com.atproto.label.defs",
        defs: {
          label: {
            type: "object",
            description: "Metadata tag on an atproto resource (eg, repo or record).",
            required: ["src", "uri", "val", "cts"],
            properties: {
              ver: {
                type: "integer",
                description: "The AT Protocol version of the label object."
              },
              src: {
                type: "string",
                format: "did",
                description: "DID of the actor who created this label."
              },
              uri: {
                type: "string",
                format: "uri",
                description: "AT URI of the record, repository (account), or other resource that this label applies to."
              },
              cid: {
                type: "string",
                format: "cid",
                description: "Optionally, CID specifying the specific version of 'uri' resource this label applies to."
              },
              val: {
                type: "string",
                maxLength: 128,
                description: "The short string name of the value or type of this label."
              },
              neg: {
                type: "boolean",
                description: "If true, this is a negation label, overwriting a previous label."
              },
              cts: {
                type: "string",
                format: "datetime",
                description: "Timestamp when this label was created."
              },
              exp: {
                type: "string",
                format: "datetime",
                description: "Timestamp at which this label expires (no longer applies)."
              },
              sig: {
                type: "bytes",
                description: "Signature of dag-cbor encoded label."
              }
            }
          },
          selfLabels: {
            type: "object",
            description: "Metadata tags on an atproto record, published by the author within the record.",
            required: ["values"],
            properties: {
              values: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#selfLabel"
                },
                maxLength: 10
              }
            }
          },
          selfLabel: {
            type: "object",
            description: "Metadata tag on an atproto record, published by the author within the record. Note that schemas should use #selfLabels, not #selfLabel.",
            required: ["val"],
            properties: {
              val: {
                type: "string",
                maxLength: 128,
                description: "The short string name of the value or type of this label."
              }
            }
          },
          labelValueDefinition: {
            type: "object",
            description: "Declares a label value and its expected interpretations and behaviors.",
            required: ["identifier", "severity", "blurs", "locales"],
            properties: {
              identifier: {
                type: "string",
                description: "The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+).",
                maxLength: 100,
                maxGraphemes: 100
              },
              severity: {
                type: "string",
                description: "How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing.",
                knownValues: ["inform", "alert", "none"]
              },
              blurs: {
                type: "string",
                description: "What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing.",
                knownValues: ["content", "media", "none"]
              },
              defaultSetting: {
                type: "string",
                description: "The default setting for this label.",
                knownValues: ["ignore", "warn", "hide"],
                default: "warn"
              },
              adultOnly: {
                type: "boolean",
                description: "Does the user need to have adult content enabled in order to configure this label?"
              },
              locales: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#labelValueDefinitionStrings"
                }
              }
            }
          },
          labelValueDefinitionStrings: {
            type: "object",
            description: "Strings which describe the label in the UI, localized into a specific language.",
            required: ["lang", "name", "description"],
            properties: {
              lang: {
                type: "string",
                description: "The code of the language these strings are written in.",
                format: "language"
              },
              name: {
                type: "string",
                description: "A short human-readable name for the label.",
                maxGraphemes: 64,
                maxLength: 640
              },
              description: {
                type: "string",
                description: "A longer description of what the label means and why it might be applied.",
                maxGraphemes: 1e4,
                maxLength: 1e5
              }
            }
          },
          labelValue: {
            type: "string",
            knownValues: [
              "!hide",
              "!no-promote",
              "!warn",
              "!no-unauthenticated",
              "dmca-violation",
              "doxxing",
              "porn",
              "sexual",
              "nudity",
              "nsfl",
              "gore"
            ]
          }
        }
      },
      ComAtprotoLabelQueryLabels: {
        lexicon: 1,
        id: "com.atproto.label.queryLabels",
        defs: {
          main: {
            type: "query",
            description: "Find labels relevant to the provided AT-URI patterns. Public endpoint for moderation services, though may return different or additional results with auth.",
            parameters: {
              type: "params",
              required: ["uriPatterns"],
              properties: {
                uriPatterns: {
                  type: "array",
                  items: {
                    type: "string"
                  },
                  description: "List of AT URI patterns to match (boolean 'OR'). Each may be a prefix (ending with '*'; will match inclusive of the string leading to '*'), or a full URI."
                },
                sources: {
                  type: "array",
                  items: {
                    type: "string",
                    format: "did"
                  },
                  description: "Optional list of label sources (DIDs) to filter on."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 250,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["labels"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  labels: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.label.defs#label"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoLabelSubscribeLabels: {
        lexicon: 1,
        id: "com.atproto.label.subscribeLabels",
        defs: {
          main: {
            type: "subscription",
            description: "Subscribe to stream of labels (and negations). Public endpoint implemented by mod services. Uses same sequencing scheme as repo event stream.",
            parameters: {
              type: "params",
              properties: {
                cursor: {
                  type: "integer",
                  description: "The last known event seq number to backfill from."
                }
              }
            },
            message: {
              schema: {
                type: "union",
                refs: [
                  "lex:com.atproto.label.subscribeLabels#labels",
                  "lex:com.atproto.label.subscribeLabels#info"
                ]
              }
            },
            errors: [
              {
                name: "FutureCursor"
              }
            ]
          },
          labels: {
            type: "object",
            required: ["seq", "labels"],
            properties: {
              seq: {
                type: "integer"
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              }
            }
          },
          info: {
            type: "object",
            required: ["name"],
            properties: {
              name: {
                type: "string",
                knownValues: ["OutdatedCursor"]
              },
              message: {
                type: "string"
              }
            }
          }
        }
      },
      ComAtprotoLexiconSchema: {
        lexicon: 1,
        id: "com.atproto.lexicon.schema",
        defs: {
          main: {
            type: "record",
            description: "Representation of Lexicon schemas themselves, when published as atproto records. Note that the schema language is not defined in Lexicon; this meta schema currently only includes a single version field ('lexicon'). See the atproto specifications for description of the other expected top-level fields ('id', 'defs', etc).",
            key: "nsid",
            record: {
              type: "object",
              required: ["lexicon"],
              properties: {
                lexicon: {
                  type: "integer",
                  description: "Indicates the 'version' of the Lexicon language. Must be '1' for the current atproto/Lexicon schema system."
                }
              }
            }
          }
        }
      },
      ComAtprotoModerationCreateReport: {
        lexicon: 1,
        id: "com.atproto.moderation.createReport",
        defs: {
          main: {
            type: "procedure",
            description: "Submit a moderation report regarding an atproto account or record. Implemented by moderation services (with PDS proxying), and requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["reasonType", "subject"],
                properties: {
                  reasonType: {
                    type: "ref",
                    description: "Indicates the broad category of violation the report is for.",
                    ref: "lex:com.atproto.moderation.defs#reasonType"
                  },
                  reason: {
                    type: "string",
                    maxGraphemes: 2e3,
                    maxLength: 2e4,
                    description: "Additional context about the content and violation."
                  },
                  subject: {
                    type: "union",
                    refs: [
                      "lex:com.atproto.admin.defs#repoRef",
                      "lex:com.atproto.repo.strongRef"
                    ]
                  },
                  modTool: {
                    type: "ref",
                    ref: "lex:com.atproto.moderation.createReport#modTool"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: [
                  "id",
                  "reasonType",
                  "subject",
                  "reportedBy",
                  "createdAt"
                ],
                properties: {
                  id: {
                    type: "integer"
                  },
                  reasonType: {
                    type: "ref",
                    ref: "lex:com.atproto.moderation.defs#reasonType"
                  },
                  reason: {
                    type: "string",
                    maxGraphemes: 2e3,
                    maxLength: 2e4
                  },
                  subject: {
                    type: "union",
                    refs: [
                      "lex:com.atproto.admin.defs#repoRef",
                      "lex:com.atproto.repo.strongRef"
                    ]
                  },
                  reportedBy: {
                    type: "string",
                    format: "did"
                  },
                  createdAt: {
                    type: "string",
                    format: "datetime"
                  }
                }
              }
            }
          },
          modTool: {
            type: "object",
            description: "Moderation tool information for tracing the source of the action",
            required: ["name"],
            properties: {
              name: {
                type: "string",
                description: "Name/identifier of the source (e.g., 'bsky-app/android', 'bsky-web/chrome')"
              },
              meta: {
                type: "unknown",
                description: "Additional arbitrary metadata about the source"
              }
            }
          }
        }
      },
      ComAtprotoModerationDefs: {
        lexicon: 1,
        id: "com.atproto.moderation.defs",
        defs: {
          reasonType: {
            type: "string",
            knownValues: [
              "com.atproto.moderation.defs#reasonSpam",
              "com.atproto.moderation.defs#reasonViolation",
              "com.atproto.moderation.defs#reasonMisleading",
              "com.atproto.moderation.defs#reasonSexual",
              "com.atproto.moderation.defs#reasonRude",
              "com.atproto.moderation.defs#reasonOther",
              "com.atproto.moderation.defs#reasonAppeal",
              "tools.ozone.report.defs#reasonAppeal",
              "tools.ozone.report.defs#reasonViolenceAnimalWelfare",
              "tools.ozone.report.defs#reasonViolenceThreats",
              "tools.ozone.report.defs#reasonViolenceGraphicContent",
              "tools.ozone.report.defs#reasonViolenceSelfHarm",
              "tools.ozone.report.defs#reasonViolenceGlorification",
              "tools.ozone.report.defs#reasonViolenceExtremistContent",
              "tools.ozone.report.defs#reasonViolenceTrafficking",
              "tools.ozone.report.defs#reasonViolenceOther",
              "tools.ozone.report.defs#reasonSexualAbuseContent",
              "tools.ozone.report.defs#reasonSexualNCII",
              "tools.ozone.report.defs#reasonSexualSextortion",
              "tools.ozone.report.defs#reasonSexualDeepfake",
              "tools.ozone.report.defs#reasonSexualAnimal",
              "tools.ozone.report.defs#reasonSexualUnlabeled",
              "tools.ozone.report.defs#reasonSexualOther",
              "tools.ozone.report.defs#reasonChildSafetyCSAM",
              "tools.ozone.report.defs#reasonChildSafetyGroom",
              "tools.ozone.report.defs#reasonChildSafetyMinorPrivacy",
              "tools.ozone.report.defs#reasonChildSafetyEndangerment",
              "tools.ozone.report.defs#reasonChildSafetyHarassment",
              "tools.ozone.report.defs#reasonChildSafetyPromotion",
              "tools.ozone.report.defs#reasonChildSafetyOther",
              "tools.ozone.report.defs#reasonHarassmentTroll",
              "tools.ozone.report.defs#reasonHarassmentTargeted",
              "tools.ozone.report.defs#reasonHarassmentHateSpeech",
              "tools.ozone.report.defs#reasonHarassmentDoxxing",
              "tools.ozone.report.defs#reasonHarassmentOther",
              "tools.ozone.report.defs#reasonMisleadingBot",
              "tools.ozone.report.defs#reasonMisleadingImpersonation",
              "tools.ozone.report.defs#reasonMisleadingSpam",
              "tools.ozone.report.defs#reasonMisleadingScam",
              "tools.ozone.report.defs#reasonMisleadingSyntheticContent",
              "tools.ozone.report.defs#reasonMisleadingMisinformation",
              "tools.ozone.report.defs#reasonMisleadingOther",
              "tools.ozone.report.defs#reasonRuleSiteSecurity",
              "tools.ozone.report.defs#reasonRuleStolenContent",
              "tools.ozone.report.defs#reasonRuleProhibitedSales",
              "tools.ozone.report.defs#reasonRuleBanEvasion",
              "tools.ozone.report.defs#reasonRuleOther",
              "tools.ozone.report.defs#reasonCivicElectoralProcess",
              "tools.ozone.report.defs#reasonCivicDisclosure",
              "tools.ozone.report.defs#reasonCivicInterference",
              "tools.ozone.report.defs#reasonCivicMisinformation",
              "tools.ozone.report.defs#reasonCivicImpersonation"
            ]
          },
          reasonSpam: {
            type: "token",
            description: "Spam: frequent unwanted promotion, replies, mentions. Prefer new lexicon definition `tools.ozone.report.defs#reasonMisleadingSpam`."
          },
          reasonViolation: {
            type: "token",
            description: "Direct violation of server rules, laws, terms of service. Prefer new lexicon definition `tools.ozone.report.defs#reasonRuleOther`."
          },
          reasonMisleading: {
            type: "token",
            description: "Misleading identity, affiliation, or content. Prefer new lexicon definition `tools.ozone.report.defs#reasonMisleadingOther`."
          },
          reasonSexual: {
            type: "token",
            description: "Unwanted or mislabeled sexual content. Prefer new lexicon definition `tools.ozone.report.defs#reasonSexualUnlabeled`."
          },
          reasonRude: {
            type: "token",
            description: "Rude, harassing, explicit, or otherwise unwelcoming behavior. Prefer new lexicon definition `tools.ozone.report.defs#reasonHarassmentOther`."
          },
          reasonOther: {
            type: "token",
            description: "Reports not falling under another report category. Prefer new lexicon definition `tools.ozone.report.defs#reasonRuleOther`."
          },
          reasonAppeal: {
            type: "token",
            description: "Appeal a previously taken moderation action"
          },
          subjectType: {
            type: "string",
            description: "Tag describing a type of subject that might be reported.",
            knownValues: ["account", "record", "chat"]
          }
        }
      },
      ComAtprotoRepoApplyWrites: {
        lexicon: 1,
        id: "com.atproto.repo.applyWrites",
        defs: {
          main: {
            type: "procedure",
            description: "Apply a batch transaction of repository creates, updates, and deletes. Requires auth, implemented by PDS.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["repo", "writes"],
                properties: {
                  repo: {
                    type: "string",
                    format: "at-identifier",
                    description: "The handle or DID of the repo (aka, current account)."
                  },
                  validate: {
                    type: "boolean",
                    description: "Can be set to 'false' to skip Lexicon schema validation of record data across all operations, 'true' to require it, or leave unset to validate only for known Lexicons."
                  },
                  writes: {
                    type: "array",
                    items: {
                      type: "union",
                      refs: [
                        "lex:com.atproto.repo.applyWrites#create",
                        "lex:com.atproto.repo.applyWrites#update",
                        "lex:com.atproto.repo.applyWrites#delete"
                      ],
                      closed: true
                    }
                  },
                  swapCommit: {
                    type: "string",
                    description: "If provided, the entire operation will fail if the current repo commit CID does not match this value. Used to prevent conflicting repo mutations.",
                    format: "cid"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: [],
                properties: {
                  commit: {
                    type: "ref",
                    ref: "lex:com.atproto.repo.defs#commitMeta"
                  },
                  results: {
                    type: "array",
                    items: {
                      type: "union",
                      refs: [
                        "lex:com.atproto.repo.applyWrites#createResult",
                        "lex:com.atproto.repo.applyWrites#updateResult",
                        "lex:com.atproto.repo.applyWrites#deleteResult"
                      ],
                      closed: true
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "InvalidSwap",
                description: "Indicates that the 'swapCommit' parameter did not match current commit."
              }
            ]
          },
          create: {
            type: "object",
            description: "Operation which creates a new record.",
            required: ["collection", "value"],
            properties: {
              collection: {
                type: "string",
                format: "nsid"
              },
              rkey: {
                type: "string",
                maxLength: 512,
                format: "record-key",
                description: "NOTE: maxLength is redundant with record-key format. Keeping it temporarily to ensure backwards compatibility."
              },
              value: {
                type: "unknown"
              }
            }
          },
          update: {
            type: "object",
            description: "Operation which updates an existing record.",
            required: ["collection", "rkey", "value"],
            properties: {
              collection: {
                type: "string",
                format: "nsid"
              },
              rkey: {
                type: "string",
                format: "record-key"
              },
              value: {
                type: "unknown"
              }
            }
          },
          delete: {
            type: "object",
            description: "Operation which deletes an existing record.",
            required: ["collection", "rkey"],
            properties: {
              collection: {
                type: "string",
                format: "nsid"
              },
              rkey: {
                type: "string",
                format: "record-key"
              }
            }
          },
          createResult: {
            type: "object",
            required: ["uri", "cid"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              validationStatus: {
                type: "string",
                knownValues: ["valid", "unknown"]
              }
            }
          },
          updateResult: {
            type: "object",
            required: ["uri", "cid"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              validationStatus: {
                type: "string",
                knownValues: ["valid", "unknown"]
              }
            }
          },
          deleteResult: {
            type: "object",
            required: [],
            properties: {}
          }
        }
      },
      ComAtprotoRepoCreateRecord: {
        lexicon: 1,
        id: "com.atproto.repo.createRecord",
        defs: {
          main: {
            type: "procedure",
            description: "Create a single new repository record. Requires auth, implemented by PDS.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["repo", "collection", "record"],
                properties: {
                  repo: {
                    type: "string",
                    format: "at-identifier",
                    description: "The handle or DID of the repo (aka, current account)."
                  },
                  collection: {
                    type: "string",
                    format: "nsid",
                    description: "The NSID of the record collection."
                  },
                  rkey: {
                    type: "string",
                    format: "record-key",
                    description: "The Record Key.",
                    maxLength: 512
                  },
                  validate: {
                    type: "boolean",
                    description: "Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons."
                  },
                  record: {
                    type: "unknown",
                    description: "The record itself. Must contain a $type field."
                  },
                  swapCommit: {
                    type: "string",
                    format: "cid",
                    description: "Compare and swap with the previous commit by CID."
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["uri", "cid"],
                properties: {
                  uri: {
                    type: "string",
                    format: "at-uri"
                  },
                  cid: {
                    type: "string",
                    format: "cid"
                  },
                  commit: {
                    type: "ref",
                    ref: "lex:com.atproto.repo.defs#commitMeta"
                  },
                  validationStatus: {
                    type: "string",
                    knownValues: ["valid", "unknown"]
                  }
                }
              }
            },
            errors: [
              {
                name: "InvalidSwap",
                description: "Indicates that 'swapCommit' didn't match current repo commit."
              }
            ]
          }
        }
      },
      ComAtprotoRepoDefs: {
        lexicon: 1,
        id: "com.atproto.repo.defs",
        defs: {
          commitMeta: {
            type: "object",
            required: ["cid", "rev"],
            properties: {
              cid: {
                type: "string",
                format: "cid"
              },
              rev: {
                type: "string",
                format: "tid"
              }
            }
          }
        }
      },
      ComAtprotoRepoDeleteRecord: {
        lexicon: 1,
        id: "com.atproto.repo.deleteRecord",
        defs: {
          main: {
            type: "procedure",
            description: "Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["repo", "collection", "rkey"],
                properties: {
                  repo: {
                    type: "string",
                    format: "at-identifier",
                    description: "The handle or DID of the repo (aka, current account)."
                  },
                  collection: {
                    type: "string",
                    format: "nsid",
                    description: "The NSID of the record collection."
                  },
                  rkey: {
                    type: "string",
                    format: "record-key",
                    description: "The Record Key."
                  },
                  swapRecord: {
                    type: "string",
                    format: "cid",
                    description: "Compare and swap with the previous record by CID."
                  },
                  swapCommit: {
                    type: "string",
                    format: "cid",
                    description: "Compare and swap with the previous commit by CID."
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  commit: {
                    type: "ref",
                    ref: "lex:com.atproto.repo.defs#commitMeta"
                  }
                }
              }
            },
            errors: [
              {
                name: "InvalidSwap"
              }
            ]
          }
        }
      },
      ComAtprotoRepoDescribeRepo: {
        lexicon: 1,
        id: "com.atproto.repo.describeRepo",
        defs: {
          main: {
            type: "query",
            description: "Get information about an account and repository, including the list of collections. Does not require auth.",
            parameters: {
              type: "params",
              required: ["repo"],
              properties: {
                repo: {
                  type: "string",
                  format: "at-identifier",
                  description: "The handle or DID of the repo."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: [
                  "handle",
                  "did",
                  "didDoc",
                  "collections",
                  "handleIsCorrect"
                ],
                properties: {
                  handle: {
                    type: "string",
                    format: "handle"
                  },
                  did: {
                    type: "string",
                    format: "did"
                  },
                  didDoc: {
                    type: "unknown",
                    description: "The complete DID document for this account."
                  },
                  collections: {
                    type: "array",
                    description: "List of all the collections (NSIDs) for which this repo contains at least one record.",
                    items: {
                      type: "string",
                      format: "nsid"
                    }
                  },
                  handleIsCorrect: {
                    type: "boolean",
                    description: "Indicates if handle is currently valid (resolves bi-directionally)"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoRepoGetRecord: {
        lexicon: 1,
        id: "com.atproto.repo.getRecord",
        defs: {
          main: {
            type: "query",
            description: "Get a single record from a repository. Does not require auth.",
            parameters: {
              type: "params",
              required: ["repo", "collection", "rkey"],
              properties: {
                repo: {
                  type: "string",
                  format: "at-identifier",
                  description: "The handle or DID of the repo."
                },
                collection: {
                  type: "string",
                  format: "nsid",
                  description: "The NSID of the record collection."
                },
                rkey: {
                  type: "string",
                  description: "The Record Key.",
                  format: "record-key"
                },
                cid: {
                  type: "string",
                  format: "cid",
                  description: "The CID of the version of the record. If not specified, then return the most recent version."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["uri", "value"],
                properties: {
                  uri: {
                    type: "string",
                    format: "at-uri"
                  },
                  cid: {
                    type: "string",
                    format: "cid"
                  },
                  value: {
                    type: "unknown"
                  }
                }
              }
            },
            errors: [
              {
                name: "RecordNotFound"
              }
            ]
          }
        }
      },
      ComAtprotoRepoImportRepo: {
        lexicon: 1,
        id: "com.atproto.repo.importRepo",
        defs: {
          main: {
            type: "procedure",
            description: "Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.",
            input: {
              encoding: "application/vnd.ipld.car"
            }
          }
        }
      },
      ComAtprotoRepoListMissingBlobs: {
        lexicon: 1,
        id: "com.atproto.repo.listMissingBlobs",
        defs: {
          main: {
            type: "query",
            description: "Returns a list of missing blobs for the requesting account. Intended to be used in the account migration flow.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 1e3,
                  default: 500
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["blobs"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  blobs: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.repo.listMissingBlobs#recordBlob"
                    }
                  }
                }
              }
            }
          },
          recordBlob: {
            type: "object",
            required: ["cid", "recordUri"],
            properties: {
              cid: {
                type: "string",
                format: "cid"
              },
              recordUri: {
                type: "string",
                format: "at-uri"
              }
            }
          }
        }
      },
      ComAtprotoRepoListRecords: {
        lexicon: 1,
        id: "com.atproto.repo.listRecords",
        defs: {
          main: {
            type: "query",
            description: "List a range of records in a repository, matching a specific collection. Does not require auth.",
            parameters: {
              type: "params",
              required: ["repo", "collection"],
              properties: {
                repo: {
                  type: "string",
                  format: "at-identifier",
                  description: "The handle or DID of the repo."
                },
                collection: {
                  type: "string",
                  format: "nsid",
                  description: "The NSID of the record type."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50,
                  description: "The number of records to return."
                },
                cursor: {
                  type: "string"
                },
                reverse: {
                  type: "boolean",
                  description: "Flag to reverse the order of the returned records."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["records"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  records: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.repo.listRecords#record"
                    }
                  }
                }
              }
            }
          },
          record: {
            type: "object",
            required: ["uri", "cid", "value"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              value: {
                type: "unknown"
              }
            }
          }
        }
      },
      ComAtprotoRepoPutRecord: {
        lexicon: 1,
        id: "com.atproto.repo.putRecord",
        defs: {
          main: {
            type: "procedure",
            description: "Write a repository record, creating or updating it as needed. Requires auth, implemented by PDS.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["repo", "collection", "rkey", "record"],
                nullable: ["swapRecord"],
                properties: {
                  repo: {
                    type: "string",
                    format: "at-identifier",
                    description: "The handle or DID of the repo (aka, current account)."
                  },
                  collection: {
                    type: "string",
                    format: "nsid",
                    description: "The NSID of the record collection."
                  },
                  rkey: {
                    type: "string",
                    format: "record-key",
                    description: "The Record Key.",
                    maxLength: 512
                  },
                  validate: {
                    type: "boolean",
                    description: "Can be set to 'false' to skip Lexicon schema validation of record data, 'true' to require it, or leave unset to validate only for known Lexicons."
                  },
                  record: {
                    type: "unknown",
                    description: "The record to write."
                  },
                  swapRecord: {
                    type: "string",
                    format: "cid",
                    description: "Compare and swap with the previous record by CID. WARNING: nullable and optional field; may cause problems with golang implementation"
                  },
                  swapCommit: {
                    type: "string",
                    format: "cid",
                    description: "Compare and swap with the previous commit by CID."
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["uri", "cid"],
                properties: {
                  uri: {
                    type: "string",
                    format: "at-uri"
                  },
                  cid: {
                    type: "string",
                    format: "cid"
                  },
                  commit: {
                    type: "ref",
                    ref: "lex:com.atproto.repo.defs#commitMeta"
                  },
                  validationStatus: {
                    type: "string",
                    knownValues: ["valid", "unknown"]
                  }
                }
              }
            },
            errors: [
              {
                name: "InvalidSwap"
              }
            ]
          }
        }
      },
      ComAtprotoRepoStrongRef: {
        lexicon: 1,
        id: "com.atproto.repo.strongRef",
        description: "A URI with a content-hash fingerprint.",
        defs: {
          main: {
            type: "object",
            required: ["uri", "cid"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              }
            }
          }
        }
      },
      ComAtprotoRepoUploadBlob: {
        lexicon: 1,
        id: "com.atproto.repo.uploadBlob",
        defs: {
          main: {
            type: "procedure",
            description: "Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS.",
            input: {
              encoding: "*/*"
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["blob"],
                properties: {
                  blob: {
                    type: "blob"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoServerActivateAccount: {
        lexicon: 1,
        id: "com.atproto.server.activateAccount",
        defs: {
          main: {
            type: "procedure",
            description: "Activates a currently deactivated account. Used to finalize account migration after the account's repo is imported and identity is setup."
          }
        }
      },
      ComAtprotoServerCheckAccountStatus: {
        lexicon: 1,
        id: "com.atproto.server.checkAccountStatus",
        defs: {
          main: {
            type: "query",
            description: "Returns the status of an account, especially as pertaining to import or recovery. Can be called many times over the course of an account migration. Requires auth and can only be called pertaining to oneself.",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: [
                  "activated",
                  "validDid",
                  "repoCommit",
                  "repoRev",
                  "repoBlocks",
                  "indexedRecords",
                  "privateStateValues",
                  "expectedBlobs",
                  "importedBlobs"
                ],
                properties: {
                  activated: {
                    type: "boolean"
                  },
                  validDid: {
                    type: "boolean"
                  },
                  repoCommit: {
                    type: "string",
                    format: "cid"
                  },
                  repoRev: {
                    type: "string"
                  },
                  repoBlocks: {
                    type: "integer"
                  },
                  indexedRecords: {
                    type: "integer"
                  },
                  privateStateValues: {
                    type: "integer"
                  },
                  expectedBlobs: {
                    type: "integer"
                  },
                  importedBlobs: {
                    type: "integer"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoServerConfirmEmail: {
        lexicon: 1,
        id: "com.atproto.server.confirmEmail",
        defs: {
          main: {
            type: "procedure",
            description: "Confirm an email using a token from com.atproto.server.requestEmailConfirmation.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["email", "token"],
                properties: {
                  email: {
                    type: "string"
                  },
                  token: {
                    type: "string"
                  }
                }
              }
            },
            errors: [
              {
                name: "AccountNotFound"
              },
              {
                name: "ExpiredToken"
              },
              {
                name: "InvalidToken"
              },
              {
                name: "InvalidEmail"
              }
            ]
          }
        }
      },
      ComAtprotoServerCreateAccount: {
        lexicon: 1,
        id: "com.atproto.server.createAccount",
        defs: {
          main: {
            type: "procedure",
            description: "Create an account. Implemented by PDS.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["handle"],
                properties: {
                  email: {
                    type: "string"
                  },
                  handle: {
                    type: "string",
                    format: "handle",
                    description: "Requested handle for the account."
                  },
                  did: {
                    type: "string",
                    format: "did",
                    description: "Pre-existing atproto DID, being imported to a new account."
                  },
                  inviteCode: {
                    type: "string"
                  },
                  verificationCode: {
                    type: "string"
                  },
                  verificationPhone: {
                    type: "string"
                  },
                  password: {
                    type: "string",
                    description: "Initial account password. May need to meet instance-specific password strength requirements."
                  },
                  recoveryKey: {
                    type: "string",
                    description: "DID PLC rotation key (aka, recovery key) to be included in PLC creation operation."
                  },
                  plcOp: {
                    type: "unknown",
                    description: "A signed DID PLC operation to be submitted as part of importing an existing account to this instance. NOTE: this optional field may be updated when full account migration is implemented."
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                description: "Account login session returned on successful account creation.",
                required: ["accessJwt", "refreshJwt", "handle", "did"],
                properties: {
                  accessJwt: {
                    type: "string"
                  },
                  refreshJwt: {
                    type: "string"
                  },
                  handle: {
                    type: "string",
                    format: "handle"
                  },
                  did: {
                    type: "string",
                    format: "did",
                    description: "The DID of the new account."
                  },
                  didDoc: {
                    type: "unknown",
                    description: "Complete DID document."
                  }
                }
              }
            },
            errors: [
              {
                name: "InvalidHandle"
              },
              {
                name: "InvalidPassword"
              },
              {
                name: "InvalidInviteCode"
              },
              {
                name: "HandleNotAvailable"
              },
              {
                name: "UnsupportedDomain"
              },
              {
                name: "UnresolvableDid"
              },
              {
                name: "IncompatibleDidDoc"
              }
            ]
          }
        }
      },
      ComAtprotoServerCreateAppPassword: {
        lexicon: 1,
        id: "com.atproto.server.createAppPassword",
        defs: {
          main: {
            type: "procedure",
            description: "Create an App Password.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["name"],
                properties: {
                  name: {
                    type: "string",
                    description: "A short name for the App Password, to help distinguish them."
                  },
                  privileged: {
                    type: "boolean",
                    description: "If an app password has 'privileged' access to possibly sensitive account state. Meant for use with trusted clients."
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:com.atproto.server.createAppPassword#appPassword"
              }
            },
            errors: [
              {
                name: "AccountTakedown"
              }
            ]
          },
          appPassword: {
            type: "object",
            required: ["name", "password", "createdAt"],
            properties: {
              name: {
                type: "string"
              },
              password: {
                type: "string"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              privileged: {
                type: "boolean"
              }
            }
          }
        }
      },
      ComAtprotoServerCreateInviteCode: {
        lexicon: 1,
        id: "com.atproto.server.createInviteCode",
        defs: {
          main: {
            type: "procedure",
            description: "Create an invite code.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["useCount"],
                properties: {
                  useCount: {
                    type: "integer"
                  },
                  forAccount: {
                    type: "string",
                    format: "did"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["code"],
                properties: {
                  code: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoServerCreateInviteCodes: {
        lexicon: 1,
        id: "com.atproto.server.createInviteCodes",
        defs: {
          main: {
            type: "procedure",
            description: "Create invite codes.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["codeCount", "useCount"],
                properties: {
                  codeCount: {
                    type: "integer",
                    default: 1
                  },
                  useCount: {
                    type: "integer"
                  },
                  forAccounts: {
                    type: "array",
                    items: {
                      type: "string",
                      format: "did"
                    }
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["codes"],
                properties: {
                  codes: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.server.createInviteCodes#accountCodes"
                    }
                  }
                }
              }
            }
          },
          accountCodes: {
            type: "object",
            required: ["account", "codes"],
            properties: {
              account: {
                type: "string"
              },
              codes: {
                type: "array",
                items: {
                  type: "string"
                }
              }
            }
          }
        }
      },
      ComAtprotoServerCreateSession: {
        lexicon: 1,
        id: "com.atproto.server.createSession",
        defs: {
          main: {
            type: "procedure",
            description: "Create an authentication session.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["identifier", "password"],
                properties: {
                  identifier: {
                    type: "string",
                    description: "Handle or other identifier supported by the server for the authenticating user."
                  },
                  password: {
                    type: "string"
                  },
                  authFactorToken: {
                    type: "string"
                  },
                  allowTakendown: {
                    type: "boolean",
                    description: "When true, instead of throwing error for takendown accounts, a valid response with a narrow scoped token will be returned"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["accessJwt", "refreshJwt", "handle", "did"],
                properties: {
                  accessJwt: {
                    type: "string"
                  },
                  refreshJwt: {
                    type: "string"
                  },
                  handle: {
                    type: "string",
                    format: "handle"
                  },
                  did: {
                    type: "string",
                    format: "did"
                  },
                  didDoc: {
                    type: "unknown"
                  },
                  email: {
                    type: "string"
                  },
                  emailConfirmed: {
                    type: "boolean"
                  },
                  emailAuthFactor: {
                    type: "boolean"
                  },
                  active: {
                    type: "boolean"
                  },
                  status: {
                    type: "string",
                    description: "If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.",
                    knownValues: ["takendown", "suspended", "deactivated"]
                  }
                }
              }
            },
            errors: [
              {
                name: "AccountTakedown"
              },
              {
                name: "AuthFactorTokenRequired"
              }
            ]
          }
        }
      },
      ComAtprotoServerDeactivateAccount: {
        lexicon: 1,
        id: "com.atproto.server.deactivateAccount",
        defs: {
          main: {
            type: "procedure",
            description: "Deactivates a currently active account. Stops serving of repo, and future writes to repo until reactivated. Used to finalize account migration with the old host after the account has been activated on the new host.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  deleteAfter: {
                    type: "string",
                    format: "datetime",
                    description: "A recommendation to server as to how long they should hold onto the deactivated account before deleting."
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoServerDefs: {
        lexicon: 1,
        id: "com.atproto.server.defs",
        defs: {
          inviteCode: {
            type: "object",
            required: [
              "code",
              "available",
              "disabled",
              "forAccount",
              "createdBy",
              "createdAt",
              "uses"
            ],
            properties: {
              code: {
                type: "string"
              },
              available: {
                type: "integer"
              },
              disabled: {
                type: "boolean"
              },
              forAccount: {
                type: "string"
              },
              createdBy: {
                type: "string"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              uses: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.server.defs#inviteCodeUse"
                }
              }
            }
          },
          inviteCodeUse: {
            type: "object",
            required: ["usedBy", "usedAt"],
            properties: {
              usedBy: {
                type: "string",
                format: "did"
              },
              usedAt: {
                type: "string",
                format: "datetime"
              }
            }
          }
        }
      },
      ComAtprotoServerDeleteAccount: {
        lexicon: 1,
        id: "com.atproto.server.deleteAccount",
        defs: {
          main: {
            type: "procedure",
            description: "Delete an actor's account with a token and password. Can only be called after requesting a deletion token. Requires auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did", "password", "token"],
                properties: {
                  did: {
                    type: "string",
                    format: "did"
                  },
                  password: {
                    type: "string"
                  },
                  token: {
                    type: "string"
                  }
                }
              }
            },
            errors: [
              {
                name: "ExpiredToken"
              },
              {
                name: "InvalidToken"
              }
            ]
          }
        }
      },
      ComAtprotoServerDeleteSession: {
        lexicon: 1,
        id: "com.atproto.server.deleteSession",
        defs: {
          main: {
            type: "procedure",
            description: "Delete the current session. Requires auth."
          }
        }
      },
      ComAtprotoServerDescribeServer: {
        lexicon: 1,
        id: "com.atproto.server.describeServer",
        defs: {
          main: {
            type: "query",
            description: "Describes the server's account creation requirements and capabilities. Implemented by PDS.",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did", "availableUserDomains"],
                properties: {
                  inviteCodeRequired: {
                    type: "boolean",
                    description: "If true, an invite code must be supplied to create an account on this instance."
                  },
                  phoneVerificationRequired: {
                    type: "boolean",
                    description: "If true, a phone verification token must be supplied to create an account on this instance."
                  },
                  availableUserDomains: {
                    type: "array",
                    description: "List of domain suffixes that can be used in account handles.",
                    items: {
                      type: "string"
                    }
                  },
                  links: {
                    type: "ref",
                    description: "URLs of service policy documents.",
                    ref: "lex:com.atproto.server.describeServer#links"
                  },
                  contact: {
                    type: "ref",
                    description: "Contact information",
                    ref: "lex:com.atproto.server.describeServer#contact"
                  },
                  did: {
                    type: "string",
                    format: "did"
                  }
                }
              }
            }
          },
          links: {
            type: "object",
            properties: {
              privacyPolicy: {
                type: "string",
                format: "uri"
              },
              termsOfService: {
                type: "string",
                format: "uri"
              }
            }
          },
          contact: {
            type: "object",
            properties: {
              email: {
                type: "string"
              }
            }
          }
        }
      },
      ComAtprotoServerGetAccountInviteCodes: {
        lexicon: 1,
        id: "com.atproto.server.getAccountInviteCodes",
        defs: {
          main: {
            type: "query",
            description: "Get all invite codes for the current account. Requires auth.",
            parameters: {
              type: "params",
              properties: {
                includeUsed: {
                  type: "boolean",
                  default: true
                },
                createAvailable: {
                  type: "boolean",
                  default: true,
                  description: "Controls whether any new 'earned' but not 'created' invites should be created."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["codes"],
                properties: {
                  codes: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.server.defs#inviteCode"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "DuplicateCreate"
              }
            ]
          }
        }
      },
      ComAtprotoServerGetServiceAuth: {
        lexicon: 1,
        id: "com.atproto.server.getServiceAuth",
        defs: {
          main: {
            type: "query",
            description: "Get a signed token on behalf of the requesting DID for the requested service.",
            parameters: {
              type: "params",
              required: ["aud"],
              properties: {
                aud: {
                  type: "string",
                  format: "did",
                  description: "The DID of the service that the token will be used to authenticate with"
                },
                exp: {
                  type: "integer",
                  description: "The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope."
                },
                lxm: {
                  type: "string",
                  format: "nsid",
                  description: "Lexicon (XRPC) method to bind the requested token to"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["token"],
                properties: {
                  token: {
                    type: "string"
                  }
                }
              }
            },
            errors: [
              {
                name: "BadExpiration",
                description: "Indicates that the requested expiration date is not a valid. May be in the past or may be reliant on the requested scopes."
              }
            ]
          }
        }
      },
      ComAtprotoServerGetSession: {
        lexicon: 1,
        id: "com.atproto.server.getSession",
        defs: {
          main: {
            type: "query",
            description: "Get information about the current auth session. Requires auth.",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["handle", "did"],
                properties: {
                  handle: {
                    type: "string",
                    format: "handle"
                  },
                  did: {
                    type: "string",
                    format: "did"
                  },
                  email: {
                    type: "string"
                  },
                  emailConfirmed: {
                    type: "boolean"
                  },
                  emailAuthFactor: {
                    type: "boolean"
                  },
                  didDoc: {
                    type: "unknown"
                  },
                  active: {
                    type: "boolean"
                  },
                  status: {
                    type: "string",
                    description: "If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.",
                    knownValues: ["takendown", "suspended", "deactivated"]
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoServerListAppPasswords: {
        lexicon: 1,
        id: "com.atproto.server.listAppPasswords",
        defs: {
          main: {
            type: "query",
            description: "List all App Passwords.",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["passwords"],
                properties: {
                  passwords: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.server.listAppPasswords#appPassword"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "AccountTakedown"
              }
            ]
          },
          appPassword: {
            type: "object",
            required: ["name", "createdAt"],
            properties: {
              name: {
                type: "string"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              privileged: {
                type: "boolean"
              }
            }
          }
        }
      },
      ComAtprotoServerRefreshSession: {
        lexicon: 1,
        id: "com.atproto.server.refreshSession",
        defs: {
          main: {
            type: "procedure",
            description: "Refresh an authentication session. Requires auth using the 'refreshJwt' (not the 'accessJwt').",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["accessJwt", "refreshJwt", "handle", "did"],
                properties: {
                  accessJwt: {
                    type: "string"
                  },
                  refreshJwt: {
                    type: "string"
                  },
                  handle: {
                    type: "string",
                    format: "handle"
                  },
                  did: {
                    type: "string",
                    format: "did"
                  },
                  didDoc: {
                    type: "unknown"
                  },
                  active: {
                    type: "boolean"
                  },
                  status: {
                    type: "string",
                    description: "Hosting status of the account. If not specified, then assume 'active'.",
                    knownValues: ["takendown", "suspended", "deactivated"]
                  }
                }
              }
            },
            errors: [
              {
                name: "AccountTakedown"
              }
            ]
          }
        }
      },
      ComAtprotoServerRequestAccountDelete: {
        lexicon: 1,
        id: "com.atproto.server.requestAccountDelete",
        defs: {
          main: {
            type: "procedure",
            description: "Initiate a user account deletion via email."
          }
        }
      },
      ComAtprotoServerRequestEmailConfirmation: {
        lexicon: 1,
        id: "com.atproto.server.requestEmailConfirmation",
        defs: {
          main: {
            type: "procedure",
            description: "Request an email with a code to confirm ownership of email."
          }
        }
      },
      ComAtprotoServerRequestEmailUpdate: {
        lexicon: 1,
        id: "com.atproto.server.requestEmailUpdate",
        defs: {
          main: {
            type: "procedure",
            description: "Request a token in order to update email.",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["tokenRequired"],
                properties: {
                  tokenRequired: {
                    type: "boolean"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoServerRequestPasswordReset: {
        lexicon: 1,
        id: "com.atproto.server.requestPasswordReset",
        defs: {
          main: {
            type: "procedure",
            description: "Initiate a user account password reset via email.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["email"],
                properties: {
                  email: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoServerReserveSigningKey: {
        lexicon: 1,
        id: "com.atproto.server.reserveSigningKey",
        defs: {
          main: {
            type: "procedure",
            description: "Reserve a repo signing key, for use with account creation. Necessary so that a DID PLC update operation can be constructed during an account migraiton. Public and does not require auth; implemented by PDS. NOTE: this endpoint may change when full account migration is implemented.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  did: {
                    type: "string",
                    format: "did",
                    description: "The DID to reserve a key for."
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["signingKey"],
                properties: {
                  signingKey: {
                    type: "string",
                    description: "The public key for the reserved signing key, in did:key serialization."
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoServerResetPassword: {
        lexicon: 1,
        id: "com.atproto.server.resetPassword",
        defs: {
          main: {
            type: "procedure",
            description: "Reset a user account password using a token.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["token", "password"],
                properties: {
                  token: {
                    type: "string"
                  },
                  password: {
                    type: "string"
                  }
                }
              }
            },
            errors: [
              {
                name: "ExpiredToken"
              },
              {
                name: "InvalidToken"
              }
            ]
          }
        }
      },
      ComAtprotoServerRevokeAppPassword: {
        lexicon: 1,
        id: "com.atproto.server.revokeAppPassword",
        defs: {
          main: {
            type: "procedure",
            description: "Revoke an App Password by name.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["name"],
                properties: {
                  name: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoServerUpdateEmail: {
        lexicon: 1,
        id: "com.atproto.server.updateEmail",
        defs: {
          main: {
            type: "procedure",
            description: "Update an account's email.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["email"],
                properties: {
                  email: {
                    type: "string"
                  },
                  emailAuthFactor: {
                    type: "boolean"
                  },
                  token: {
                    type: "string",
                    description: "Requires a token from com.atproto.sever.requestEmailUpdate if the account's email has been confirmed."
                  }
                }
              }
            },
            errors: [
              {
                name: "ExpiredToken"
              },
              {
                name: "InvalidToken"
              },
              {
                name: "TokenRequired"
              }
            ]
          }
        }
      },
      ComAtprotoSyncDefs: {
        lexicon: 1,
        id: "com.atproto.sync.defs",
        defs: {
          hostStatus: {
            type: "string",
            knownValues: ["active", "idle", "offline", "throttled", "banned"]
          }
        }
      },
      ComAtprotoSyncGetBlob: {
        lexicon: 1,
        id: "com.atproto.sync.getBlob",
        defs: {
          main: {
            type: "query",
            description: "Get a blob associated with a given account. Returns the full blob as originally uploaded. Does not require auth; implemented by PDS.",
            parameters: {
              type: "params",
              required: ["did", "cid"],
              properties: {
                did: {
                  type: "string",
                  format: "did",
                  description: "The DID of the account."
                },
                cid: {
                  type: "string",
                  format: "cid",
                  description: "The CID of the blob to fetch"
                }
              }
            },
            output: {
              encoding: "*/*"
            },
            errors: [
              {
                name: "BlobNotFound"
              },
              {
                name: "RepoNotFound"
              },
              {
                name: "RepoTakendown"
              },
              {
                name: "RepoSuspended"
              },
              {
                name: "RepoDeactivated"
              }
            ]
          }
        }
      },
      ComAtprotoSyncGetBlocks: {
        lexicon: 1,
        id: "com.atproto.sync.getBlocks",
        defs: {
          main: {
            type: "query",
            description: "Get data blocks from a given repo, by CID. For example, intermediate MST nodes, or records. Does not require auth; implemented by PDS.",
            parameters: {
              type: "params",
              required: ["did", "cids"],
              properties: {
                did: {
                  type: "string",
                  format: "did",
                  description: "The DID of the repo."
                },
                cids: {
                  type: "array",
                  items: {
                    type: "string",
                    format: "cid"
                  }
                }
              }
            },
            output: {
              encoding: "application/vnd.ipld.car"
            },
            errors: [
              {
                name: "BlockNotFound"
              },
              {
                name: "RepoNotFound"
              },
              {
                name: "RepoTakendown"
              },
              {
                name: "RepoSuspended"
              },
              {
                name: "RepoDeactivated"
              }
            ]
          }
        }
      },
      ComAtprotoSyncGetCheckout: {
        lexicon: 1,
        id: "com.atproto.sync.getCheckout",
        defs: {
          main: {
            type: "query",
            description: "DEPRECATED - please use com.atproto.sync.getRepo instead",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did",
                  description: "The DID of the repo."
                }
              }
            },
            output: {
              encoding: "application/vnd.ipld.car"
            }
          }
        }
      },
      ComAtprotoSyncGetHead: {
        lexicon: 1,
        id: "com.atproto.sync.getHead",
        defs: {
          main: {
            type: "query",
            description: "DEPRECATED - please use com.atproto.sync.getLatestCommit instead",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did",
                  description: "The DID of the repo."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["root"],
                properties: {
                  root: {
                    type: "string",
                    format: "cid"
                  }
                }
              }
            },
            errors: [
              {
                name: "HeadNotFound"
              }
            ]
          }
        }
      },
      ComAtprotoSyncGetHostStatus: {
        lexicon: 1,
        id: "com.atproto.sync.getHostStatus",
        defs: {
          main: {
            type: "query",
            description: "Returns information about a specified upstream host, as consumed by the server. Implemented by relays.",
            parameters: {
              type: "params",
              required: ["hostname"],
              properties: {
                hostname: {
                  type: "string",
                  description: "Hostname of the host (eg, PDS or relay) being queried."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["hostname"],
                properties: {
                  hostname: {
                    type: "string"
                  },
                  seq: {
                    type: "integer",
                    description: "Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor)."
                  },
                  accountCount: {
                    type: "integer",
                    description: "Number of accounts on the server which are associated with the upstream host. Note that the upstream may actually have more accounts."
                  },
                  status: {
                    type: "ref",
                    ref: "lex:com.atproto.sync.defs#hostStatus"
                  }
                }
              }
            },
            errors: [
              {
                name: "HostNotFound"
              }
            ]
          }
        }
      },
      ComAtprotoSyncGetLatestCommit: {
        lexicon: 1,
        id: "com.atproto.sync.getLatestCommit",
        defs: {
          main: {
            type: "query",
            description: "Get the current commit CID & revision of the specified repo. Does not require auth.",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did",
                  description: "The DID of the repo."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["cid", "rev"],
                properties: {
                  cid: {
                    type: "string",
                    format: "cid"
                  },
                  rev: {
                    type: "string",
                    format: "tid"
                  }
                }
              }
            },
            errors: [
              {
                name: "RepoNotFound"
              },
              {
                name: "RepoTakendown"
              },
              {
                name: "RepoSuspended"
              },
              {
                name: "RepoDeactivated"
              }
            ]
          }
        }
      },
      ComAtprotoSyncGetRecord: {
        lexicon: 1,
        id: "com.atproto.sync.getRecord",
        defs: {
          main: {
            type: "query",
            description: "Get data blocks needed to prove the existence or non-existence of record in the current version of repo. Does not require auth.",
            parameters: {
              type: "params",
              required: ["did", "collection", "rkey"],
              properties: {
                did: {
                  type: "string",
                  format: "did",
                  description: "The DID of the repo."
                },
                collection: {
                  type: "string",
                  format: "nsid"
                },
                rkey: {
                  type: "string",
                  description: "Record Key",
                  format: "record-key"
                }
              }
            },
            output: {
              encoding: "application/vnd.ipld.car"
            },
            errors: [
              {
                name: "RecordNotFound"
              },
              {
                name: "RepoNotFound"
              },
              {
                name: "RepoTakendown"
              },
              {
                name: "RepoSuspended"
              },
              {
                name: "RepoDeactivated"
              }
            ]
          }
        }
      },
      ComAtprotoSyncGetRepo: {
        lexicon: 1,
        id: "com.atproto.sync.getRepo",
        defs: {
          main: {
            type: "query",
            description: "Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS.",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did",
                  description: "The DID of the repo."
                },
                since: {
                  type: "string",
                  format: "tid",
                  description: "The revision ('rev') of the repo to create a diff from."
                }
              }
            },
            output: {
              encoding: "application/vnd.ipld.car"
            },
            errors: [
              {
                name: "RepoNotFound"
              },
              {
                name: "RepoTakendown"
              },
              {
                name: "RepoSuspended"
              },
              {
                name: "RepoDeactivated"
              }
            ]
          }
        }
      },
      ComAtprotoSyncGetRepoStatus: {
        lexicon: 1,
        id: "com.atproto.sync.getRepoStatus",
        defs: {
          main: {
            type: "query",
            description: "Get the hosting status for a repository, on this server. Expected to be implemented by PDS and Relay.",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did",
                  description: "The DID of the repo."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did", "active"],
                properties: {
                  did: {
                    type: "string",
                    format: "did"
                  },
                  active: {
                    type: "boolean"
                  },
                  status: {
                    type: "string",
                    description: "If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.",
                    knownValues: [
                      "takendown",
                      "suspended",
                      "deleted",
                      "deactivated",
                      "desynchronized",
                      "throttled"
                    ]
                  },
                  rev: {
                    type: "string",
                    format: "tid",
                    description: "Optional field, the current rev of the repo, if active=true"
                  }
                }
              }
            },
            errors: [
              {
                name: "RepoNotFound"
              }
            ]
          }
        }
      },
      ComAtprotoSyncListBlobs: {
        lexicon: 1,
        id: "com.atproto.sync.listBlobs",
        defs: {
          main: {
            type: "query",
            description: "List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS.",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did",
                  description: "The DID of the repo."
                },
                since: {
                  type: "string",
                  format: "tid",
                  description: "Optional revision of the repo to list blobs since."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 1e3,
                  default: 500
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["cids"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  cids: {
                    type: "array",
                    items: {
                      type: "string",
                      format: "cid"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "RepoNotFound"
              },
              {
                name: "RepoTakendown"
              },
              {
                name: "RepoSuspended"
              },
              {
                name: "RepoDeactivated"
              }
            ]
          }
        }
      },
      ComAtprotoSyncListHosts: {
        lexicon: 1,
        id: "com.atproto.sync.listHosts",
        defs: {
          main: {
            type: "query",
            description: "Enumerates upstream hosts (eg, PDS or relay instances) that this service consumes from. Implemented by relays.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 1e3,
                  default: 200
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["hosts"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  hosts: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.sync.listHosts#host"
                    },
                    description: "Sort order is not formally specified. Recommended order is by time host was first seen by the server, with oldest first."
                  }
                }
              }
            }
          },
          host: {
            type: "object",
            required: ["hostname"],
            properties: {
              hostname: {
                type: "string",
                description: "hostname of server; not a URL (no scheme)"
              },
              seq: {
                type: "integer",
                description: "Recent repo stream event sequence number. May be delayed from actual stream processing (eg, persisted cursor not in-memory cursor)."
              },
              accountCount: {
                type: "integer"
              },
              status: {
                type: "ref",
                ref: "lex:com.atproto.sync.defs#hostStatus"
              }
            }
          }
        }
      },
      ComAtprotoSyncListRepos: {
        lexicon: 1,
        id: "com.atproto.sync.listRepos",
        defs: {
          main: {
            type: "query",
            description: "Enumerates all the DID, rev, and commit CID for all repos hosted by this service. Does not require auth; implemented by PDS and Relay.",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 1e3,
                  default: 500
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["repos"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  repos: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.sync.listRepos#repo"
                    }
                  }
                }
              }
            }
          },
          repo: {
            type: "object",
            required: ["did", "head", "rev"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              head: {
                type: "string",
                format: "cid",
                description: "Current repo commit CID"
              },
              rev: {
                type: "string",
                format: "tid"
              },
              active: {
                type: "boolean"
              },
              status: {
                type: "string",
                description: "If active=false, this optional field indicates a possible reason for why the account is not active. If active=false and no status is supplied, then the host makes no claim for why the repository is no longer being hosted.",
                knownValues: [
                  "takendown",
                  "suspended",
                  "deleted",
                  "deactivated",
                  "desynchronized",
                  "throttled"
                ]
              }
            }
          }
        }
      },
      ComAtprotoSyncListReposByCollection: {
        lexicon: 1,
        id: "com.atproto.sync.listReposByCollection",
        defs: {
          main: {
            type: "query",
            description: "Enumerates all the DIDs which have records with the given collection NSID.",
            parameters: {
              type: "params",
              required: ["collection"],
              properties: {
                collection: {
                  type: "string",
                  format: "nsid"
                },
                limit: {
                  type: "integer",
                  description: "Maximum size of response set. Recommend setting a large maximum (1000+) when enumerating large DID lists.",
                  minimum: 1,
                  maximum: 2e3,
                  default: 500
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["repos"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  repos: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.sync.listReposByCollection#repo"
                    }
                  }
                }
              }
            }
          },
          repo: {
            type: "object",
            required: ["did"],
            properties: {
              did: {
                type: "string",
                format: "did"
              }
            }
          }
        }
      },
      ComAtprotoSyncNotifyOfUpdate: {
        lexicon: 1,
        id: "com.atproto.sync.notifyOfUpdate",
        defs: {
          main: {
            type: "procedure",
            description: "Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay. DEPRECATED: just use com.atproto.sync.requestCrawl",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["hostname"],
                properties: {
                  hostname: {
                    type: "string",
                    description: "Hostname of the current service (usually a PDS) that is notifying of update."
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoSyncRequestCrawl: {
        lexicon: 1,
        id: "com.atproto.sync.requestCrawl",
        defs: {
          main: {
            type: "procedure",
            description: "Request a service to persistently crawl hosted repos. Expected use is new PDS instances declaring their existence to Relays. Does not require auth.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["hostname"],
                properties: {
                  hostname: {
                    type: "string",
                    description: "Hostname of the current service (eg, PDS) that is requesting to be crawled."
                  }
                }
              }
            },
            errors: [
              {
                name: "HostBanned"
              }
            ]
          }
        }
      },
      ComAtprotoSyncSubscribeRepos: {
        lexicon: 1,
        id: "com.atproto.sync.subscribeRepos",
        defs: {
          main: {
            type: "subscription",
            description: "Repository event stream, aka Firehose endpoint. Outputs repo commits with diff data, and identity update events, for all repositories on the current server. See the atproto specifications for details around stream sequencing, repo versioning, CAR diff format, and more. Public and does not require auth; implemented by PDS and Relay.",
            parameters: {
              type: "params",
              properties: {
                cursor: {
                  type: "integer",
                  description: "The last known event seq number to backfill from."
                }
              }
            },
            message: {
              schema: {
                type: "union",
                refs: [
                  "lex:com.atproto.sync.subscribeRepos#commit",
                  "lex:com.atproto.sync.subscribeRepos#sync",
                  "lex:com.atproto.sync.subscribeRepos#identity",
                  "lex:com.atproto.sync.subscribeRepos#account",
                  "lex:com.atproto.sync.subscribeRepos#info"
                ]
              }
            },
            errors: [
              {
                name: "FutureCursor"
              },
              {
                name: "ConsumerTooSlow",
                description: "If the consumer of the stream can not keep up with events, and a backlog gets too large, the server will drop the connection."
              }
            ]
          },
          commit: {
            type: "object",
            description: "Represents an update of repository state. Note that empty commits are allowed, which include no repo data changes, but an update to rev and signature.",
            required: [
              "seq",
              "rebase",
              "tooBig",
              "repo",
              "commit",
              "rev",
              "since",
              "blocks",
              "ops",
              "blobs",
              "time"
            ],
            nullable: ["since"],
            properties: {
              seq: {
                type: "integer",
                description: "The stream sequence number of this message."
              },
              rebase: {
                type: "boolean",
                description: "DEPRECATED -- unused"
              },
              tooBig: {
                type: "boolean",
                description: "DEPRECATED -- replaced by #sync event and data limits. Indicates that this commit contained too many ops, or data size was too large. Consumers will need to make a separate request to get missing data."
              },
              repo: {
                type: "string",
                format: "did",
                description: "The repo this event comes from. Note that all other message types name this field 'did'."
              },
              commit: {
                type: "cid-link",
                description: "Repo commit object CID."
              },
              rev: {
                type: "string",
                format: "tid",
                description: "The rev of the emitted commit. Note that this information is also in the commit object included in blocks, unless this is a tooBig event."
              },
              since: {
                type: "string",
                format: "tid",
                description: "The rev of the last emitted commit from this repo (if any)."
              },
              blocks: {
                type: "bytes",
                description: "CAR file containing relevant blocks, as a diff since the previous repo state. The commit must be included as a block, and the commit block CID must be the first entry in the CAR header 'roots' list.",
                maxLength: 2e6
              },
              ops: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.sync.subscribeRepos#repoOp",
                  description: "List of repo mutation operations in this commit (eg, records created, updated, or deleted)."
                },
                maxLength: 200
              },
              blobs: {
                type: "array",
                items: {
                  type: "cid-link",
                  description: "DEPRECATED -- will soon always be empty. List of new blobs (by CID) referenced by records in this commit."
                }
              },
              prevData: {
                type: "cid-link",
                description: "The root CID of the MST tree for the previous commit from this repo (indicated by the 'since' revision field in this message). Corresponds to the 'data' field in the repo commit object. NOTE: this field is effectively required for the 'inductive' version of firehose."
              },
              time: {
                type: "string",
                format: "datetime",
                description: "Timestamp of when this message was originally broadcast."
              }
            }
          },
          sync: {
            type: "object",
            description: "Updates the repo to a new state, without necessarily including that state on the firehose. Used to recover from broken commit streams, data loss incidents, or in situations where upstream host does not know recent state of the repository.",
            required: ["seq", "did", "blocks", "rev", "time"],
            properties: {
              seq: {
                type: "integer",
                description: "The stream sequence number of this message."
              },
              did: {
                type: "string",
                format: "did",
                description: "The account this repo event corresponds to. Must match that in the commit object."
              },
              blocks: {
                type: "bytes",
                description: "CAR file containing the commit, as a block. The CAR header must include the commit block CID as the first 'root'.",
                maxLength: 1e4
              },
              rev: {
                type: "string",
                description: "The rev of the commit. This value must match that in the commit object."
              },
              time: {
                type: "string",
                format: "datetime",
                description: "Timestamp of when this message was originally broadcast."
              }
            }
          },
          identity: {
            type: "object",
            description: "Represents a change to an account's identity. Could be an updated handle, signing key, or pds hosting endpoint. Serves as a prod to all downstream services to refresh their identity cache.",
            required: ["seq", "did", "time"],
            properties: {
              seq: {
                type: "integer"
              },
              did: {
                type: "string",
                format: "did"
              },
              time: {
                type: "string",
                format: "datetime"
              },
              handle: {
                type: "string",
                format: "handle",
                description: "The current handle for the account, or 'handle.invalid' if validation fails. This field is optional, might have been validated or passed-through from an upstream source. Semantics and behaviors for PDS vs Relay may evolve in the future; see atproto specs for more details."
              }
            }
          },
          account: {
            type: "object",
            description: "Represents a change to an account's status on a host (eg, PDS or Relay). The semantics of this event are that the status is at the host which emitted the event, not necessarily that at the currently active PDS. Eg, a Relay takedown would emit a takedown with active=false, even if the PDS is still active.",
            required: ["seq", "did", "time", "active"],
            properties: {
              seq: {
                type: "integer"
              },
              did: {
                type: "string",
                format: "did"
              },
              time: {
                type: "string",
                format: "datetime"
              },
              active: {
                type: "boolean",
                description: "Indicates that the account has a repository which can be fetched from the host that emitted this event."
              },
              status: {
                type: "string",
                description: "If active=false, this optional field indicates a reason for why the account is not active.",
                knownValues: [
                  "takendown",
                  "suspended",
                  "deleted",
                  "deactivated",
                  "desynchronized",
                  "throttled"
                ]
              }
            }
          },
          info: {
            type: "object",
            required: ["name"],
            properties: {
              name: {
                type: "string",
                knownValues: ["OutdatedCursor"]
              },
              message: {
                type: "string"
              }
            }
          },
          repoOp: {
            type: "object",
            description: "A repo operation, ie a mutation of a single record.",
            required: ["action", "path", "cid"],
            nullable: ["cid"],
            properties: {
              action: {
                type: "string",
                knownValues: ["create", "update", "delete"]
              },
              path: {
                type: "string"
              },
              cid: {
                type: "cid-link",
                description: "For creates and updates, the new record CID. For deletions, null."
              },
              prev: {
                type: "cid-link",
                description: "For updates and deletes, the previous record CID (required for inductive firehose). For creations, field should not be defined."
              }
            }
          }
        }
      },
      ComAtprotoTempAddReservedHandle: {
        lexicon: 1,
        id: "com.atproto.temp.addReservedHandle",
        defs: {
          main: {
            type: "procedure",
            description: "Add a handle to the set of reserved handles.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["handle"],
                properties: {
                  handle: {
                    type: "string"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {}
              }
            }
          }
        }
      },
      ComAtprotoTempCheckHandleAvailability: {
        lexicon: 1,
        id: "com.atproto.temp.checkHandleAvailability",
        defs: {
          main: {
            type: "query",
            description: "Checks whether the provided handle is available. If the handle is not available, available suggestions will be returned. Optional inputs will be used to generate suggestions.",
            parameters: {
              type: "params",
              required: ["handle"],
              properties: {
                handle: {
                  type: "string",
                  format: "handle",
                  description: "Tentative handle. Will be checked for availability or used to build handle suggestions."
                },
                email: {
                  type: "string",
                  description: "User-provided email. Might be used to build handle suggestions."
                },
                birthDate: {
                  type: "string",
                  format: "datetime",
                  description: "User-provided birth date. Might be used to build handle suggestions."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["handle", "result"],
                properties: {
                  handle: {
                    type: "string",
                    format: "handle",
                    description: "Echo of the input handle."
                  },
                  result: {
                    type: "union",
                    refs: [
                      "lex:com.atproto.temp.checkHandleAvailability#resultAvailable",
                      "lex:com.atproto.temp.checkHandleAvailability#resultUnavailable"
                    ]
                  }
                }
              }
            },
            errors: [
              {
                name: "InvalidEmail",
                description: "An invalid email was provided."
              }
            ]
          },
          resultAvailable: {
            type: "object",
            description: "Indicates the provided handle is available.",
            properties: {}
          },
          resultUnavailable: {
            type: "object",
            description: "Indicates the provided handle is unavailable and gives suggestions of available handles.",
            required: ["suggestions"],
            properties: {
              suggestions: {
                type: "array",
                description: "List of suggested handles based on the provided inputs.",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.temp.checkHandleAvailability#suggestion"
                }
              }
            }
          },
          suggestion: {
            type: "object",
            required: ["handle", "method"],
            properties: {
              handle: {
                type: "string",
                format: "handle"
              },
              method: {
                type: "string",
                description: "Method used to build this suggestion. Should be considered opaque to clients. Can be used for metrics."
              }
            }
          }
        }
      },
      ComAtprotoTempCheckSignupQueue: {
        lexicon: 1,
        id: "com.atproto.temp.checkSignupQueue",
        defs: {
          main: {
            type: "query",
            description: "Check accounts location in signup queue.",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["activated"],
                properties: {
                  activated: {
                    type: "boolean"
                  },
                  placeInQueue: {
                    type: "integer"
                  },
                  estimatedTimeMs: {
                    type: "integer"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoTempDereferenceScope: {
        lexicon: 1,
        id: "com.atproto.temp.dereferenceScope",
        defs: {
          main: {
            type: "query",
            description: "Allows finding the oauth permission scope from a reference",
            parameters: {
              type: "params",
              required: ["scope"],
              properties: {
                scope: {
                  type: "string",
                  description: "The scope reference (starts with 'ref:')"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["scope"],
                properties: {
                  scope: {
                    type: "string",
                    description: "The full oauth permission scope"
                  }
                }
              }
            },
            errors: [
              {
                name: "InvalidScopeReference",
                description: "An invalid scope reference was provided."
              }
            ]
          }
        }
      },
      ComAtprotoTempFetchLabels: {
        lexicon: 1,
        id: "com.atproto.temp.fetchLabels",
        defs: {
          main: {
            type: "query",
            description: "DEPRECATED: use queryLabels or subscribeLabels instead -- Fetch all labels from a labeler created after a certain date.",
            parameters: {
              type: "params",
              properties: {
                since: {
                  type: "integer"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 250,
                  default: 50
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["labels"],
                properties: {
                  labels: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.label.defs#label"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoTempRequestPhoneVerification: {
        lexicon: 1,
        id: "com.atproto.temp.requestPhoneVerification",
        defs: {
          main: {
            type: "procedure",
            description: "Request a verification code to be sent to the supplied phone number",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["phoneNumber"],
                properties: {
                  phoneNumber: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      ComAtprotoTempRevokeAccountCredentials: {
        lexicon: 1,
        id: "com.atproto.temp.revokeAccountCredentials",
        defs: {
          main: {
            type: "procedure",
            description: "Revoke sessions, password, and app passwords associated with account. May be resolved by a password reset.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["account"],
                properties: {
                  account: {
                    type: "string",
                    format: "at-identifier"
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneCommunicationCreateTemplate: {
        lexicon: 1,
        id: "tools.ozone.communication.createTemplate",
        defs: {
          main: {
            type: "procedure",
            description: "Administrative action to create a new, re-usable communication (email for now) template.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subject", "contentMarkdown", "name"],
                properties: {
                  name: {
                    type: "string",
                    description: "Name of the template."
                  },
                  contentMarkdown: {
                    type: "string",
                    description: "Content of the template, markdown supported, can contain variable placeholders."
                  },
                  subject: {
                    type: "string",
                    description: "Subject of the message, used in emails."
                  },
                  lang: {
                    type: "string",
                    format: "language",
                    description: "Message language."
                  },
                  createdBy: {
                    type: "string",
                    format: "did",
                    description: "DID of the user who is creating the template."
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.communication.defs#templateView"
              }
            },
            errors: [
              {
                name: "DuplicateTemplateName"
              }
            ]
          }
        }
      },
      ToolsOzoneCommunicationDefs: {
        lexicon: 1,
        id: "tools.ozone.communication.defs",
        defs: {
          templateView: {
            type: "object",
            required: [
              "id",
              "name",
              "contentMarkdown",
              "disabled",
              "lastUpdatedBy",
              "createdAt",
              "updatedAt"
            ],
            properties: {
              id: {
                type: "string"
              },
              name: {
                type: "string",
                description: "Name of the template."
              },
              subject: {
                type: "string",
                description: "Content of the template, can contain markdown and variable placeholders."
              },
              contentMarkdown: {
                type: "string",
                description: "Subject of the message, used in emails."
              },
              disabled: {
                type: "boolean"
              },
              lang: {
                type: "string",
                format: "language",
                description: "Message language."
              },
              lastUpdatedBy: {
                type: "string",
                format: "did",
                description: "DID of the user who last updated the template."
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              updatedAt: {
                type: "string",
                format: "datetime"
              }
            }
          }
        }
      },
      ToolsOzoneCommunicationDeleteTemplate: {
        lexicon: 1,
        id: "tools.ozone.communication.deleteTemplate",
        defs: {
          main: {
            type: "procedure",
            description: "Delete a communication template.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["id"],
                properties: {
                  id: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneCommunicationListTemplates: {
        lexicon: 1,
        id: "tools.ozone.communication.listTemplates",
        defs: {
          main: {
            type: "query",
            description: "Get list of all communication templates.",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["communicationTemplates"],
                properties: {
                  communicationTemplates: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.communication.defs#templateView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneCommunicationUpdateTemplate: {
        lexicon: 1,
        id: "tools.ozone.communication.updateTemplate",
        defs: {
          main: {
            type: "procedure",
            description: "Administrative action to update an existing communication template. Allows passing partial fields to patch specific fields only.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["id"],
                properties: {
                  id: {
                    type: "string",
                    description: "ID of the template to be updated."
                  },
                  name: {
                    type: "string",
                    description: "Name of the template."
                  },
                  lang: {
                    type: "string",
                    format: "language",
                    description: "Message language."
                  },
                  contentMarkdown: {
                    type: "string",
                    description: "Content of the template, markdown supported, can contain variable placeholders."
                  },
                  subject: {
                    type: "string",
                    description: "Subject of the message, used in emails."
                  },
                  updatedBy: {
                    type: "string",
                    format: "did",
                    description: "DID of the user who is updating the template."
                  },
                  disabled: {
                    type: "boolean"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.communication.defs#templateView"
              }
            },
            errors: [
              {
                name: "DuplicateTemplateName"
              }
            ]
          }
        }
      },
      ToolsOzoneHostingGetAccountHistory: {
        lexicon: 1,
        id: "tools.ozone.hosting.getAccountHistory",
        defs: {
          main: {
            type: "query",
            description: "Get account history, e.g. log of updated email addresses or other identity information.",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did"
                },
                events: {
                  type: "array",
                  items: {
                    type: "string",
                    knownValues: [
                      "accountCreated",
                      "emailUpdated",
                      "emailConfirmed",
                      "passwordUpdated",
                      "handleUpdated"
                    ]
                  }
                },
                cursor: {
                  type: "string"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["events"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  events: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.hosting.getAccountHistory#event"
                    }
                  }
                }
              }
            }
          },
          event: {
            type: "object",
            required: ["details", "createdBy", "createdAt"],
            properties: {
              details: {
                type: "union",
                refs: [
                  "lex:tools.ozone.hosting.getAccountHistory#accountCreated",
                  "lex:tools.ozone.hosting.getAccountHistory#emailUpdated",
                  "lex:tools.ozone.hosting.getAccountHistory#emailConfirmed",
                  "lex:tools.ozone.hosting.getAccountHistory#passwordUpdated",
                  "lex:tools.ozone.hosting.getAccountHistory#handleUpdated"
                ]
              },
              createdBy: {
                type: "string"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          accountCreated: {
            type: "object",
            required: [],
            properties: {
              email: {
                type: "string"
              },
              handle: {
                type: "string",
                format: "handle"
              }
            }
          },
          emailUpdated: {
            type: "object",
            required: ["email"],
            properties: {
              email: {
                type: "string"
              }
            }
          },
          emailConfirmed: {
            type: "object",
            required: ["email"],
            properties: {
              email: {
                type: "string"
              }
            }
          },
          passwordUpdated: {
            type: "object",
            required: [],
            properties: {}
          },
          handleUpdated: {
            type: "object",
            required: ["handle"],
            properties: {
              handle: {
                type: "string",
                format: "handle"
              }
            }
          }
        }
      },
      ToolsOzoneModerationDefs: {
        lexicon: 1,
        id: "tools.ozone.moderation.defs",
        defs: {
          modEventView: {
            type: "object",
            required: [
              "id",
              "event",
              "subject",
              "subjectBlobCids",
              "createdBy",
              "createdAt"
            ],
            properties: {
              id: {
                type: "integer"
              },
              event: {
                type: "union",
                refs: [
                  "lex:tools.ozone.moderation.defs#modEventTakedown",
                  "lex:tools.ozone.moderation.defs#modEventReverseTakedown",
                  "lex:tools.ozone.moderation.defs#modEventComment",
                  "lex:tools.ozone.moderation.defs#modEventReport",
                  "lex:tools.ozone.moderation.defs#modEventLabel",
                  "lex:tools.ozone.moderation.defs#modEventAcknowledge",
                  "lex:tools.ozone.moderation.defs#modEventEscalate",
                  "lex:tools.ozone.moderation.defs#modEventMute",
                  "lex:tools.ozone.moderation.defs#modEventUnmute",
                  "lex:tools.ozone.moderation.defs#modEventMuteReporter",
                  "lex:tools.ozone.moderation.defs#modEventUnmuteReporter",
                  "lex:tools.ozone.moderation.defs#modEventEmail",
                  "lex:tools.ozone.moderation.defs#modEventResolveAppeal",
                  "lex:tools.ozone.moderation.defs#modEventDivert",
                  "lex:tools.ozone.moderation.defs#modEventTag",
                  "lex:tools.ozone.moderation.defs#accountEvent",
                  "lex:tools.ozone.moderation.defs#identityEvent",
                  "lex:tools.ozone.moderation.defs#recordEvent",
                  "lex:tools.ozone.moderation.defs#modEventPriorityScore",
                  "lex:tools.ozone.moderation.defs#ageAssuranceEvent",
                  "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent",
                  "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent"
                ]
              },
              subject: {
                type: "union",
                refs: [
                  "lex:com.atproto.admin.defs#repoRef",
                  "lex:com.atproto.repo.strongRef",
                  "lex:chat.bsky.convo.defs#messageRef"
                ]
              },
              subjectBlobCids: {
                type: "array",
                items: {
                  type: "string"
                }
              },
              createdBy: {
                type: "string",
                format: "did"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              creatorHandle: {
                type: "string"
              },
              subjectHandle: {
                type: "string"
              },
              modTool: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#modTool"
              }
            }
          },
          modEventViewDetail: {
            type: "object",
            required: [
              "id",
              "event",
              "subject",
              "subjectBlobs",
              "createdBy",
              "createdAt"
            ],
            properties: {
              id: {
                type: "integer"
              },
              event: {
                type: "union",
                refs: [
                  "lex:tools.ozone.moderation.defs#modEventTakedown",
                  "lex:tools.ozone.moderation.defs#modEventReverseTakedown",
                  "lex:tools.ozone.moderation.defs#modEventComment",
                  "lex:tools.ozone.moderation.defs#modEventReport",
                  "lex:tools.ozone.moderation.defs#modEventLabel",
                  "lex:tools.ozone.moderation.defs#modEventAcknowledge",
                  "lex:tools.ozone.moderation.defs#modEventEscalate",
                  "lex:tools.ozone.moderation.defs#modEventMute",
                  "lex:tools.ozone.moderation.defs#modEventUnmute",
                  "lex:tools.ozone.moderation.defs#modEventMuteReporter",
                  "lex:tools.ozone.moderation.defs#modEventUnmuteReporter",
                  "lex:tools.ozone.moderation.defs#modEventEmail",
                  "lex:tools.ozone.moderation.defs#modEventResolveAppeal",
                  "lex:tools.ozone.moderation.defs#modEventDivert",
                  "lex:tools.ozone.moderation.defs#modEventTag",
                  "lex:tools.ozone.moderation.defs#accountEvent",
                  "lex:tools.ozone.moderation.defs#identityEvent",
                  "lex:tools.ozone.moderation.defs#recordEvent",
                  "lex:tools.ozone.moderation.defs#modEventPriorityScore",
                  "lex:tools.ozone.moderation.defs#ageAssuranceEvent",
                  "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent",
                  "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent"
                ]
              },
              subject: {
                type: "union",
                refs: [
                  "lex:tools.ozone.moderation.defs#repoView",
                  "lex:tools.ozone.moderation.defs#repoViewNotFound",
                  "lex:tools.ozone.moderation.defs#recordView",
                  "lex:tools.ozone.moderation.defs#recordViewNotFound"
                ]
              },
              subjectBlobs: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:tools.ozone.moderation.defs#blobView"
                }
              },
              createdBy: {
                type: "string",
                format: "did"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              modTool: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#modTool"
              }
            }
          },
          subjectStatusView: {
            type: "object",
            required: ["id", "subject", "createdAt", "updatedAt", "reviewState"],
            properties: {
              id: {
                type: "integer"
              },
              subject: {
                type: "union",
                refs: [
                  "lex:com.atproto.admin.defs#repoRef",
                  "lex:com.atproto.repo.strongRef",
                  "lex:chat.bsky.convo.defs#messageRef"
                ]
              },
              hosting: {
                type: "union",
                refs: [
                  "lex:tools.ozone.moderation.defs#accountHosting",
                  "lex:tools.ozone.moderation.defs#recordHosting"
                ]
              },
              subjectBlobCids: {
                type: "array",
                items: {
                  type: "string",
                  format: "cid"
                }
              },
              subjectRepoHandle: {
                type: "string"
              },
              updatedAt: {
                type: "string",
                format: "datetime",
                description: "Timestamp referencing when the last update was made to the moderation status of the subject"
              },
              createdAt: {
                type: "string",
                format: "datetime",
                description: "Timestamp referencing the first moderation status impacting event was emitted on the subject"
              },
              reviewState: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#subjectReviewState"
              },
              comment: {
                type: "string",
                description: "Sticky comment on the subject."
              },
              priorityScore: {
                type: "integer",
                description: "Numeric value representing the level of priority. Higher score means higher priority.",
                minimum: 0,
                maximum: 100
              },
              muteUntil: {
                type: "string",
                format: "datetime"
              },
              muteReportingUntil: {
                type: "string",
                format: "datetime"
              },
              lastReviewedBy: {
                type: "string",
                format: "did"
              },
              lastReviewedAt: {
                type: "string",
                format: "datetime"
              },
              lastReportedAt: {
                type: "string",
                format: "datetime"
              },
              lastAppealedAt: {
                type: "string",
                format: "datetime",
                description: "Timestamp referencing when the author of the subject appealed a moderation action"
              },
              takendown: {
                type: "boolean"
              },
              appealed: {
                type: "boolean",
                description: "True indicates that the a previously taken moderator action was appealed against, by the author of the content. False indicates last appeal was resolved by moderators."
              },
              suspendUntil: {
                type: "string",
                format: "datetime"
              },
              tags: {
                type: "array",
                items: {
                  type: "string"
                }
              },
              accountStats: {
                description: "Statistics related to the account subject",
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#accountStats"
              },
              recordsStats: {
                description: "Statistics related to the record subjects authored by the subject's account",
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#recordsStats"
              },
              ageAssuranceState: {
                type: "string",
                description: "Current age assurance state of the subject.",
                knownValues: ["pending", "assured", "unknown", "reset", "blocked"]
              },
              ageAssuranceUpdatedBy: {
                type: "string",
                description: "Whether or not the last successful update to age assurance was made by the user or admin.",
                knownValues: ["admin", "user"]
              }
            }
          },
          subjectView: {
            description: "Detailed view of a subject. For record subjects, the author's repo and profile will be returned.",
            type: "object",
            required: ["type", "subject"],
            properties: {
              type: {
                type: "ref",
                ref: "lex:com.atproto.moderation.defs#subjectType"
              },
              subject: {
                type: "string"
              },
              status: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#subjectStatusView"
              },
              repo: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#repoViewDetail"
              },
              profile: {
                type: "union",
                refs: []
              },
              record: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#recordViewDetail"
              }
            }
          },
          accountStats: {
            description: "Statistics about a particular account subject",
            type: "object",
            properties: {
              reportCount: {
                description: "Total number of reports on the account",
                type: "integer"
              },
              appealCount: {
                description: "Total number of appeals against a moderation action on the account",
                type: "integer"
              },
              suspendCount: {
                description: "Number of times the account was suspended",
                type: "integer"
              },
              escalateCount: {
                description: "Number of times the account was escalated",
                type: "integer"
              },
              takedownCount: {
                description: "Number of times the account was taken down",
                type: "integer"
              }
            }
          },
          recordsStats: {
            description: "Statistics about a set of record subject items",
            type: "object",
            properties: {
              totalReports: {
                description: "Cumulative sum of the number of reports on the items in the set",
                type: "integer"
              },
              reportedCount: {
                description: "Number of items that were reported at least once",
                type: "integer"
              },
              escalatedCount: {
                description: "Number of items that were escalated at least once",
                type: "integer"
              },
              appealedCount: {
                description: "Number of items that were appealed at least once",
                type: "integer"
              },
              subjectCount: {
                description: "Total number of item in the set",
                type: "integer"
              },
              pendingCount: {
                description: 'Number of item currently in "reviewOpen" or "reviewEscalated" state',
                type: "integer"
              },
              processedCount: {
                description: 'Number of item currently in "reviewNone" or "reviewClosed" state',
                type: "integer"
              },
              takendownCount: {
                description: "Number of item currently taken down",
                type: "integer"
              }
            }
          },
          subjectReviewState: {
            type: "string",
            knownValues: [
              "lex:tools.ozone.moderation.defs#reviewOpen",
              "lex:tools.ozone.moderation.defs#reviewEscalated",
              "lex:tools.ozone.moderation.defs#reviewClosed",
              "lex:tools.ozone.moderation.defs#reviewNone"
            ]
          },
          reviewOpen: {
            type: "token",
            description: "Moderator review status of a subject: Open. Indicates that the subject needs to be reviewed by a moderator"
          },
          reviewEscalated: {
            type: "token",
            description: "Moderator review status of a subject: Escalated. Indicates that the subject was escalated for review by a moderator"
          },
          reviewClosed: {
            type: "token",
            description: "Moderator review status of a subject: Closed. Indicates that the subject was already reviewed and resolved by a moderator"
          },
          reviewNone: {
            type: "token",
            description: "Moderator review status of a subject: Unnecessary. Indicates that the subject does not need a review at the moment but there is probably some moderation related metadata available for it"
          },
          modEventTakedown: {
            type: "object",
            description: "Take down a subject permanently or temporarily",
            properties: {
              comment: {
                type: "string"
              },
              durationInHours: {
                type: "integer",
                description: "Indicates how long the takedown should be in effect before automatically expiring."
              },
              acknowledgeAccountSubjects: {
                type: "boolean",
                description: "If true, all other reports on content authored by this account will be resolved (acknowledged)."
              },
              policies: {
                type: "array",
                maxLength: 5,
                items: {
                  type: "string"
                },
                description: "Names/Keywords of the policies that drove the decision."
              }
            }
          },
          modEventReverseTakedown: {
            type: "object",
            description: "Revert take down action on a subject",
            properties: {
              comment: {
                type: "string",
                description: "Describe reasoning behind the reversal."
              }
            }
          },
          modEventResolveAppeal: {
            type: "object",
            description: "Resolve appeal on a subject",
            properties: {
              comment: {
                type: "string",
                description: "Describe resolution."
              }
            }
          },
          modEventComment: {
            type: "object",
            description: "Add a comment to a subject. An empty comment will clear any previously set sticky comment.",
            properties: {
              comment: {
                type: "string"
              },
              sticky: {
                type: "boolean",
                description: "Make the comment persistent on the subject"
              }
            }
          },
          modEventReport: {
            type: "object",
            description: "Report a subject",
            required: ["reportType"],
            properties: {
              comment: {
                type: "string"
              },
              isReporterMuted: {
                type: "boolean",
                description: "Set to true if the reporter was muted from reporting at the time of the event. These reports won't impact the reviewState of the subject."
              },
              reportType: {
                type: "ref",
                ref: "lex:com.atproto.moderation.defs#reasonType"
              }
            }
          },
          modEventLabel: {
            type: "object",
            description: "Apply/Negate labels on a subject",
            required: ["createLabelVals", "negateLabelVals"],
            properties: {
              comment: {
                type: "string"
              },
              createLabelVals: {
                type: "array",
                items: {
                  type: "string"
                }
              },
              negateLabelVals: {
                type: "array",
                items: {
                  type: "string"
                }
              },
              durationInHours: {
                type: "integer",
                description: "Indicates how long the label will remain on the subject. Only applies on labels that are being added."
              }
            }
          },
          modEventPriorityScore: {
            type: "object",
            description: "Set priority score of the subject. Higher score means higher priority.",
            required: ["score"],
            properties: {
              comment: {
                type: "string"
              },
              score: {
                type: "integer",
                minimum: 0,
                maximum: 100
              }
            }
          },
          ageAssuranceEvent: {
            type: "object",
            description: "Age assurance info coming directly from users. Only works on DID subjects.",
            required: ["createdAt", "status", "attemptId"],
            properties: {
              createdAt: {
                type: "string",
                format: "datetime",
                description: "The date and time of this write operation."
              },
              status: {
                type: "string",
                description: "The status of the age assurance process.",
                knownValues: ["unknown", "pending", "assured"]
              },
              attemptId: {
                type: "string",
                description: "The unique identifier for this instance of the age assurance flow, in UUID format."
              },
              initIp: {
                type: "string",
                description: "The IP address used when initiating the AA flow."
              },
              initUa: {
                type: "string",
                description: "The user agent used when initiating the AA flow."
              },
              completeIp: {
                type: "string",
                description: "The IP address used when completing the AA flow."
              },
              completeUa: {
                type: "string",
                description: "The user agent used when completing the AA flow."
              }
            }
          },
          ageAssuranceOverrideEvent: {
            type: "object",
            description: "Age assurance status override by moderators. Only works on DID subjects.",
            required: ["comment", "status"],
            properties: {
              status: {
                type: "string",
                description: "The status to be set for the user decided by a moderator, overriding whatever value the user had previously. Use reset to default to original state.",
                knownValues: ["assured", "reset", "blocked"]
              },
              comment: {
                type: "string",
                description: "Comment describing the reason for the override."
              }
            }
          },
          revokeAccountCredentialsEvent: {
            type: "object",
            description: "Account credentials revocation by moderators. Only works on DID subjects.",
            required: ["comment"],
            properties: {
              comment: {
                type: "string",
                description: "Comment describing the reason for the revocation."
              }
            }
          },
          modEventAcknowledge: {
            type: "object",
            properties: {
              comment: {
                type: "string"
              },
              acknowledgeAccountSubjects: {
                type: "boolean",
                description: "If true, all other reports on content authored by this account will be resolved (acknowledged)."
              }
            }
          },
          modEventEscalate: {
            type: "object",
            properties: {
              comment: {
                type: "string"
              }
            }
          },
          modEventMute: {
            type: "object",
            description: "Mute incoming reports on a subject",
            required: ["durationInHours"],
            properties: {
              comment: {
                type: "string"
              },
              durationInHours: {
                type: "integer",
                description: "Indicates how long the subject should remain muted."
              }
            }
          },
          modEventUnmute: {
            type: "object",
            description: "Unmute action on a subject",
            properties: {
              comment: {
                type: "string",
                description: "Describe reasoning behind the reversal."
              }
            }
          },
          modEventMuteReporter: {
            type: "object",
            description: "Mute incoming reports from an account",
            properties: {
              comment: {
                type: "string"
              },
              durationInHours: {
                type: "integer",
                description: "Indicates how long the account should remain muted. Falsy value here means a permanent mute."
              }
            }
          },
          modEventUnmuteReporter: {
            type: "object",
            description: "Unmute incoming reports from an account",
            properties: {
              comment: {
                type: "string",
                description: "Describe reasoning behind the reversal."
              }
            }
          },
          modEventEmail: {
            type: "object",
            description: "Keep a log of outgoing email to a user",
            required: ["subjectLine"],
            properties: {
              subjectLine: {
                type: "string",
                description: "The subject line of the email sent to the user."
              },
              content: {
                type: "string",
                description: "The content of the email sent to the user."
              },
              comment: {
                type: "string",
                description: "Additional comment about the outgoing comm."
              }
            }
          },
          modEventDivert: {
            type: "object",
            description: "Divert a record's blobs to a 3rd party service for further scanning/tagging",
            properties: {
              comment: {
                type: "string"
              }
            }
          },
          modEventTag: {
            type: "object",
            description: "Add/Remove a tag on a subject",
            required: ["add", "remove"],
            properties: {
              add: {
                type: "array",
                items: {
                  type: "string"
                },
                description: "Tags to be added to the subject. If already exists, won't be duplicated."
              },
              remove: {
                type: "array",
                items: {
                  type: "string"
                },
                description: "Tags to be removed to the subject. Ignores a tag If it doesn't exist, won't be duplicated."
              },
              comment: {
                type: "string",
                description: "Additional comment about added/removed tags."
              }
            }
          },
          accountEvent: {
            type: "object",
            description: "Logs account status related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.",
            required: ["timestamp", "active"],
            properties: {
              comment: {
                type: "string"
              },
              active: {
                type: "boolean",
                description: "Indicates that the account has a repository which can be fetched from the host that emitted this event."
              },
              status: {
                type: "string",
                knownValues: [
                  "unknown",
                  "deactivated",
                  "deleted",
                  "takendown",
                  "suspended",
                  "tombstoned"
                ]
              },
              timestamp: {
                type: "string",
                format: "datetime"
              }
            }
          },
          identityEvent: {
            type: "object",
            description: "Logs identity related events on a repo subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.",
            required: ["timestamp"],
            properties: {
              comment: {
                type: "string"
              },
              handle: {
                type: "string",
                format: "handle"
              },
              pdsHost: {
                type: "string",
                format: "uri"
              },
              tombstone: {
                type: "boolean"
              },
              timestamp: {
                type: "string",
                format: "datetime"
              }
            }
          },
          recordEvent: {
            type: "object",
            description: "Logs lifecycle event on a record subject. Normally captured by automod from the firehose and emitted to ozone for historical tracking.",
            required: ["timestamp", "op"],
            properties: {
              comment: {
                type: "string"
              },
              op: {
                type: "string",
                knownValues: ["create", "update", "delete"]
              },
              cid: {
                type: "string",
                format: "cid"
              },
              timestamp: {
                type: "string",
                format: "datetime"
              }
            }
          },
          repoView: {
            type: "object",
            required: [
              "did",
              "handle",
              "relatedRecords",
              "indexedAt",
              "moderation"
            ],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              handle: {
                type: "string",
                format: "handle"
              },
              email: {
                type: "string"
              },
              relatedRecords: {
                type: "array",
                items: {
                  type: "unknown"
                }
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              moderation: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#moderation"
              },
              invitedBy: {
                type: "ref",
                ref: "lex:com.atproto.server.defs#inviteCode"
              },
              invitesDisabled: {
                type: "boolean"
              },
              inviteNote: {
                type: "string"
              },
              deactivatedAt: {
                type: "string",
                format: "datetime"
              },
              threatSignatures: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.admin.defs#threatSignature"
                }
              }
            }
          },
          repoViewDetail: {
            type: "object",
            required: [
              "did",
              "handle",
              "relatedRecords",
              "indexedAt",
              "moderation"
            ],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              handle: {
                type: "string",
                format: "handle"
              },
              email: {
                type: "string"
              },
              relatedRecords: {
                type: "array",
                items: {
                  type: "unknown"
                }
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              moderation: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#moderationDetail"
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              invitedBy: {
                type: "ref",
                ref: "lex:com.atproto.server.defs#inviteCode"
              },
              invites: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.server.defs#inviteCode"
                }
              },
              invitesDisabled: {
                type: "boolean"
              },
              inviteNote: {
                type: "string"
              },
              emailConfirmedAt: {
                type: "string",
                format: "datetime"
              },
              deactivatedAt: {
                type: "string",
                format: "datetime"
              },
              threatSignatures: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.admin.defs#threatSignature"
                }
              }
            }
          },
          repoViewNotFound: {
            type: "object",
            required: ["did"],
            properties: {
              did: {
                type: "string",
                format: "did"
              }
            }
          },
          recordView: {
            type: "object",
            required: [
              "uri",
              "cid",
              "value",
              "blobCids",
              "indexedAt",
              "moderation",
              "repo"
            ],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              value: {
                type: "unknown"
              },
              blobCids: {
                type: "array",
                items: {
                  type: "string",
                  format: "cid"
                }
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              moderation: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#moderation"
              },
              repo: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#repoView"
              }
            }
          },
          recordViewDetail: {
            type: "object",
            required: [
              "uri",
              "cid",
              "value",
              "blobs",
              "indexedAt",
              "moderation",
              "repo"
            ],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              },
              cid: {
                type: "string",
                format: "cid"
              },
              value: {
                type: "unknown"
              },
              blobs: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:tools.ozone.moderation.defs#blobView"
                }
              },
              labels: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:com.atproto.label.defs#label"
                }
              },
              indexedAt: {
                type: "string",
                format: "datetime"
              },
              moderation: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#moderationDetail"
              },
              repo: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#repoView"
              }
            }
          },
          recordViewNotFound: {
            type: "object",
            required: ["uri"],
            properties: {
              uri: {
                type: "string",
                format: "at-uri"
              }
            }
          },
          moderation: {
            type: "object",
            properties: {
              subjectStatus: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#subjectStatusView"
              }
            }
          },
          moderationDetail: {
            type: "object",
            properties: {
              subjectStatus: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#subjectStatusView"
              }
            }
          },
          blobView: {
            type: "object",
            required: ["cid", "mimeType", "size", "createdAt"],
            properties: {
              cid: {
                type: "string",
                format: "cid"
              },
              mimeType: {
                type: "string"
              },
              size: {
                type: "integer"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              details: {
                type: "union",
                refs: [
                  "lex:tools.ozone.moderation.defs#imageDetails",
                  "lex:tools.ozone.moderation.defs#videoDetails"
                ]
              },
              moderation: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#moderation"
              }
            }
          },
          imageDetails: {
            type: "object",
            required: ["width", "height"],
            properties: {
              width: {
                type: "integer"
              },
              height: {
                type: "integer"
              }
            }
          },
          videoDetails: {
            type: "object",
            required: ["width", "height", "length"],
            properties: {
              width: {
                type: "integer"
              },
              height: {
                type: "integer"
              },
              length: {
                type: "integer"
              }
            }
          },
          accountHosting: {
            type: "object",
            required: ["status"],
            properties: {
              status: {
                type: "string",
                knownValues: [
                  "takendown",
                  "suspended",
                  "deleted",
                  "deactivated",
                  "unknown"
                ]
              },
              updatedAt: {
                type: "string",
                format: "datetime"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              deletedAt: {
                type: "string",
                format: "datetime"
              },
              deactivatedAt: {
                type: "string",
                format: "datetime"
              },
              reactivatedAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          recordHosting: {
            type: "object",
            required: ["status"],
            properties: {
              status: {
                type: "string",
                knownValues: ["deleted", "unknown"]
              },
              updatedAt: {
                type: "string",
                format: "datetime"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              deletedAt: {
                type: "string",
                format: "datetime"
              }
            }
          },
          reporterStats: {
            type: "object",
            required: [
              "did",
              "accountReportCount",
              "recordReportCount",
              "reportedAccountCount",
              "reportedRecordCount",
              "takendownAccountCount",
              "takendownRecordCount",
              "labeledAccountCount",
              "labeledRecordCount"
            ],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              accountReportCount: {
                type: "integer",
                description: "The total number of reports made by the user on accounts."
              },
              recordReportCount: {
                type: "integer",
                description: "The total number of reports made by the user on records."
              },
              reportedAccountCount: {
                type: "integer",
                description: "The total number of accounts reported by the user."
              },
              reportedRecordCount: {
                type: "integer",
                description: "The total number of records reported by the user."
              },
              takendownAccountCount: {
                type: "integer",
                description: "The total number of accounts taken down as a result of the user's reports."
              },
              takendownRecordCount: {
                type: "integer",
                description: "The total number of records taken down as a result of the user's reports."
              },
              labeledAccountCount: {
                type: "integer",
                description: "The total number of accounts labeled as a result of the user's reports."
              },
              labeledRecordCount: {
                type: "integer",
                description: "The total number of records labeled as a result of the user's reports."
              }
            }
          },
          modTool: {
            type: "object",
            description: "Moderation tool information for tracing the source of the action",
            required: ["name"],
            properties: {
              name: {
                type: "string",
                description: "Name/identifier of the source (e.g., 'automod', 'ozone/workspace')"
              },
              meta: {
                type: "unknown",
                description: "Additional arbitrary metadata about the source"
              }
            }
          },
          timelineEventPlcCreate: {
            type: "token",
            description: "Moderation event timeline event for a PLC create operation"
          },
          timelineEventPlcOperation: {
            type: "token",
            description: "Moderation event timeline event for generic PLC operation"
          },
          timelineEventPlcTombstone: {
            type: "token",
            description: "Moderation event timeline event for a PLC tombstone operation"
          }
        }
      },
      ToolsOzoneModerationEmitEvent: {
        lexicon: 1,
        id: "tools.ozone.moderation.emitEvent",
        defs: {
          main: {
            type: "procedure",
            description: "Take a moderation action on an actor.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["event", "subject", "createdBy"],
                properties: {
                  event: {
                    type: "union",
                    refs: [
                      "lex:tools.ozone.moderation.defs#modEventTakedown",
                      "lex:tools.ozone.moderation.defs#modEventAcknowledge",
                      "lex:tools.ozone.moderation.defs#modEventEscalate",
                      "lex:tools.ozone.moderation.defs#modEventComment",
                      "lex:tools.ozone.moderation.defs#modEventLabel",
                      "lex:tools.ozone.moderation.defs#modEventReport",
                      "lex:tools.ozone.moderation.defs#modEventMute",
                      "lex:tools.ozone.moderation.defs#modEventUnmute",
                      "lex:tools.ozone.moderation.defs#modEventMuteReporter",
                      "lex:tools.ozone.moderation.defs#modEventUnmuteReporter",
                      "lex:tools.ozone.moderation.defs#modEventReverseTakedown",
                      "lex:tools.ozone.moderation.defs#modEventResolveAppeal",
                      "lex:tools.ozone.moderation.defs#modEventEmail",
                      "lex:tools.ozone.moderation.defs#modEventDivert",
                      "lex:tools.ozone.moderation.defs#modEventTag",
                      "lex:tools.ozone.moderation.defs#accountEvent",
                      "lex:tools.ozone.moderation.defs#identityEvent",
                      "lex:tools.ozone.moderation.defs#recordEvent",
                      "lex:tools.ozone.moderation.defs#modEventPriorityScore",
                      "lex:tools.ozone.moderation.defs#ageAssuranceEvent",
                      "lex:tools.ozone.moderation.defs#ageAssuranceOverrideEvent",
                      "lex:tools.ozone.moderation.defs#revokeAccountCredentialsEvent"
                    ]
                  },
                  subject: {
                    type: "union",
                    refs: [
                      "lex:com.atproto.admin.defs#repoRef",
                      "lex:com.atproto.repo.strongRef"
                    ]
                  },
                  subjectBlobCids: {
                    type: "array",
                    items: {
                      type: "string",
                      format: "cid"
                    }
                  },
                  createdBy: {
                    type: "string",
                    format: "did"
                  },
                  modTool: {
                    type: "ref",
                    ref: "lex:tools.ozone.moderation.defs#modTool"
                  },
                  externalId: {
                    type: "string",
                    description: "An optional external ID for the event, used to deduplicate events from external systems. Fails when an event of same type with the same external ID exists for the same subject."
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#modEventView"
              }
            },
            errors: [
              {
                name: "SubjectHasAction"
              },
              {
                name: "DuplicateExternalId",
                description: "An event with the same external ID already exists for the subject."
              }
            ]
          }
        }
      },
      ToolsOzoneModerationGetAccountTimeline: {
        lexicon: 1,
        id: "tools.ozone.moderation.getAccountTimeline",
        defs: {
          main: {
            type: "query",
            description: "Get timeline of all available events of an account. This includes moderation events, account history and did history.",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["timeline"],
                properties: {
                  timeline: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.moderation.getAccountTimeline#timelineItem"
                    }
                  }
                }
              }
            },
            errors: [
              {
                name: "RepoNotFound"
              }
            ]
          },
          timelineItem: {
            type: "object",
            required: ["day", "summary"],
            properties: {
              day: {
                type: "string"
              },
              summary: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:tools.ozone.moderation.getAccountTimeline#timelineItemSummary"
                }
              }
            }
          },
          timelineItemSummary: {
            type: "object",
            required: ["eventSubjectType", "eventType", "count"],
            properties: {
              eventSubjectType: {
                type: "string",
                knownValues: ["account", "record", "chat"]
              },
              eventType: {
                type: "string",
                knownValues: [
                  "tools.ozone.moderation.defs#modEventTakedown",
                  "tools.ozone.moderation.defs#modEventReverseTakedown",
                  "tools.ozone.moderation.defs#modEventComment",
                  "tools.ozone.moderation.defs#modEventReport",
                  "tools.ozone.moderation.defs#modEventLabel",
                  "tools.ozone.moderation.defs#modEventAcknowledge",
                  "tools.ozone.moderation.defs#modEventEscalate",
                  "tools.ozone.moderation.defs#modEventMute",
                  "tools.ozone.moderation.defs#modEventUnmute",
                  "tools.ozone.moderation.defs#modEventMuteReporter",
                  "tools.ozone.moderation.defs#modEventUnmuteReporter",
                  "tools.ozone.moderation.defs#modEventEmail",
                  "tools.ozone.moderation.defs#modEventResolveAppeal",
                  "tools.ozone.moderation.defs#modEventDivert",
                  "tools.ozone.moderation.defs#modEventTag",
                  "tools.ozone.moderation.defs#accountEvent",
                  "tools.ozone.moderation.defs#identityEvent",
                  "tools.ozone.moderation.defs#recordEvent",
                  "tools.ozone.moderation.defs#modEventPriorityScore",
                  "tools.ozone.moderation.defs#revokeAccountCredentialsEvent",
                  "tools.ozone.moderation.defs#ageAssuranceEvent",
                  "tools.ozone.moderation.defs#ageAssuranceOverrideEvent",
                  "tools.ozone.moderation.defs#timelineEventPlcCreate",
                  "tools.ozone.moderation.defs#timelineEventPlcOperation",
                  "tools.ozone.moderation.defs#timelineEventPlcTombstone",
                  "tools.ozone.hosting.getAccountHistory#accountCreated",
                  "tools.ozone.hosting.getAccountHistory#emailConfirmed",
                  "tools.ozone.hosting.getAccountHistory#passwordUpdated",
                  "tools.ozone.hosting.getAccountHistory#handleUpdated"
                ]
              },
              count: {
                type: "integer"
              }
            }
          }
        }
      },
      ToolsOzoneModerationGetEvent: {
        lexicon: 1,
        id: "tools.ozone.moderation.getEvent",
        defs: {
          main: {
            type: "query",
            description: "Get details about a moderation event.",
            parameters: {
              type: "params",
              required: ["id"],
              properties: {
                id: {
                  type: "integer"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#modEventViewDetail"
              }
            }
          }
        }
      },
      ToolsOzoneModerationGetRecord: {
        lexicon: 1,
        id: "tools.ozone.moderation.getRecord",
        defs: {
          main: {
            type: "query",
            description: "Get details about a record.",
            parameters: {
              type: "params",
              required: ["uri"],
              properties: {
                uri: {
                  type: "string",
                  format: "at-uri"
                },
                cid: {
                  type: "string",
                  format: "cid"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#recordViewDetail"
              }
            },
            errors: [
              {
                name: "RecordNotFound"
              }
            ]
          }
        }
      },
      ToolsOzoneModerationGetRecords: {
        lexicon: 1,
        id: "tools.ozone.moderation.getRecords",
        defs: {
          main: {
            type: "query",
            description: "Get details about some records.",
            parameters: {
              type: "params",
              required: ["uris"],
              properties: {
                uris: {
                  type: "array",
                  maxLength: 100,
                  items: {
                    type: "string",
                    format: "at-uri"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["records"],
                properties: {
                  records: {
                    type: "array",
                    items: {
                      type: "union",
                      refs: [
                        "lex:tools.ozone.moderation.defs#recordViewDetail",
                        "lex:tools.ozone.moderation.defs#recordViewNotFound"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneModerationGetRepo: {
        lexicon: 1,
        id: "tools.ozone.moderation.getRepo",
        defs: {
          main: {
            type: "query",
            description: "Get details about a repository.",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.moderation.defs#repoViewDetail"
              }
            },
            errors: [
              {
                name: "RepoNotFound"
              }
            ]
          }
        }
      },
      ToolsOzoneModerationGetReporterStats: {
        lexicon: 1,
        id: "tools.ozone.moderation.getReporterStats",
        defs: {
          main: {
            type: "query",
            description: "Get reporter stats for a list of users.",
            parameters: {
              type: "params",
              required: ["dids"],
              properties: {
                dids: {
                  type: "array",
                  maxLength: 100,
                  items: {
                    type: "string",
                    format: "did"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["stats"],
                properties: {
                  stats: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.moderation.defs#reporterStats"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneModerationGetRepos: {
        lexicon: 1,
        id: "tools.ozone.moderation.getRepos",
        defs: {
          main: {
            type: "query",
            description: "Get details about some repositories.",
            parameters: {
              type: "params",
              required: ["dids"],
              properties: {
                dids: {
                  type: "array",
                  maxLength: 100,
                  items: {
                    type: "string",
                    format: "did"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["repos"],
                properties: {
                  repos: {
                    type: "array",
                    items: {
                      type: "union",
                      refs: [
                        "lex:tools.ozone.moderation.defs#repoViewDetail",
                        "lex:tools.ozone.moderation.defs#repoViewNotFound"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneModerationGetSubjects: {
        lexicon: 1,
        id: "tools.ozone.moderation.getSubjects",
        defs: {
          main: {
            type: "query",
            description: "Get details about subjects.",
            parameters: {
              type: "params",
              required: ["subjects"],
              properties: {
                subjects: {
                  type: "array",
                  maxLength: 100,
                  minLength: 1,
                  items: {
                    type: "string"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subjects"],
                properties: {
                  subjects: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.moderation.defs#subjectView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneModerationQueryEvents: {
        lexicon: 1,
        id: "tools.ozone.moderation.queryEvents",
        defs: {
          main: {
            type: "query",
            description: "List moderation events related to a subject.",
            parameters: {
              type: "params",
              properties: {
                types: {
                  type: "array",
                  items: {
                    type: "string"
                  },
                  description: "The types of events (fully qualified string in the format of tools.ozone.moderation.defs#modEvent<name>) to filter by. If not specified, all events are returned."
                },
                createdBy: {
                  type: "string",
                  format: "did"
                },
                sortDirection: {
                  type: "string",
                  default: "desc",
                  enum: ["asc", "desc"],
                  description: "Sort direction for the events. Defaults to descending order of created at timestamp."
                },
                createdAfter: {
                  type: "string",
                  format: "datetime",
                  description: "Retrieve events created after a given timestamp"
                },
                createdBefore: {
                  type: "string",
                  format: "datetime",
                  description: "Retrieve events created before a given timestamp"
                },
                subject: {
                  type: "string",
                  format: "uri"
                },
                collections: {
                  type: "array",
                  maxLength: 20,
                  description: "If specified, only events where the subject belongs to the given collections will be returned. When subjectType is set to 'account', this will be ignored.",
                  items: {
                    type: "string",
                    format: "nsid"
                  }
                },
                subjectType: {
                  type: "string",
                  description: "If specified, only events where the subject is of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored.",
                  knownValues: ["account", "record"]
                },
                includeAllUserRecords: {
                  type: "boolean",
                  default: false,
                  description: "If true, events on all record types (posts, lists, profile etc.) or records from given 'collections' param, owned by the did are returned."
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                hasComment: {
                  type: "boolean",
                  description: "If true, only events with comments are returned"
                },
                comment: {
                  type: "string",
                  description: "If specified, only events with comments containing the keyword are returned. Apply || separator to use multiple keywords and match using OR condition."
                },
                addedLabels: {
                  type: "array",
                  items: {
                    type: "string"
                  },
                  description: "If specified, only events where all of these labels were added are returned"
                },
                removedLabels: {
                  type: "array",
                  items: {
                    type: "string"
                  },
                  description: "If specified, only events where all of these labels were removed are returned"
                },
                addedTags: {
                  type: "array",
                  items: {
                    type: "string"
                  },
                  description: "If specified, only events where all of these tags were added are returned"
                },
                removedTags: {
                  type: "array",
                  items: {
                    type: "string"
                  },
                  description: "If specified, only events where all of these tags were removed are returned"
                },
                reportTypes: {
                  type: "array",
                  items: {
                    type: "string"
                  }
                },
                policies: {
                  type: "array",
                  items: {
                    type: "string",
                    description: "If specified, only events where the action policies match any of the given policies are returned"
                  }
                },
                modTool: {
                  type: "array",
                  items: {
                    type: "string"
                  },
                  description: "If specified, only events where the modTool name matches any of the given values are returned"
                },
                batchId: {
                  type: "string",
                  description: "If specified, only events where the batchId matches the given value are returned"
                },
                ageAssuranceState: {
                  type: "string",
                  description: "If specified, only events where the age assurance state matches the given value are returned",
                  knownValues: [
                    "pending",
                    "assured",
                    "unknown",
                    "reset",
                    "blocked"
                  ]
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["events"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  events: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.moderation.defs#modEventView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneModerationQueryStatuses: {
        lexicon: 1,
        id: "tools.ozone.moderation.queryStatuses",
        defs: {
          main: {
            type: "query",
            description: "View moderation statuses of subjects (record or repo).",
            parameters: {
              type: "params",
              properties: {
                queueCount: {
                  type: "integer",
                  description: "Number of queues being used by moderators. Subjects will be split among all queues."
                },
                queueIndex: {
                  type: "integer",
                  description: "Index of the queue to fetch subjects from. Works only when queueCount value is specified."
                },
                queueSeed: {
                  type: "string",
                  description: "A seeder to shuffle/balance the queue items."
                },
                includeAllUserRecords: {
                  type: "boolean",
                  description: "All subjects, or subjects from given 'collections' param, belonging to the account specified in the 'subject' param will be returned."
                },
                subject: {
                  type: "string",
                  format: "uri",
                  description: "The subject to get the status for."
                },
                comment: {
                  type: "string",
                  description: "Search subjects by keyword from comments"
                },
                reportedAfter: {
                  type: "string",
                  format: "datetime",
                  description: "Search subjects reported after a given timestamp"
                },
                reportedBefore: {
                  type: "string",
                  format: "datetime",
                  description: "Search subjects reported before a given timestamp"
                },
                reviewedAfter: {
                  type: "string",
                  format: "datetime",
                  description: "Search subjects reviewed after a given timestamp"
                },
                hostingDeletedAfter: {
                  type: "string",
                  format: "datetime",
                  description: "Search subjects where the associated record/account was deleted after a given timestamp"
                },
                hostingDeletedBefore: {
                  type: "string",
                  format: "datetime",
                  description: "Search subjects where the associated record/account was deleted before a given timestamp"
                },
                hostingUpdatedAfter: {
                  type: "string",
                  format: "datetime",
                  description: "Search subjects where the associated record/account was updated after a given timestamp"
                },
                hostingUpdatedBefore: {
                  type: "string",
                  format: "datetime",
                  description: "Search subjects where the associated record/account was updated before a given timestamp"
                },
                hostingStatuses: {
                  type: "array",
                  items: {
                    type: "string"
                  },
                  description: "Search subjects by the status of the associated record/account"
                },
                reviewedBefore: {
                  type: "string",
                  format: "datetime",
                  description: "Search subjects reviewed before a given timestamp"
                },
                includeMuted: {
                  type: "boolean",
                  description: "By default, we don't include muted subjects in the results. Set this to true to include them."
                },
                onlyMuted: {
                  type: "boolean",
                  description: "When set to true, only muted subjects and reporters will be returned."
                },
                reviewState: {
                  type: "string",
                  description: "Specify when fetching subjects in a certain state"
                },
                ignoreSubjects: {
                  type: "array",
                  items: {
                    type: "string",
                    format: "uri"
                  }
                },
                lastReviewedBy: {
                  type: "string",
                  format: "did",
                  description: "Get all subject statuses that were reviewed by a specific moderator"
                },
                sortField: {
                  type: "string",
                  default: "lastReportedAt",
                  enum: [
                    "lastReviewedAt",
                    "lastReportedAt",
                    "reportedRecordsCount",
                    "takendownRecordsCount",
                    "priorityScore"
                  ]
                },
                sortDirection: {
                  type: "string",
                  default: "desc",
                  enum: ["asc", "desc"]
                },
                takendown: {
                  type: "boolean",
                  description: "Get subjects that were taken down"
                },
                appealed: {
                  type: "boolean",
                  description: "Get subjects in unresolved appealed status"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                tags: {
                  type: "array",
                  maxLength: 25,
                  items: {
                    type: "string",
                    description: "Items in this array are applied with OR filters. To apply AND filter, put all tags in the same string and separate using && characters"
                  }
                },
                excludeTags: {
                  type: "array",
                  items: {
                    type: "string"
                  }
                },
                cursor: {
                  type: "string"
                },
                collections: {
                  type: "array",
                  maxLength: 20,
                  description: "If specified, subjects belonging to the given collections will be returned. When subjectType is set to 'account', this will be ignored.",
                  items: {
                    type: "string",
                    format: "nsid"
                  }
                },
                subjectType: {
                  type: "string",
                  description: "If specified, subjects of the given type (account or record) will be returned. When this is set to 'account' the 'collections' parameter will be ignored. When includeAllUserRecords or subject is set, this will be ignored.",
                  knownValues: ["account", "record"]
                },
                minAccountSuspendCount: {
                  type: "integer",
                  description: "If specified, only subjects that belong to an account that has at least this many suspensions will be returned."
                },
                minReportedRecordsCount: {
                  type: "integer",
                  description: "If specified, only subjects that belong to an account that has at least this many reported records will be returned."
                },
                minTakendownRecordsCount: {
                  type: "integer",
                  description: "If specified, only subjects that belong to an account that has at least this many taken down records will be returned."
                },
                minPriorityScore: {
                  minimum: 0,
                  maximum: 100,
                  type: "integer",
                  description: "If specified, only subjects that have priority score value above the given value will be returned."
                },
                ageAssuranceState: {
                  type: "string",
                  description: "If specified, only subjects with the given age assurance state will be returned.",
                  knownValues: [
                    "pending",
                    "assured",
                    "unknown",
                    "reset",
                    "blocked"
                  ]
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["subjectStatuses"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  subjectStatuses: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.moderation.defs#subjectStatusView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneModerationSearchRepos: {
        lexicon: 1,
        id: "tools.ozone.moderation.searchRepos",
        defs: {
          main: {
            type: "query",
            description: "Find repositories based on a search term.",
            parameters: {
              type: "params",
              properties: {
                term: {
                  type: "string",
                  description: "DEPRECATED: use 'q' instead"
                },
                q: {
                  type: "string"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["repos"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  repos: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.moderation.defs#repoView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneReportDefs: {
        lexicon: 1,
        id: "tools.ozone.report.defs",
        defs: {
          reasonType: {
            type: "string",
            knownValues: [
              "tools.ozone.report.defs#reasonAppeal",
              "tools.ozone.report.defs#reasonViolenceAnimalWelfare",
              "tools.ozone.report.defs#reasonViolenceThreats",
              "tools.ozone.report.defs#reasonViolenceGraphicContent",
              "tools.ozone.report.defs#reasonViolenceSelfHarm",
              "tools.ozone.report.defs#reasonViolenceGlorification",
              "tools.ozone.report.defs#reasonViolenceExtremistContent",
              "tools.ozone.report.defs#reasonViolenceTrafficking",
              "tools.ozone.report.defs#reasonViolenceOther",
              "tools.ozone.report.defs#reasonSexualAbuseContent",
              "tools.ozone.report.defs#reasonSexualNCII",
              "tools.ozone.report.defs#reasonSexualSextortion",
              "tools.ozone.report.defs#reasonSexualDeepfake",
              "tools.ozone.report.defs#reasonSexualAnimal",
              "tools.ozone.report.defs#reasonSexualUnlabeled",
              "tools.ozone.report.defs#reasonSexualOther",
              "tools.ozone.report.defs#reasonChildSafetyCSAM",
              "tools.ozone.report.defs#reasonChildSafetyGroom",
              "tools.ozone.report.defs#reasonChildSafetyMinorPrivacy",
              "tools.ozone.report.defs#reasonChildSafetyEndangerment",
              "tools.ozone.report.defs#reasonChildSafetyHarassment",
              "tools.ozone.report.defs#reasonChildSafetyPromotion",
              "tools.ozone.report.defs#reasonChildSafetyOther",
              "tools.ozone.report.defs#reasonHarassmentTroll",
              "tools.ozone.report.defs#reasonHarassmentTargeted",
              "tools.ozone.report.defs#reasonHarassmentHateSpeech",
              "tools.ozone.report.defs#reasonHarassmentDoxxing",
              "tools.ozone.report.defs#reasonHarassmentOther",
              "tools.ozone.report.defs#reasonMisleadingBot",
              "tools.ozone.report.defs#reasonMisleadingImpersonation",
              "tools.ozone.report.defs#reasonMisleadingSpam",
              "tools.ozone.report.defs#reasonMisleadingScam",
              "tools.ozone.report.defs#reasonMisleadingSyntheticContent",
              "tools.ozone.report.defs#reasonMisleadingMisinformation",
              "tools.ozone.report.defs#reasonMisleadingOther",
              "tools.ozone.report.defs#reasonRuleSiteSecurity",
              "tools.ozone.report.defs#reasonRuleStolenContent",
              "tools.ozone.report.defs#reasonRuleProhibitedSales",
              "tools.ozone.report.defs#reasonRuleBanEvasion",
              "tools.ozone.report.defs#reasonRuleOther",
              "tools.ozone.report.defs#reasonCivicElectoralProcess",
              "tools.ozone.report.defs#reasonCivicDisclosure",
              "tools.ozone.report.defs#reasonCivicInterference",
              "tools.ozone.report.defs#reasonCivicMisinformation",
              "tools.ozone.report.defs#reasonCivicImpersonation"
            ]
          },
          reasonAppeal: {
            type: "token",
            description: "Appeal a previously taken moderation action"
          },
          reasonViolenceAnimalWelfare: {
            type: "token",
            description: "Animal welfare violations"
          },
          reasonViolenceThreats: {
            type: "token",
            description: "Threats or incitement"
          },
          reasonViolenceGraphicContent: {
            type: "token",
            description: "Graphic violent content"
          },
          reasonViolenceSelfHarm: {
            type: "token",
            description: "Self harm"
          },
          reasonViolenceGlorification: {
            type: "token",
            description: "Glorification of violence"
          },
          reasonViolenceExtremistContent: {
            type: "token",
            description: "Extremist content. These reports will be sent only be sent to the application's Moderation Authority."
          },
          reasonViolenceTrafficking: {
            type: "token",
            description: "Human trafficking"
          },
          reasonViolenceOther: {
            type: "token",
            description: "Other violent content"
          },
          reasonSexualAbuseContent: {
            type: "token",
            description: "Adult sexual abuse content"
          },
          reasonSexualNCII: {
            type: "token",
            description: "Non-consensual intimate imagery"
          },
          reasonSexualSextortion: {
            type: "token",
            description: "Sextortion"
          },
          reasonSexualDeepfake: {
            type: "token",
            description: "Deepfake adult content"
          },
          reasonSexualAnimal: {
            type: "token",
            description: "Animal sexual abuse"
          },
          reasonSexualUnlabeled: {
            type: "token",
            description: "Unlabelled adult content"
          },
          reasonSexualOther: {
            type: "token",
            description: "Other sexual violence content"
          },
          reasonChildSafetyCSAM: {
            type: "token",
            description: "Child sexual abuse material (CSAM). These reports will be sent only be sent to the application's Moderation Authority."
          },
          reasonChildSafetyGroom: {
            type: "token",
            description: "Grooming or predatory behavior. These reports will be sent only be sent to the application's Moderation Authority."
          },
          reasonChildSafetyMinorPrivacy: {
            type: "token",
            description: "Privacy violation involving a minor"
          },
          reasonChildSafetyEndangerment: {
            type: "token",
            description: "Child endangerment. These reports will be sent only be sent to the application's Moderation Authority."
          },
          reasonChildSafetyHarassment: {
            type: "token",
            description: "Harassment or bullying of minors"
          },
          reasonChildSafetyPromotion: {
            type: "token",
            description: "Promotion of child exploitation. These reports will be sent only be sent to the application's Moderation Authority."
          },
          reasonChildSafetyOther: {
            type: "token",
            description: "Other child safety. These reports will be sent only be sent to the application's Moderation Authority."
          },
          reasonHarassmentTroll: {
            type: "token",
            description: "Trolling"
          },
          reasonHarassmentTargeted: {
            type: "token",
            description: "Targeted harassment"
          },
          reasonHarassmentHateSpeech: {
            type: "token",
            description: "Hate speech"
          },
          reasonHarassmentDoxxing: {
            type: "token",
            description: "Doxxing"
          },
          reasonHarassmentOther: {
            type: "token",
            description: "Other harassing or hateful content"
          },
          reasonMisleadingBot: {
            type: "token",
            description: "Fake account or bot"
          },
          reasonMisleadingImpersonation: {
            type: "token",
            description: "Impersonation"
          },
          reasonMisleadingSpam: {
            type: "token",
            description: "Spam"
          },
          reasonMisleadingScam: {
            type: "token",
            description: "Scam"
          },
          reasonMisleadingSyntheticContent: {
            type: "token",
            description: "Unlabelled gen-AI or synthetic content"
          },
          reasonMisleadingMisinformation: {
            type: "token",
            description: "Harmful false claims"
          },
          reasonMisleadingOther: {
            type: "token",
            description: "Other misleading content"
          },
          reasonRuleSiteSecurity: {
            type: "token",
            description: "Hacking or system attacks"
          },
          reasonRuleStolenContent: {
            type: "token",
            description: "Stolen content"
          },
          reasonRuleProhibitedSales: {
            type: "token",
            description: "Promoting or selling prohibited items or services"
          },
          reasonRuleBanEvasion: {
            type: "token",
            description: "Banned user returning"
          },
          reasonRuleOther: {
            type: "token",
            description: "Other"
          },
          reasonCivicElectoralProcess: {
            type: "token",
            description: "Electoral process violations"
          },
          reasonCivicDisclosure: {
            type: "token",
            description: "Disclosure & transparency violations"
          },
          reasonCivicInterference: {
            type: "token",
            description: "Voter intimidation or interference"
          },
          reasonCivicMisinformation: {
            type: "token",
            description: "Election misinformation"
          },
          reasonCivicImpersonation: {
            type: "token",
            description: "Impersonation of electoral officials/entities"
          }
        }
      },
      ToolsOzoneSafelinkAddRule: {
        lexicon: 1,
        id: "tools.ozone.safelink.addRule",
        defs: {
          main: {
            type: "procedure",
            description: "Add a new URL safety rule",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["url", "pattern", "action", "reason"],
                properties: {
                  url: {
                    type: "string",
                    description: "The URL or domain to apply the rule to"
                  },
                  pattern: {
                    type: "ref",
                    ref: "lex:tools.ozone.safelink.defs#patternType"
                  },
                  action: {
                    type: "ref",
                    ref: "lex:tools.ozone.safelink.defs#actionType"
                  },
                  reason: {
                    type: "ref",
                    ref: "lex:tools.ozone.safelink.defs#reasonType"
                  },
                  comment: {
                    type: "string",
                    description: "Optional comment about the decision"
                  },
                  createdBy: {
                    type: "string",
                    format: "did",
                    description: "Author DID. Only respected when using admin auth"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.safelink.defs#event"
              }
            },
            errors: [
              {
                name: "InvalidUrl",
                description: "The provided URL is invalid"
              },
              {
                name: "RuleAlreadyExists",
                description: "A rule for this URL/domain already exists"
              }
            ]
          }
        }
      },
      ToolsOzoneSafelinkDefs: {
        lexicon: 1,
        id: "tools.ozone.safelink.defs",
        defs: {
          event: {
            type: "object",
            description: "An event for URL safety decisions",
            required: [
              "id",
              "eventType",
              "url",
              "pattern",
              "action",
              "reason",
              "createdBy",
              "createdAt"
            ],
            properties: {
              id: {
                type: "integer",
                description: "Auto-incrementing row ID"
              },
              eventType: {
                type: "ref",
                ref: "lex:tools.ozone.safelink.defs#eventType"
              },
              url: {
                type: "string",
                description: "The URL that this rule applies to"
              },
              pattern: {
                type: "ref",
                ref: "lex:tools.ozone.safelink.defs#patternType"
              },
              action: {
                type: "ref",
                ref: "lex:tools.ozone.safelink.defs#actionType"
              },
              reason: {
                type: "ref",
                ref: "lex:tools.ozone.safelink.defs#reasonType"
              },
              createdBy: {
                type: "string",
                format: "did",
                description: "DID of the user who created this rule"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              comment: {
                type: "string",
                description: "Optional comment about the decision"
              }
            }
          },
          eventType: {
            type: "string",
            knownValues: ["addRule", "updateRule", "removeRule"]
          },
          patternType: {
            type: "string",
            knownValues: ["domain", "url"]
          },
          actionType: {
            type: "string",
            knownValues: ["block", "warn", "whitelist"]
          },
          reasonType: {
            type: "string",
            knownValues: ["csam", "spam", "phishing", "none"]
          },
          urlRule: {
            type: "object",
            description: "Input for creating a URL safety rule",
            required: [
              "url",
              "pattern",
              "action",
              "reason",
              "createdBy",
              "createdAt",
              "updatedAt"
            ],
            properties: {
              url: {
                type: "string",
                description: "The URL or domain to apply the rule to"
              },
              pattern: {
                type: "ref",
                ref: "lex:tools.ozone.safelink.defs#patternType"
              },
              action: {
                type: "ref",
                ref: "lex:tools.ozone.safelink.defs#actionType"
              },
              reason: {
                type: "ref",
                ref: "lex:tools.ozone.safelink.defs#reasonType"
              },
              comment: {
                type: "string",
                description: "Optional comment about the decision"
              },
              createdBy: {
                type: "string",
                format: "did",
                description: "DID of the user added the rule."
              },
              createdAt: {
                type: "string",
                format: "datetime",
                description: "Timestamp when the rule was created"
              },
              updatedAt: {
                type: "string",
                format: "datetime",
                description: "Timestamp when the rule was last updated"
              }
            }
          }
        }
      },
      ToolsOzoneSafelinkQueryEvents: {
        lexicon: 1,
        id: "tools.ozone.safelink.queryEvents",
        defs: {
          main: {
            type: "procedure",
            description: "Query URL safety audit events",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  cursor: {
                    type: "string",
                    description: "Cursor for pagination"
                  },
                  limit: {
                    type: "integer",
                    minimum: 1,
                    maximum: 100,
                    default: 50,
                    description: "Maximum number of results to return"
                  },
                  urls: {
                    type: "array",
                    items: {
                      type: "string"
                    },
                    description: "Filter by specific URLs or domains"
                  },
                  patternType: {
                    type: "string",
                    description: "Filter by pattern type"
                  },
                  sortDirection: {
                    type: "string",
                    knownValues: ["asc", "desc"],
                    default: "desc",
                    description: "Sort direction"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["events"],
                properties: {
                  cursor: {
                    type: "string",
                    description: "Next cursor for pagination. Only present if there are more results."
                  },
                  events: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.safelink.defs#event"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneSafelinkQueryRules: {
        lexicon: 1,
        id: "tools.ozone.safelink.queryRules",
        defs: {
          main: {
            type: "procedure",
            description: "Query URL safety rules",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  cursor: {
                    type: "string",
                    description: "Cursor for pagination"
                  },
                  limit: {
                    type: "integer",
                    minimum: 1,
                    maximum: 100,
                    default: 50,
                    description: "Maximum number of results to return"
                  },
                  urls: {
                    type: "array",
                    items: {
                      type: "string"
                    },
                    description: "Filter by specific URLs or domains"
                  },
                  patternType: {
                    type: "string",
                    description: "Filter by pattern type"
                  },
                  actions: {
                    type: "array",
                    items: {
                      type: "string"
                    },
                    description: "Filter by action types"
                  },
                  reason: {
                    type: "string",
                    description: "Filter by reason type"
                  },
                  createdBy: {
                    type: "string",
                    format: "did",
                    description: "Filter by rule creator"
                  },
                  sortDirection: {
                    type: "string",
                    knownValues: ["asc", "desc"],
                    default: "desc",
                    description: "Sort direction"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["rules"],
                properties: {
                  cursor: {
                    type: "string",
                    description: "Next cursor for pagination. Only present if there are more results."
                  },
                  rules: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.safelink.defs#urlRule"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneSafelinkRemoveRule: {
        lexicon: 1,
        id: "tools.ozone.safelink.removeRule",
        defs: {
          main: {
            type: "procedure",
            description: "Remove an existing URL safety rule",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["url", "pattern"],
                properties: {
                  url: {
                    type: "string",
                    description: "The URL or domain to remove the rule for"
                  },
                  pattern: {
                    type: "ref",
                    ref: "lex:tools.ozone.safelink.defs#patternType"
                  },
                  comment: {
                    type: "string",
                    description: "Optional comment about why the rule is being removed"
                  },
                  createdBy: {
                    type: "string",
                    format: "did",
                    description: "Optional DID of the user. Only respected when using admin auth."
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.safelink.defs#event"
              }
            },
            errors: [
              {
                name: "RuleNotFound",
                description: "No active rule found for this URL/domain"
              }
            ]
          }
        }
      },
      ToolsOzoneSafelinkUpdateRule: {
        lexicon: 1,
        id: "tools.ozone.safelink.updateRule",
        defs: {
          main: {
            type: "procedure",
            description: "Update an existing URL safety rule",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["url", "pattern", "action", "reason"],
                properties: {
                  url: {
                    type: "string",
                    description: "The URL or domain to update the rule for"
                  },
                  pattern: {
                    type: "ref",
                    ref: "lex:tools.ozone.safelink.defs#patternType"
                  },
                  action: {
                    type: "ref",
                    ref: "lex:tools.ozone.safelink.defs#actionType"
                  },
                  reason: {
                    type: "ref",
                    ref: "lex:tools.ozone.safelink.defs#reasonType"
                  },
                  comment: {
                    type: "string",
                    description: "Optional comment about the update"
                  },
                  createdBy: {
                    type: "string",
                    format: "did",
                    description: "Optional DID to credit as the creator. Only respected for admin_token authentication."
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.safelink.defs#event"
              }
            },
            errors: [
              {
                name: "RuleNotFound",
                description: "No active rule found for this URL/domain"
              }
            ]
          }
        }
      },
      ToolsOzoneServerGetConfig: {
        lexicon: 1,
        id: "tools.ozone.server.getConfig",
        defs: {
          main: {
            type: "query",
            description: "Get details about ozone's server configuration.",
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {
                  appview: {
                    type: "ref",
                    ref: "lex:tools.ozone.server.getConfig#serviceConfig"
                  },
                  pds: {
                    type: "ref",
                    ref: "lex:tools.ozone.server.getConfig#serviceConfig"
                  },
                  blobDivert: {
                    type: "ref",
                    ref: "lex:tools.ozone.server.getConfig#serviceConfig"
                  },
                  chat: {
                    type: "ref",
                    ref: "lex:tools.ozone.server.getConfig#serviceConfig"
                  },
                  viewer: {
                    type: "ref",
                    ref: "lex:tools.ozone.server.getConfig#viewerConfig"
                  },
                  verifierDid: {
                    type: "string",
                    format: "did",
                    description: "The did of the verifier used for verification."
                  }
                }
              }
            }
          },
          serviceConfig: {
            type: "object",
            properties: {
              url: {
                type: "string",
                format: "uri"
              }
            }
          },
          viewerConfig: {
            type: "object",
            properties: {
              role: {
                type: "string",
                knownValues: [
                  "tools.ozone.team.defs#roleAdmin",
                  "tools.ozone.team.defs#roleModerator",
                  "tools.ozone.team.defs#roleTriage",
                  "tools.ozone.team.defs#roleVerifier"
                ]
              }
            }
          }
        }
      },
      ToolsOzoneSetAddValues: {
        lexicon: 1,
        id: "tools.ozone.set.addValues",
        defs: {
          main: {
            type: "procedure",
            description: "Add values to a specific set. Attempting to add values to a set that does not exist will result in an error.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["name", "values"],
                properties: {
                  name: {
                    type: "string",
                    description: "Name of the set to add values to"
                  },
                  values: {
                    type: "array",
                    minLength: 1,
                    maxLength: 1e3,
                    items: {
                      type: "string"
                    },
                    description: "Array of string values to add to the set"
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneSetDefs: {
        lexicon: 1,
        id: "tools.ozone.set.defs",
        defs: {
          set: {
            type: "object",
            required: ["name"],
            properties: {
              name: {
                type: "string",
                minLength: 3,
                maxLength: 128
              },
              description: {
                type: "string",
                maxGraphemes: 1024,
                maxLength: 10240
              }
            }
          },
          setView: {
            type: "object",
            required: ["name", "setSize", "createdAt", "updatedAt"],
            properties: {
              name: {
                type: "string",
                minLength: 3,
                maxLength: 128
              },
              description: {
                type: "string",
                maxGraphemes: 1024,
                maxLength: 10240
              },
              setSize: {
                type: "integer"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              updatedAt: {
                type: "string",
                format: "datetime"
              }
            }
          }
        }
      },
      ToolsOzoneSetDeleteSet: {
        lexicon: 1,
        id: "tools.ozone.set.deleteSet",
        defs: {
          main: {
            type: "procedure",
            description: "Delete an entire set. Attempting to delete a set that does not exist will result in an error.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["name"],
                properties: {
                  name: {
                    type: "string",
                    description: "Name of the set to delete"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {}
              }
            },
            errors: [
              {
                name: "SetNotFound",
                description: "set with the given name does not exist"
              }
            ]
          }
        }
      },
      ToolsOzoneSetDeleteValues: {
        lexicon: 1,
        id: "tools.ozone.set.deleteValues",
        defs: {
          main: {
            type: "procedure",
            description: "Delete values from a specific set. Attempting to delete values that are not in the set will not result in an error",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["name", "values"],
                properties: {
                  name: {
                    type: "string",
                    description: "Name of the set to delete values from"
                  },
                  values: {
                    type: "array",
                    minLength: 1,
                    items: {
                      type: "string"
                    },
                    description: "Array of string values to delete from the set"
                  }
                }
              }
            },
            errors: [
              {
                name: "SetNotFound",
                description: "set with the given name does not exist"
              }
            ]
          }
        }
      },
      ToolsOzoneSetGetValues: {
        lexicon: 1,
        id: "tools.ozone.set.getValues",
        defs: {
          main: {
            type: "query",
            description: "Get a specific set and its values",
            parameters: {
              type: "params",
              required: ["name"],
              properties: {
                name: {
                  type: "string"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 1e3,
                  default: 100
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["set", "values"],
                properties: {
                  set: {
                    type: "ref",
                    ref: "lex:tools.ozone.set.defs#setView"
                  },
                  values: {
                    type: "array",
                    items: {
                      type: "string"
                    }
                  },
                  cursor: {
                    type: "string"
                  }
                }
              }
            },
            errors: [
              {
                name: "SetNotFound",
                description: "set with the given name does not exist"
              }
            ]
          }
        }
      },
      ToolsOzoneSetQuerySets: {
        lexicon: 1,
        id: "tools.ozone.set.querySets",
        defs: {
          main: {
            type: "query",
            description: "Query available sets",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                },
                namePrefix: {
                  type: "string"
                },
                sortBy: {
                  type: "string",
                  enum: ["name", "createdAt", "updatedAt"],
                  default: "name"
                },
                sortDirection: {
                  type: "string",
                  default: "asc",
                  enum: ["asc", "desc"],
                  description: "Defaults to ascending order of name field."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["sets"],
                properties: {
                  sets: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.set.defs#setView"
                    }
                  },
                  cursor: {
                    type: "string"
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneSetUpsertSet: {
        lexicon: 1,
        id: "tools.ozone.set.upsertSet",
        defs: {
          main: {
            type: "procedure",
            description: "Create or update set metadata",
            input: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.set.defs#set"
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.set.defs#setView"
              }
            }
          }
        }
      },
      ToolsOzoneSettingDefs: {
        lexicon: 1,
        id: "tools.ozone.setting.defs",
        defs: {
          option: {
            type: "object",
            required: [
              "key",
              "value",
              "did",
              "scope",
              "createdBy",
              "lastUpdatedBy"
            ],
            properties: {
              key: {
                type: "string",
                format: "nsid"
              },
              did: {
                type: "string",
                format: "did"
              },
              value: {
                type: "unknown"
              },
              description: {
                type: "string",
                maxGraphemes: 1024,
                maxLength: 10240
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              updatedAt: {
                type: "string",
                format: "datetime"
              },
              managerRole: {
                type: "string",
                knownValues: [
                  "tools.ozone.team.defs#roleModerator",
                  "tools.ozone.team.defs#roleTriage",
                  "tools.ozone.team.defs#roleAdmin",
                  "tools.ozone.team.defs#roleVerifier"
                ]
              },
              scope: {
                type: "string",
                knownValues: ["instance", "personal"]
              },
              createdBy: {
                type: "string",
                format: "did"
              },
              lastUpdatedBy: {
                type: "string",
                format: "did"
              }
            }
          }
        }
      },
      ToolsOzoneSettingListOptions: {
        lexicon: 1,
        id: "tools.ozone.setting.listOptions",
        defs: {
          main: {
            type: "query",
            description: "List settings with optional filtering",
            parameters: {
              type: "params",
              properties: {
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                },
                scope: {
                  type: "string",
                  knownValues: ["instance", "personal"],
                  default: "instance"
                },
                prefix: {
                  type: "string",
                  description: "Filter keys by prefix"
                },
                keys: {
                  type: "array",
                  maxLength: 100,
                  items: {
                    type: "string",
                    format: "nsid"
                  },
                  description: "Filter for only the specified keys. Ignored if prefix is provided"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["options"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  options: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.setting.defs#option"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneSettingRemoveOptions: {
        lexicon: 1,
        id: "tools.ozone.setting.removeOptions",
        defs: {
          main: {
            type: "procedure",
            description: "Delete settings by key",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["keys", "scope"],
                properties: {
                  keys: {
                    type: "array",
                    minLength: 1,
                    maxLength: 200,
                    items: {
                      type: "string",
                      format: "nsid"
                    }
                  },
                  scope: {
                    type: "string",
                    knownValues: ["instance", "personal"]
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                properties: {}
              }
            }
          }
        }
      },
      ToolsOzoneSettingUpsertOption: {
        lexicon: 1,
        id: "tools.ozone.setting.upsertOption",
        defs: {
          main: {
            type: "procedure",
            description: "Create or update setting option",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["key", "scope", "value"],
                properties: {
                  key: {
                    type: "string",
                    format: "nsid"
                  },
                  scope: {
                    type: "string",
                    knownValues: ["instance", "personal"]
                  },
                  value: {
                    type: "unknown"
                  },
                  description: {
                    type: "string",
                    maxLength: 2e3
                  },
                  managerRole: {
                    type: "string",
                    knownValues: [
                      "tools.ozone.team.defs#roleModerator",
                      "tools.ozone.team.defs#roleTriage",
                      "tools.ozone.team.defs#roleVerifier",
                      "tools.ozone.team.defs#roleAdmin"
                    ]
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["option"],
                properties: {
                  option: {
                    type: "ref",
                    ref: "lex:tools.ozone.setting.defs#option"
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneSignatureDefs: {
        lexicon: 1,
        id: "tools.ozone.signature.defs",
        defs: {
          sigDetail: {
            type: "object",
            required: ["property", "value"],
            properties: {
              property: {
                type: "string"
              },
              value: {
                type: "string"
              }
            }
          }
        }
      },
      ToolsOzoneSignatureFindCorrelation: {
        lexicon: 1,
        id: "tools.ozone.signature.findCorrelation",
        defs: {
          main: {
            type: "query",
            description: "Find all correlated threat signatures between 2 or more accounts.",
            parameters: {
              type: "params",
              required: ["dids"],
              properties: {
                dids: {
                  type: "array",
                  items: {
                    type: "string",
                    format: "did"
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["details"],
                properties: {
                  details: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.signature.defs#sigDetail"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneSignatureFindRelatedAccounts: {
        lexicon: 1,
        id: "tools.ozone.signature.findRelatedAccounts",
        defs: {
          main: {
            type: "query",
            description: "Get accounts that share some matching threat signatures with the root account.",
            parameters: {
              type: "params",
              required: ["did"],
              properties: {
                did: {
                  type: "string",
                  format: "did"
                },
                cursor: {
                  type: "string"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["accounts"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  accounts: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.signature.findRelatedAccounts#relatedAccount"
                    }
                  }
                }
              }
            }
          },
          relatedAccount: {
            type: "object",
            required: ["account"],
            properties: {
              account: {
                type: "ref",
                ref: "lex:com.atproto.admin.defs#accountView"
              },
              similarities: {
                type: "array",
                items: {
                  type: "ref",
                  ref: "lex:tools.ozone.signature.defs#sigDetail"
                }
              }
            }
          }
        }
      },
      ToolsOzoneSignatureSearchAccounts: {
        lexicon: 1,
        id: "tools.ozone.signature.searchAccounts",
        defs: {
          main: {
            type: "query",
            description: "Search for accounts that match one or more threat signature values.",
            parameters: {
              type: "params",
              required: ["values"],
              properties: {
                values: {
                  type: "array",
                  items: {
                    type: "string"
                  }
                },
                cursor: {
                  type: "string"
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["accounts"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  accounts: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:com.atproto.admin.defs#accountView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneTeamAddMember: {
        lexicon: 1,
        id: "tools.ozone.team.addMember",
        defs: {
          main: {
            type: "procedure",
            description: "Add a member to the ozone team. Requires admin role.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did", "role"],
                properties: {
                  did: {
                    type: "string",
                    format: "did"
                  },
                  role: {
                    type: "string",
                    knownValues: [
                      "tools.ozone.team.defs#roleAdmin",
                      "tools.ozone.team.defs#roleModerator",
                      "tools.ozone.team.defs#roleVerifier",
                      "tools.ozone.team.defs#roleTriage"
                    ]
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.team.defs#member"
              }
            },
            errors: [
              {
                name: "MemberAlreadyExists",
                description: "Member already exists in the team."
              }
            ]
          }
        }
      },
      ToolsOzoneTeamDefs: {
        lexicon: 1,
        id: "tools.ozone.team.defs",
        defs: {
          member: {
            type: "object",
            required: ["did", "role"],
            properties: {
              did: {
                type: "string",
                format: "did"
              },
              disabled: {
                type: "boolean"
              },
              profile: {
                type: "ref",
                ref: "lex:app.bsky.actor.defs#profileViewDetailed"
              },
              createdAt: {
                type: "string",
                format: "datetime"
              },
              updatedAt: {
                type: "string",
                format: "datetime"
              },
              lastUpdatedBy: {
                type: "string"
              },
              role: {
                type: "string",
                knownValues: [
                  "lex:tools.ozone.team.defs#roleAdmin",
                  "lex:tools.ozone.team.defs#roleModerator",
                  "lex:tools.ozone.team.defs#roleTriage",
                  "lex:tools.ozone.team.defs#roleVerifier"
                ]
              }
            }
          },
          roleAdmin: {
            type: "token",
            description: "Admin role. Highest level of access, can perform all actions."
          },
          roleModerator: {
            type: "token",
            description: "Moderator role. Can perform most actions."
          },
          roleTriage: {
            type: "token",
            description: "Triage role. Mostly intended for monitoring and escalating issues."
          },
          roleVerifier: {
            type: "token",
            description: "Verifier role. Only allowed to issue verifications."
          }
        }
      },
      ToolsOzoneTeamDeleteMember: {
        lexicon: 1,
        id: "tools.ozone.team.deleteMember",
        defs: {
          main: {
            type: "procedure",
            description: "Delete a member from ozone team. Requires admin role.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did"],
                properties: {
                  did: {
                    type: "string",
                    format: "did"
                  }
                }
              }
            },
            errors: [
              {
                name: "MemberNotFound",
                description: "The member being deleted does not exist"
              },
              {
                name: "CannotDeleteSelf",
                description: "You can not delete yourself from the team"
              }
            ]
          }
        }
      },
      ToolsOzoneTeamListMembers: {
        lexicon: 1,
        id: "tools.ozone.team.listMembers",
        defs: {
          main: {
            type: "query",
            description: "List all members with access to the ozone service.",
            parameters: {
              type: "params",
              properties: {
                q: {
                  type: "string"
                },
                disabled: {
                  type: "boolean"
                },
                roles: {
                  type: "array",
                  items: {
                    type: "string"
                  }
                },
                limit: {
                  type: "integer",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                cursor: {
                  type: "string"
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["members"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  members: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.team.defs#member"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneTeamUpdateMember: {
        lexicon: 1,
        id: "tools.ozone.team.updateMember",
        defs: {
          main: {
            type: "procedure",
            description: "Update a member in the ozone service. Requires admin role.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["did"],
                properties: {
                  did: {
                    type: "string",
                    format: "did"
                  },
                  disabled: {
                    type: "boolean"
                  },
                  role: {
                    type: "string",
                    knownValues: [
                      "tools.ozone.team.defs#roleAdmin",
                      "tools.ozone.team.defs#roleModerator",
                      "tools.ozone.team.defs#roleVerifier",
                      "tools.ozone.team.defs#roleTriage"
                    ]
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "ref",
                ref: "lex:tools.ozone.team.defs#member"
              }
            },
            errors: [
              {
                name: "MemberNotFound",
                description: "The member being updated does not exist in the team"
              }
            ]
          }
        }
      },
      ToolsOzoneVerificationDefs: {
        lexicon: 1,
        id: "tools.ozone.verification.defs",
        defs: {
          verificationView: {
            type: "object",
            description: "Verification data for the associated subject.",
            required: [
              "issuer",
              "uri",
              "subject",
              "handle",
              "displayName",
              "createdAt"
            ],
            properties: {
              issuer: {
                type: "string",
                description: "The user who issued this verification.",
                format: "did"
              },
              uri: {
                type: "string",
                description: "The AT-URI of the verification record.",
                format: "at-uri"
              },
              subject: {
                type: "string",
                format: "did",
                description: "The subject of the verification."
              },
              handle: {
                type: "string",
                description: "Handle of the subject the verification applies to at the moment of verifying, which might not be the same at the time of viewing. The verification is only valid if the current handle matches the one at the time of verifying.",
                format: "handle"
              },
              displayName: {
                type: "string",
                description: "Display name of the subject the verification applies to at the moment of verifying, which might not be the same at the time of viewing. The verification is only valid if the current displayName matches the one at the time of verifying."
              },
              createdAt: {
                type: "string",
                description: "Timestamp when the verification was created.",
                format: "datetime"
              },
              revokeReason: {
                type: "string",
                description: "Describes the reason for revocation, also indicating that the verification is no longer valid."
              },
              revokedAt: {
                type: "string",
                description: "Timestamp when the verification was revoked.",
                format: "datetime"
              },
              revokedBy: {
                type: "string",
                description: "The user who revoked this verification.",
                format: "did"
              },
              subjectProfile: {
                type: "union",
                refs: []
              },
              issuerProfile: {
                type: "union",
                refs: []
              },
              subjectRepo: {
                type: "union",
                refs: [
                  "lex:tools.ozone.moderation.defs#repoViewDetail",
                  "lex:tools.ozone.moderation.defs#repoViewNotFound"
                ]
              },
              issuerRepo: {
                type: "union",
                refs: [
                  "lex:tools.ozone.moderation.defs#repoViewDetail",
                  "lex:tools.ozone.moderation.defs#repoViewNotFound"
                ]
              }
            }
          }
        }
      },
      ToolsOzoneVerificationGrantVerifications: {
        lexicon: 1,
        id: "tools.ozone.verification.grantVerifications",
        defs: {
          main: {
            type: "procedure",
            description: "Grant verifications to multiple subjects. Allows batch processing of up to 100 verifications at once.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["verifications"],
                properties: {
                  verifications: {
                    type: "array",
                    description: "Array of verification requests to process",
                    maxLength: 100,
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.verification.grantVerifications#verificationInput"
                    }
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["verifications", "failedVerifications"],
                properties: {
                  verifications: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.verification.defs#verificationView"
                    }
                  },
                  failedVerifications: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.verification.grantVerifications#grantError"
                    }
                  }
                }
              }
            }
          },
          verificationInput: {
            type: "object",
            required: ["subject", "handle", "displayName"],
            properties: {
              subject: {
                type: "string",
                description: "The did of the subject being verified",
                format: "did"
              },
              handle: {
                type: "string",
                description: "Handle of the subject the verification applies to at the moment of verifying.",
                format: "handle"
              },
              displayName: {
                type: "string",
                description: "Display name of the subject the verification applies to at the moment of verifying."
              },
              createdAt: {
                type: "string",
                format: "datetime",
                description: "Timestamp for verification record. Defaults to current time when not specified."
              }
            }
          },
          grantError: {
            type: "object",
            description: "Error object for failed verifications.",
            required: ["error", "subject"],
            properties: {
              error: {
                type: "string",
                description: "Error message describing the reason for failure."
              },
              subject: {
                type: "string",
                description: "The did of the subject being verified",
                format: "did"
              }
            }
          }
        }
      },
      ToolsOzoneVerificationListVerifications: {
        lexicon: 1,
        id: "tools.ozone.verification.listVerifications",
        defs: {
          main: {
            type: "query",
            description: "List verifications",
            parameters: {
              type: "params",
              properties: {
                cursor: {
                  type: "string",
                  description: "Pagination cursor"
                },
                limit: {
                  type: "integer",
                  description: "Maximum number of results to return",
                  minimum: 1,
                  maximum: 100,
                  default: 50
                },
                createdAfter: {
                  type: "string",
                  format: "datetime",
                  description: "Filter to verifications created after this timestamp"
                },
                createdBefore: {
                  type: "string",
                  format: "datetime",
                  description: "Filter to verifications created before this timestamp"
                },
                issuers: {
                  type: "array",
                  maxLength: 100,
                  description: "Filter to verifications from specific issuers",
                  items: {
                    type: "string",
                    format: "did"
                  }
                },
                subjects: {
                  type: "array",
                  description: "Filter to specific verified DIDs",
                  maxLength: 100,
                  items: {
                    type: "string",
                    format: "did"
                  }
                },
                sortDirection: {
                  type: "string",
                  description: "Sort direction for creation date",
                  enum: ["asc", "desc"],
                  default: "desc"
                },
                isRevoked: {
                  type: "boolean",
                  description: "Filter to verifications that are revoked or not. By default, includes both."
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["verifications"],
                properties: {
                  cursor: {
                    type: "string"
                  },
                  verifications: {
                    type: "array",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.verification.defs#verificationView"
                    }
                  }
                }
              }
            }
          }
        }
      },
      ToolsOzoneVerificationRevokeVerifications: {
        lexicon: 1,
        id: "tools.ozone.verification.revokeVerifications",
        defs: {
          main: {
            type: "procedure",
            description: "Revoke previously granted verifications in batches of up to 100.",
            input: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["uris"],
                properties: {
                  uris: {
                    type: "array",
                    description: "Array of verification record uris to revoke",
                    maxLength: 100,
                    items: {
                      type: "string",
                      description: "The AT-URI of the verification record to revoke.",
                      format: "at-uri"
                    }
                  },
                  revokeReason: {
                    type: "string",
                    description: "Reason for revoking the verification. This is optional and can be omitted if not needed.",
                    maxLength: 1e3
                  }
                }
              }
            },
            output: {
              encoding: "application/json",
              schema: {
                type: "object",
                required: ["revokedVerifications", "failedRevocations"],
                properties: {
                  revokedVerifications: {
                    type: "array",
                    description: "List of verification uris successfully revoked",
                    items: {
                      type: "string",
                      format: "at-uri"
                    }
                  },
                  failedRevocations: {
                    type: "array",
                    description: "List of verification uris that couldn't be revoked, including failure reasons",
                    items: {
                      type: "ref",
                      ref: "lex:tools.ozone.verification.revokeVerifications#revokeError"
                    }
                  }
                }
              }
            }
          },
          revokeError: {
            type: "object",
            description: "Error object for failed revocations",
            required: ["uri", "error"],
            properties: {
              uri: {
                type: "string",
                description: "The AT-URI of the verification record that failed to revoke.",
                format: "at-uri"
              },
              error: {
                type: "string",
                description: "Description of the error that occurred during revocation."
              }
            }
          }
        }
      }
    };
    exports.schemas = Object.values(exports.schemaDict);
    exports.lexicons = new lexicon_1.Lexicons(exports.schemas);
    function validate(v, id, hash, requiredType) {
      return (requiredType ? util_js_1.is$typed : util_js_1.maybe$typed)(v, id, hash) ? exports.lexicons.validate(`${id}#${hash}`, v) : {
        success: false,
        error: new lexicon_1.ValidationError(`Must be an object with "${hash === "main" ? id : `${id}#${hash}`}" $type property`)
      };
    }
    exports.ids = {
      AppBskyActorDefs: "app.bsky.actor.defs",
      AppBskyActorGetPreferences: "app.bsky.actor.getPreferences",
      AppBskyActorGetProfile: "app.bsky.actor.getProfile",
      AppBskyActorGetProfiles: "app.bsky.actor.getProfiles",
      AppBskyActorGetSuggestions: "app.bsky.actor.getSuggestions",
      AppBskyActorProfile: "app.bsky.actor.profile",
      AppBskyActorPutPreferences: "app.bsky.actor.putPreferences",
      AppBskyActorSearchActors: "app.bsky.actor.searchActors",
      AppBskyActorSearchActorsTypeahead: "app.bsky.actor.searchActorsTypeahead",
      AppBskyActorStatus: "app.bsky.actor.status",
      AppBskyBookmarkCreateBookmark: "app.bsky.bookmark.createBookmark",
      AppBskyBookmarkDefs: "app.bsky.bookmark.defs",
      AppBskyBookmarkDeleteBookmark: "app.bsky.bookmark.deleteBookmark",
      AppBskyBookmarkGetBookmarks: "app.bsky.bookmark.getBookmarks",
      AppBskyEmbedDefs: "app.bsky.embed.defs",
      AppBskyEmbedExternal: "app.bsky.embed.external",
      AppBskyEmbedImages: "app.bsky.embed.images",
      AppBskyEmbedRecord: "app.bsky.embed.record",
      AppBskyEmbedRecordWithMedia: "app.bsky.embed.recordWithMedia",
      AppBskyEmbedVideo: "app.bsky.embed.video",
      AppBskyFeedDefs: "app.bsky.feed.defs",
      AppBskyFeedDescribeFeedGenerator: "app.bsky.feed.describeFeedGenerator",
      AppBskyFeedGenerator: "app.bsky.feed.generator",
      AppBskyFeedGetActorFeeds: "app.bsky.feed.getActorFeeds",
      AppBskyFeedGetActorLikes: "app.bsky.feed.getActorLikes",
      AppBskyFeedGetAuthorFeed: "app.bsky.feed.getAuthorFeed",
      AppBskyFeedGetFeed: "app.bsky.feed.getFeed",
      AppBskyFeedGetFeedGenerator: "app.bsky.feed.getFeedGenerator",
      AppBskyFeedGetFeedGenerators: "app.bsky.feed.getFeedGenerators",
      AppBskyFeedGetFeedSkeleton: "app.bsky.feed.getFeedSkeleton",
      AppBskyFeedGetLikes: "app.bsky.feed.getLikes",
      AppBskyFeedGetListFeed: "app.bsky.feed.getListFeed",
      AppBskyFeedGetPostThread: "app.bsky.feed.getPostThread",
      AppBskyFeedGetPosts: "app.bsky.feed.getPosts",
      AppBskyFeedGetQuotes: "app.bsky.feed.getQuotes",
      AppBskyFeedGetRepostedBy: "app.bsky.feed.getRepostedBy",
      AppBskyFeedGetSuggestedFeeds: "app.bsky.feed.getSuggestedFeeds",
      AppBskyFeedGetTimeline: "app.bsky.feed.getTimeline",
      AppBskyFeedLike: "app.bsky.feed.like",
      AppBskyFeedPost: "app.bsky.feed.post",
      AppBskyFeedPostgate: "app.bsky.feed.postgate",
      AppBskyFeedRepost: "app.bsky.feed.repost",
      AppBskyFeedSearchPosts: "app.bsky.feed.searchPosts",
      AppBskyFeedSendInteractions: "app.bsky.feed.sendInteractions",
      AppBskyFeedThreadgate: "app.bsky.feed.threadgate",
      AppBskyGraphBlock: "app.bsky.graph.block",
      AppBskyGraphDefs: "app.bsky.graph.defs",
      AppBskyGraphFollow: "app.bsky.graph.follow",
      AppBskyGraphGetActorStarterPacks: "app.bsky.graph.getActorStarterPacks",
      AppBskyGraphGetBlocks: "app.bsky.graph.getBlocks",
      AppBskyGraphGetFollowers: "app.bsky.graph.getFollowers",
      AppBskyGraphGetFollows: "app.bsky.graph.getFollows",
      AppBskyGraphGetKnownFollowers: "app.bsky.graph.getKnownFollowers",
      AppBskyGraphGetList: "app.bsky.graph.getList",
      AppBskyGraphGetListBlocks: "app.bsky.graph.getListBlocks",
      AppBskyGraphGetListMutes: "app.bsky.graph.getListMutes",
      AppBskyGraphGetLists: "app.bsky.graph.getLists",
      AppBskyGraphGetListsWithMembership: "app.bsky.graph.getListsWithMembership",
      AppBskyGraphGetMutes: "app.bsky.graph.getMutes",
      AppBskyGraphGetRelationships: "app.bsky.graph.getRelationships",
      AppBskyGraphGetStarterPack: "app.bsky.graph.getStarterPack",
      AppBskyGraphGetStarterPacks: "app.bsky.graph.getStarterPacks",
      AppBskyGraphGetStarterPacksWithMembership: "app.bsky.graph.getStarterPacksWithMembership",
      AppBskyGraphGetSuggestedFollowsByActor: "app.bsky.graph.getSuggestedFollowsByActor",
      AppBskyGraphList: "app.bsky.graph.list",
      AppBskyGraphListblock: "app.bsky.graph.listblock",
      AppBskyGraphListitem: "app.bsky.graph.listitem",
      AppBskyGraphMuteActor: "app.bsky.graph.muteActor",
      AppBskyGraphMuteActorList: "app.bsky.graph.muteActorList",
      AppBskyGraphMuteThread: "app.bsky.graph.muteThread",
      AppBskyGraphSearchStarterPacks: "app.bsky.graph.searchStarterPacks",
      AppBskyGraphStarterpack: "app.bsky.graph.starterpack",
      AppBskyGraphUnmuteActor: "app.bsky.graph.unmuteActor",
      AppBskyGraphUnmuteActorList: "app.bsky.graph.unmuteActorList",
      AppBskyGraphUnmuteThread: "app.bsky.graph.unmuteThread",
      AppBskyGraphVerification: "app.bsky.graph.verification",
      AppBskyLabelerDefs: "app.bsky.labeler.defs",
      AppBskyLabelerGetServices: "app.bsky.labeler.getServices",
      AppBskyLabelerService: "app.bsky.labeler.service",
      AppBskyNotificationDeclaration: "app.bsky.notification.declaration",
      AppBskyNotificationDefs: "app.bsky.notification.defs",
      AppBskyNotificationGetPreferences: "app.bsky.notification.getPreferences",
      AppBskyNotificationGetUnreadCount: "app.bsky.notification.getUnreadCount",
      AppBskyNotificationListActivitySubscriptions: "app.bsky.notification.listActivitySubscriptions",
      AppBskyNotificationListNotifications: "app.bsky.notification.listNotifications",
      AppBskyNotificationPutActivitySubscription: "app.bsky.notification.putActivitySubscription",
      AppBskyNotificationPutPreferences: "app.bsky.notification.putPreferences",
      AppBskyNotificationPutPreferencesV2: "app.bsky.notification.putPreferencesV2",
      AppBskyNotificationRegisterPush: "app.bsky.notification.registerPush",
      AppBskyNotificationUnregisterPush: "app.bsky.notification.unregisterPush",
      AppBskyNotificationUpdateSeen: "app.bsky.notification.updateSeen",
      AppBskyRichtextFacet: "app.bsky.richtext.facet",
      AppBskyUnspeccedDefs: "app.bsky.unspecced.defs",
      AppBskyUnspeccedGetAgeAssuranceState: "app.bsky.unspecced.getAgeAssuranceState",
      AppBskyUnspeccedGetConfig: "app.bsky.unspecced.getConfig",
      AppBskyUnspeccedGetPopularFeedGenerators: "app.bsky.unspecced.getPopularFeedGenerators",
      AppBskyUnspeccedGetPostThreadOtherV2: "app.bsky.unspecced.getPostThreadOtherV2",
      AppBskyUnspeccedGetPostThreadV2: "app.bsky.unspecced.getPostThreadV2",
      AppBskyUnspeccedGetSuggestedFeeds: "app.bsky.unspecced.getSuggestedFeeds",
      AppBskyUnspeccedGetSuggestedFeedsSkeleton: "app.bsky.unspecced.getSuggestedFeedsSkeleton",
      AppBskyUnspeccedGetSuggestedStarterPacks: "app.bsky.unspecced.getSuggestedStarterPacks",
      AppBskyUnspeccedGetSuggestedStarterPacksSkeleton: "app.bsky.unspecced.getSuggestedStarterPacksSkeleton",
      AppBskyUnspeccedGetSuggestedUsers: "app.bsky.unspecced.getSuggestedUsers",
      AppBskyUnspeccedGetSuggestedUsersSkeleton: "app.bsky.unspecced.getSuggestedUsersSkeleton",
      AppBskyUnspeccedGetSuggestionsSkeleton: "app.bsky.unspecced.getSuggestionsSkeleton",
      AppBskyUnspeccedGetTaggedSuggestions: "app.bsky.unspecced.getTaggedSuggestions",
      AppBskyUnspeccedGetTrendingTopics: "app.bsky.unspecced.getTrendingTopics",
      AppBskyUnspeccedGetTrends: "app.bsky.unspecced.getTrends",
      AppBskyUnspeccedGetTrendsSkeleton: "app.bsky.unspecced.getTrendsSkeleton",
      AppBskyUnspeccedInitAgeAssurance: "app.bsky.unspecced.initAgeAssurance",
      AppBskyUnspeccedSearchActorsSkeleton: "app.bsky.unspecced.searchActorsSkeleton",
      AppBskyUnspeccedSearchPostsSkeleton: "app.bsky.unspecced.searchPostsSkeleton",
      AppBskyUnspeccedSearchStarterPacksSkeleton: "app.bsky.unspecced.searchStarterPacksSkeleton",
      AppBskyVideoDefs: "app.bsky.video.defs",
      AppBskyVideoGetJobStatus: "app.bsky.video.getJobStatus",
      AppBskyVideoGetUploadLimits: "app.bsky.video.getUploadLimits",
      AppBskyVideoUploadVideo: "app.bsky.video.uploadVideo",
      ChatBskyActorDeclaration: "chat.bsky.actor.declaration",
      ChatBskyActorDefs: "chat.bsky.actor.defs",
      ChatBskyActorDeleteAccount: "chat.bsky.actor.deleteAccount",
      ChatBskyActorExportAccountData: "chat.bsky.actor.exportAccountData",
      ChatBskyConvoAcceptConvo: "chat.bsky.convo.acceptConvo",
      ChatBskyConvoAddReaction: "chat.bsky.convo.addReaction",
      ChatBskyConvoDefs: "chat.bsky.convo.defs",
      ChatBskyConvoDeleteMessageForSelf: "chat.bsky.convo.deleteMessageForSelf",
      ChatBskyConvoGetConvo: "chat.bsky.convo.getConvo",
      ChatBskyConvoGetConvoAvailability: "chat.bsky.convo.getConvoAvailability",
      ChatBskyConvoGetConvoForMembers: "chat.bsky.convo.getConvoForMembers",
      ChatBskyConvoGetLog: "chat.bsky.convo.getLog",
      ChatBskyConvoGetMessages: "chat.bsky.convo.getMessages",
      ChatBskyConvoLeaveConvo: "chat.bsky.convo.leaveConvo",
      ChatBskyConvoListConvos: "chat.bsky.convo.listConvos",
      ChatBskyConvoMuteConvo: "chat.bsky.convo.muteConvo",
      ChatBskyConvoRemoveReaction: "chat.bsky.convo.removeReaction",
      ChatBskyConvoSendMessage: "chat.bsky.convo.sendMessage",
      ChatBskyConvoSendMessageBatch: "chat.bsky.convo.sendMessageBatch",
      ChatBskyConvoUnmuteConvo: "chat.bsky.convo.unmuteConvo",
      ChatBskyConvoUpdateAllRead: "chat.bsky.convo.updateAllRead",
      ChatBskyConvoUpdateRead: "chat.bsky.convo.updateRead",
      ChatBskyModerationGetActorMetadata: "chat.bsky.moderation.getActorMetadata",
      ChatBskyModerationGetMessageContext: "chat.bsky.moderation.getMessageContext",
      ChatBskyModerationUpdateActorAccess: "chat.bsky.moderation.updateActorAccess",
      ComAtprotoAdminDefs: "com.atproto.admin.defs",
      ComAtprotoAdminDeleteAccount: "com.atproto.admin.deleteAccount",
      ComAtprotoAdminDisableAccountInvites: "com.atproto.admin.disableAccountInvites",
      ComAtprotoAdminDisableInviteCodes: "com.atproto.admin.disableInviteCodes",
      ComAtprotoAdminEnableAccountInvites: "com.atproto.admin.enableAccountInvites",
      ComAtprotoAdminGetAccountInfo: "com.atproto.admin.getAccountInfo",
      ComAtprotoAdminGetAccountInfos: "com.atproto.admin.getAccountInfos",
      ComAtprotoAdminGetInviteCodes: "com.atproto.admin.getInviteCodes",
      ComAtprotoAdminGetSubjectStatus: "com.atproto.admin.getSubjectStatus",
      ComAtprotoAdminSearchAccounts: "com.atproto.admin.searchAccounts",
      ComAtprotoAdminSendEmail: "com.atproto.admin.sendEmail",
      ComAtprotoAdminUpdateAccountEmail: "com.atproto.admin.updateAccountEmail",
      ComAtprotoAdminUpdateAccountHandle: "com.atproto.admin.updateAccountHandle",
      ComAtprotoAdminUpdateAccountPassword: "com.atproto.admin.updateAccountPassword",
      ComAtprotoAdminUpdateAccountSigningKey: "com.atproto.admin.updateAccountSigningKey",
      ComAtprotoAdminUpdateSubjectStatus: "com.atproto.admin.updateSubjectStatus",
      ComAtprotoIdentityDefs: "com.atproto.identity.defs",
      ComAtprotoIdentityGetRecommendedDidCredentials: "com.atproto.identity.getRecommendedDidCredentials",
      ComAtprotoIdentityRefreshIdentity: "com.atproto.identity.refreshIdentity",
      ComAtprotoIdentityRequestPlcOperationSignature: "com.atproto.identity.requestPlcOperationSignature",
      ComAtprotoIdentityResolveDid: "com.atproto.identity.resolveDid",
      ComAtprotoIdentityResolveHandle: "com.atproto.identity.resolveHandle",
      ComAtprotoIdentityResolveIdentity: "com.atproto.identity.resolveIdentity",
      ComAtprotoIdentitySignPlcOperation: "com.atproto.identity.signPlcOperation",
      ComAtprotoIdentitySubmitPlcOperation: "com.atproto.identity.submitPlcOperation",
      ComAtprotoIdentityUpdateHandle: "com.atproto.identity.updateHandle",
      ComAtprotoLabelDefs: "com.atproto.label.defs",
      ComAtprotoLabelQueryLabels: "com.atproto.label.queryLabels",
      ComAtprotoLabelSubscribeLabels: "com.atproto.label.subscribeLabels",
      ComAtprotoLexiconSchema: "com.atproto.lexicon.schema",
      ComAtprotoModerationCreateReport: "com.atproto.moderation.createReport",
      ComAtprotoModerationDefs: "com.atproto.moderation.defs",
      ComAtprotoRepoApplyWrites: "com.atproto.repo.applyWrites",
      ComAtprotoRepoCreateRecord: "com.atproto.repo.createRecord",
      ComAtprotoRepoDefs: "com.atproto.repo.defs",
      ComAtprotoRepoDeleteRecord: "com.atproto.repo.deleteRecord",
      ComAtprotoRepoDescribeRepo: "com.atproto.repo.describeRepo",
      ComAtprotoRepoGetRecord: "com.atproto.repo.getRecord",
      ComAtprotoRepoImportRepo: "com.atproto.repo.importRepo",
      ComAtprotoRepoListMissingBlobs: "com.atproto.repo.listMissingBlobs",
      ComAtprotoRepoListRecords: "com.atproto.repo.listRecords",
      ComAtprotoRepoPutRecord: "com.atproto.repo.putRecord",
      ComAtprotoRepoStrongRef: "com.atproto.repo.strongRef",
      ComAtprotoRepoUploadBlob: "com.atproto.repo.uploadBlob",
      ComAtprotoServerActivateAccount: "com.atproto.server.activateAccount",
      ComAtprotoServerCheckAccountStatus: "com.atproto.server.checkAccountStatus",
      ComAtprotoServerConfirmEmail: "com.atproto.server.confirmEmail",
      ComAtprotoServerCreateAccount: "com.atproto.server.createAccount",
      ComAtprotoServerCreateAppPassword: "com.atproto.server.createAppPassword",
      ComAtprotoServerCreateInviteCode: "com.atproto.server.createInviteCode",
      ComAtprotoServerCreateInviteCodes: "com.atproto.server.createInviteCodes",
      ComAtprotoServerCreateSession: "com.atproto.server.createSession",
      ComAtprotoServerDeactivateAccount: "com.atproto.server.deactivateAccount",
      ComAtprotoServerDefs: "com.atproto.server.defs",
      ComAtprotoServerDeleteAccount: "com.atproto.server.deleteAccount",
      ComAtprotoServerDeleteSession: "com.atproto.server.deleteSession",
      ComAtprotoServerDescribeServer: "com.atproto.server.describeServer",
      ComAtprotoServerGetAccountInviteCodes: "com.atproto.server.getAccountInviteCodes",
      ComAtprotoServerGetServiceAuth: "com.atproto.server.getServiceAuth",
      ComAtprotoServerGetSession: "com.atproto.server.getSession",
      ComAtprotoServerListAppPasswords: "com.atproto.server.listAppPasswords",
      ComAtprotoServerRefreshSession: "com.atproto.server.refreshSession",
      ComAtprotoServerRequestAccountDelete: "com.atproto.server.requestAccountDelete",
      ComAtprotoServerRequestEmailConfirmation: "com.atproto.server.requestEmailConfirmation",
      ComAtprotoServerRequestEmailUpdate: "com.atproto.server.requestEmailUpdate",
      ComAtprotoServerRequestPasswordReset: "com.atproto.server.requestPasswordReset",
      ComAtprotoServerReserveSigningKey: "com.atproto.server.reserveSigningKey",
      ComAtprotoServerResetPassword: "com.atproto.server.resetPassword",
      ComAtprotoServerRevokeAppPassword: "com.atproto.server.revokeAppPassword",
      ComAtprotoServerUpdateEmail: "com.atproto.server.updateEmail",
      ComAtprotoSyncDefs: "com.atproto.sync.defs",
      ComAtprotoSyncGetBlob: "com.atproto.sync.getBlob",
      ComAtprotoSyncGetBlocks: "com.atproto.sync.getBlocks",
      ComAtprotoSyncGetCheckout: "com.atproto.sync.getCheckout",
      ComAtprotoSyncGetHead: "com.atproto.sync.getHead",
      ComAtprotoSyncGetHostStatus: "com.atproto.sync.getHostStatus",
      ComAtprotoSyncGetLatestCommit: "com.atproto.sync.getLatestCommit",
      ComAtprotoSyncGetRecord: "com.atproto.sync.getRecord",
      ComAtprotoSyncGetRepo: "com.atproto.sync.getRepo",
      ComAtprotoSyncGetRepoStatus: "com.atproto.sync.getRepoStatus",
      ComAtprotoSyncListBlobs: "com.atproto.sync.listBlobs",
      ComAtprotoSyncListHosts: "com.atproto.sync.listHosts",
      ComAtprotoSyncListRepos: "com.atproto.sync.listRepos",
      ComAtprotoSyncListReposByCollection: "com.atproto.sync.listReposByCollection",
      ComAtprotoSyncNotifyOfUpdate: "com.atproto.sync.notifyOfUpdate",
      ComAtprotoSyncRequestCrawl: "com.atproto.sync.requestCrawl",
      ComAtprotoSyncSubscribeRepos: "com.atproto.sync.subscribeRepos",
      ComAtprotoTempAddReservedHandle: "com.atproto.temp.addReservedHandle",
      ComAtprotoTempCheckHandleAvailability: "com.atproto.temp.checkHandleAvailability",
      ComAtprotoTempCheckSignupQueue: "com.atproto.temp.checkSignupQueue",
      ComAtprotoTempDereferenceScope: "com.atproto.temp.dereferenceScope",
      ComAtprotoTempFetchLabels: "com.atproto.temp.fetchLabels",
      ComAtprotoTempRequestPhoneVerification: "com.atproto.temp.requestPhoneVerification",
      ComAtprotoTempRevokeAccountCredentials: "com.atproto.temp.revokeAccountCredentials",
      ToolsOzoneCommunicationCreateTemplate: "tools.ozone.communication.createTemplate",
      ToolsOzoneCommunicationDefs: "tools.ozone.communication.defs",
      ToolsOzoneCommunicationDeleteTemplate: "tools.ozone.communication.deleteTemplate",
      ToolsOzoneCommunicationListTemplates: "tools.ozone.communication.listTemplates",
      ToolsOzoneCommunicationUpdateTemplate: "tools.ozone.communication.updateTemplate",
      ToolsOzoneHostingGetAccountHistory: "tools.ozone.hosting.getAccountHistory",
      ToolsOzoneModerationDefs: "tools.ozone.moderation.defs",
      ToolsOzoneModerationEmitEvent: "tools.ozone.moderation.emitEvent",
      ToolsOzoneModerationGetAccountTimeline: "tools.ozone.moderation.getAccountTimeline",
      ToolsOzoneModerationGetEvent: "tools.ozone.moderation.getEvent",
      ToolsOzoneModerationGetRecord: "tools.ozone.moderation.getRecord",
      ToolsOzoneModerationGetRecords: "tools.ozone.moderation.getRecords",
      ToolsOzoneModerationGetRepo: "tools.ozone.moderation.getRepo",
      ToolsOzoneModerationGetReporterStats: "tools.ozone.moderation.getReporterStats",
      ToolsOzoneModerationGetRepos: "tools.ozone.moderation.getRepos",
      ToolsOzoneModerationGetSubjects: "tools.ozone.moderation.getSubjects",
      ToolsOzoneModerationQueryEvents: "tools.ozone.moderation.queryEvents",
      ToolsOzoneModerationQueryStatuses: "tools.ozone.moderation.queryStatuses",
      ToolsOzoneModerationSearchRepos: "tools.ozone.moderation.searchRepos",
      ToolsOzoneReportDefs: "tools.ozone.report.defs",
      ToolsOzoneSafelinkAddRule: "tools.ozone.safelink.addRule",
      ToolsOzoneSafelinkDefs: "tools.ozone.safelink.defs",
      ToolsOzoneSafelinkQueryEvents: "tools.ozone.safelink.queryEvents",
      ToolsOzoneSafelinkQueryRules: "tools.ozone.safelink.queryRules",
      ToolsOzoneSafelinkRemoveRule: "tools.ozone.safelink.removeRule",
      ToolsOzoneSafelinkUpdateRule: "tools.ozone.safelink.updateRule",
      ToolsOzoneServerGetConfig: "tools.ozone.server.getConfig",
      ToolsOzoneSetAddValues: "tools.ozone.set.addValues",
      ToolsOzoneSetDefs: "tools.ozone.set.defs",
      ToolsOzoneSetDeleteSet: "tools.ozone.set.deleteSet",
      ToolsOzoneSetDeleteValues: "tools.ozone.set.deleteValues",
      ToolsOzoneSetGetValues: "tools.ozone.set.getValues",
      ToolsOzoneSetQuerySets: "tools.ozone.set.querySets",
      ToolsOzoneSetUpsertSet: "tools.ozone.set.upsertSet",
      ToolsOzoneSettingDefs: "tools.ozone.setting.defs",
      ToolsOzoneSettingListOptions: "tools.ozone.setting.listOptions",
      ToolsOzoneSettingRemoveOptions: "tools.ozone.setting.removeOptions",
      ToolsOzoneSettingUpsertOption: "tools.ozone.setting.upsertOption",
      ToolsOzoneSignatureDefs: "tools.ozone.signature.defs",
      ToolsOzoneSignatureFindCorrelation: "tools.ozone.signature.findCorrelation",
      ToolsOzoneSignatureFindRelatedAccounts: "tools.ozone.signature.findRelatedAccounts",
      ToolsOzoneSignatureSearchAccounts: "tools.ozone.signature.searchAccounts",
      ToolsOzoneTeamAddMember: "tools.ozone.team.addMember",
      ToolsOzoneTeamDefs: "tools.ozone.team.defs",
      ToolsOzoneTeamDeleteMember: "tools.ozone.team.deleteMember",
      ToolsOzoneTeamListMembers: "tools.ozone.team.listMembers",
      ToolsOzoneTeamUpdateMember: "tools.ozone.team.updateMember",
      ToolsOzoneVerificationDefs: "tools.ozone.verification.defs",
      ToolsOzoneVerificationGrantVerifications: "tools.ozone.verification.grantVerifications",
      ToolsOzoneVerificationListVerifications: "tools.ozone.verification.listVerifications",
      ToolsOzoneVerificationRevokeVerifications: "tools.ozone.verification.revokeVerifications"
    };
  }
});

// node_modules/@atproto/api/dist/types.js
var require_types4 = __commonJS({
  "node_modules/@atproto/api/dist/types.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/@atproto/api/dist/const.js
var require_const = __commonJS({
  "node_modules/@atproto/api/dist/const.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BSKY_LABELER_DID = void 0;
    exports.BSKY_LABELER_DID = "did:plc:ar7c4by46qjdydhdevvrndac";
  }
});

// node_modules/@atproto/api/dist/util.js
var require_util6 = __commonJS({
  "node_modules/@atproto/api/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.nuxSchema = exports.asDid = exports.isDid = void 0;
    exports.sanitizeMutedWordValue = sanitizeMutedWordValue;
    exports.savedFeedsToUriArrays = savedFeedsToUriArrays;
    exports.getSavedFeedType = getSavedFeedType;
    exports.validateSavedFeed = validateSavedFeed;
    exports.validateNux = validateNux;
    var zod_1 = require_zod();
    var syntax_1 = require_dist5();
    function sanitizeMutedWordValue(value) {
      return value.trim().replace(/^#(?!\ufe0f)/, "").replace(/[\r\n\u00AD\u2060\u200D\u200C\u200B]+/, "");
    }
    function savedFeedsToUriArrays(savedFeeds) {
      const pinned = [];
      const saved = [];
      for (const feed of savedFeeds) {
        if (feed.pinned) {
          pinned.push(feed.value);
          saved.push(feed.value);
        } else {
          saved.push(feed.value);
        }
      }
      return {
        pinned,
        saved
      };
    }
    function getSavedFeedType(uri) {
      const urip = new syntax_1.AtUri(uri);
      switch (urip.collection) {
        case "app.bsky.feed.generator":
          return "feed";
        case "app.bsky.graph.list":
          return "list";
        default:
          return "unknown";
      }
    }
    function validateSavedFeed(savedFeed) {
      if (!savedFeed.id) {
        throw new Error("Saved feed must have an `id` - use a TID");
      }
      if (["feed", "list"].includes(savedFeed.type)) {
        const uri = new syntax_1.AtUri(savedFeed.value);
        const isFeed = uri.collection === "app.bsky.feed.generator";
        const isList = uri.collection === "app.bsky.graph.list";
        if (savedFeed.type === "feed" && !isFeed) {
          throw new Error(`Saved feed of type 'feed' must be a feed, got ${uri.collection}`);
        }
        if (savedFeed.type === "list" && !isList) {
          throw new Error(`Saved feed of type 'list' must be a list, got ${uri.collection}`);
        }
      }
    }
    var isDid = (str) => typeof str === "string" && str.startsWith("did:") && str.includes(":", 4) && str.length > 8 && str.length <= 2048;
    exports.isDid = isDid;
    var asDid = (value) => {
      if ((0, exports.isDid)(value))
        return value;
      throw new TypeError(`Invalid DID: ${value}`);
    };
    exports.asDid = asDid;
    exports.nuxSchema = zod_1.z.object({
      id: zod_1.z.string().max(64),
      completed: zod_1.z.boolean(),
      data: zod_1.z.string().max(300).optional(),
      expiresAt: zod_1.z.string().datetime().optional()
    }).strict();
    function validateNux(nux) {
      exports.nuxSchema.parse(nux);
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/did.js
var require_did3 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/did.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidDidError = void 0;
    exports.ensureValidDid = ensureValidDid;
    exports.ensureValidDidRegex = ensureValidDidRegex;
    exports.isValidDid = isValidDid;
    function ensureValidDid(input) {
      if (!input.startsWith("did:")) {
        throw new InvalidDidError('DID requires "did:" prefix');
      }
      if (input.length > 2048) {
        throw new InvalidDidError("DID is too long (2048 chars max)");
      }
      if (input.endsWith(":") || input.endsWith("%")) {
        throw new InvalidDidError('DID can not end with ":" or "%"');
      }
      if (!/^[a-zA-Z0-9._:%-]*$/.test(input)) {
        throw new InvalidDidError("Disallowed characters in DID (ASCII letters, digits, and a couple other characters only)");
      }
      const { length: length2, 1: method } = input.split(":");
      if (length2 < 3) {
        throw new InvalidDidError("DID requires prefix, method, and method-specific content");
      }
      if (!/^[a-z]+$/.test(method)) {
        throw new InvalidDidError("DID method must be lower-case letters");
      }
    }
    var DID_REGEX = /^did:[a-z]+:[a-zA-Z0-9._:%-]*[a-zA-Z0-9._-]$/;
    function ensureValidDidRegex(input) {
      if (!DID_REGEX.test(input)) {
        throw new InvalidDidError("DID didn't validate via regex");
      }
      if (input.length > 2048) {
        throw new InvalidDidError("DID is too long (2048 chars max)");
      }
    }
    function isValidDid(input) {
      return input.length <= 2048 && DID_REGEX.test(input);
    }
    var InvalidDidError = class extends Error {
    };
    exports.InvalidDidError = InvalidDidError;
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/handle.js
var require_handle3 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/handle.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DisallowedDomainError = exports.UnsupportedDomainError = exports.ReservedHandleError = exports.InvalidHandleError = exports.DISALLOWED_TLDS = exports.INVALID_HANDLE = void 0;
    exports.ensureValidHandle = ensureValidHandle;
    exports.ensureValidHandleRegex = ensureValidHandleRegex;
    exports.normalizeHandle = normalizeHandle;
    exports.normalizeAndEnsureValidHandle = normalizeAndEnsureValidHandle;
    exports.isValidHandle = isValidHandle;
    exports.isValidTld = isValidTld;
    exports.INVALID_HANDLE = "handle.invalid";
    exports.DISALLOWED_TLDS = [
      ".local",
      ".arpa",
      ".invalid",
      ".localhost",
      ".internal",
      ".example",
      ".alt",
      // policy could concievably change on ".onion" some day
      ".onion"
      // NOTE: .test is allowed in testing and devopment. In practical terms
      // "should" "never" actually resolve and get registered in production
    ];
    function ensureValidHandle(input) {
      if (!/^[a-zA-Z0-9.-]*$/.test(input)) {
        throw new InvalidHandleError("Disallowed characters in handle (ASCII letters, digits, dashes, periods only)");
      }
      if (input.length > 253) {
        throw new InvalidHandleError("Handle is too long (253 chars max)");
      }
      const labels = input.split(".");
      if (labels.length < 2) {
        throw new InvalidHandleError("Handle domain needs at least two parts");
      }
      for (let i = 0; i < labels.length; i++) {
        const l = labels[i];
        if (l.length < 1) {
          throw new InvalidHandleError("Handle parts can not be empty");
        }
        if (l.length > 63) {
          throw new InvalidHandleError("Handle part too long (max 63 chars)");
        }
        if (l.endsWith("-") || l.startsWith("-")) {
          throw new InvalidHandleError("Handle parts can not start or end with hyphens");
        }
        if (i + 1 === labels.length && !/^[a-zA-Z]/.test(l)) {
          throw new InvalidHandleError("Handle final component (TLD) must start with ASCII letter");
        }
      }
    }
    var HANDLE_REGEX = /^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/;
    function ensureValidHandleRegex(input) {
      if (input.length > 253) {
        throw new InvalidHandleError("Handle is too long (253 chars max)");
      }
      if (!HANDLE_REGEX.test(input)) {
        throw new InvalidHandleError("Handle didn't validate via regex");
      }
    }
    function normalizeHandle(handle) {
      return handle.toLowerCase();
    }
    function normalizeAndEnsureValidHandle(handle) {
      const normalized = normalizeHandle(handle);
      ensureValidHandle(normalized);
      return normalized;
    }
    function isValidHandle(input) {
      return input.length <= 253 && HANDLE_REGEX.test(input);
    }
    function isValidTld(handle) {
      for (const tld of exports.DISALLOWED_TLDS) {
        if (handle.endsWith(tld)) {
          return false;
        }
      }
      return true;
    }
    var InvalidHandleError = class extends Error {
    };
    exports.InvalidHandleError = InvalidHandleError;
    var ReservedHandleError = class extends Error {
    };
    exports.ReservedHandleError = ReservedHandleError;
    var UnsupportedDomainError = class extends Error {
    };
    exports.UnsupportedDomainError = UnsupportedDomainError;
    var DisallowedDomainError = class extends Error {
    };
    exports.DisallowedDomainError = DisallowedDomainError;
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/at-identifier.js
var require_at_identifier3 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/at-identifier.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isHandleIdentifier = isHandleIdentifier;
    exports.isDidIdentifier = isDidIdentifier;
    exports.assertAtIdentifierString = assertAtIdentifierString;
    exports.ensureValidAtIdentifier = assertAtIdentifierString;
    exports.asAtIdentifierString = asAtIdentifierString;
    exports.isAtIdentifierString = isAtIdentifierString;
    exports.isValidAtIdentifier = isAtIdentifierString;
    exports.ifAtIdentifierString = ifAtIdentifierString;
    var did_js_1 = require_did3();
    var handle_js_1 = require_handle3();
    function isHandleIdentifier(id) {
      return !isDidIdentifier(id);
    }
    function isDidIdentifier(id) {
      return id.startsWith("did:");
    }
    function assertAtIdentifierString(input) {
      try {
        if (!input || typeof input !== "string") {
          throw new TypeError("Identifier must be a non-empty string");
        } else if (input.startsWith("did:")) {
          (0, did_js_1.ensureValidDidRegex)(input);
        } else {
          (0, handle_js_1.ensureValidHandleRegex)(input);
        }
      } catch (cause) {
        throw new handle_js_1.InvalidHandleError("Invalid DID or handle", { cause });
      }
    }
    function asAtIdentifierString(input) {
      assertAtIdentifierString(input);
      return input;
    }
    function isAtIdentifierString(input) {
      if (!input || typeof input !== "string") {
        return false;
      } else if (input.startsWith("did:")) {
        return (0, did_js_1.isValidDid)(input);
      } else {
        return (0, handle_js_1.isValidHandle)(input);
      }
    }
    function ifAtIdentifierString(input) {
      return isAtIdentifierString(input) ? input : void 0;
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/nsid.js
var require_nsid3 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/nsid.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidNsidError = exports.NSID = void 0;
    exports.ensureValidNsid = ensureValidNsid;
    exports.parseNsid = parseNsid;
    exports.isValidNsid = isValidNsid;
    exports.validateNsid = validateNsid;
    exports.ensureValidNsidRegex = ensureValidNsidRegex;
    exports.validateNsidRegex = validateNsidRegex;
    var NSID = class _NSID {
      segments;
      static parse(input) {
        return new _NSID(input);
      }
      static create(authority, name2) {
        const input = [...authority.split(".").reverse(), name2].join(".");
        return new _NSID(input);
      }
      static isValid(nsid) {
        return isValidNsid(nsid);
      }
      static from(input) {
        if (input instanceof _NSID) {
          return input;
        }
        if (Array.isArray(input)) {
          return new _NSID(input.join("."));
        }
        return new _NSID(String(input));
      }
      constructor(nsid) {
        this.segments = parseNsid(nsid);
      }
      get authority() {
        return this.segments.slice(0, this.segments.length - 1).reverse().join(".");
      }
      get name() {
        return this.segments.at(this.segments.length - 1);
      }
      toString() {
        return this.segments.join(".");
      }
    };
    exports.NSID = NSID;
    function ensureValidNsid(input) {
      const result = validateNsid(input);
      if (!result.success)
        throw new InvalidNsidError(result.message);
    }
    function parseNsid(nsid) {
      const result = validateNsid(nsid);
      if (!result.success)
        throw new InvalidNsidError(result.message);
      return result.value;
    }
    function isValidNsid(input) {
      return validateNsidRegex(input).success;
    }
    function validateNsid(input) {
      if (input.length > 253 + 1 + 63) {
        return {
          success: false,
          message: "NSID is too long (317 chars max)"
        };
      }
      if (hasDisallowedCharacters(input)) {
        return {
          success: false,
          message: "Disallowed characters in NSID (ASCII letters, digits, dashes, periods only)"
        };
      }
      const segments = input.split(".");
      if (segments.length < 3) {
        return {
          success: false,
          message: "NSID needs at least three parts"
        };
      }
      for (const l of segments) {
        if (l.length < 1) {
          return {
            success: false,
            message: "NSID parts can not be empty"
          };
        }
        if (l.length > 63) {
          return {
            success: false,
            message: "NSID part too long (max 63 chars)"
          };
        }
        if (startsWithHyphen(l) || endsWithHyphen(l)) {
          return {
            success: false,
            message: "NSID parts can not start or end with hyphen"
          };
        }
      }
      if (startsWithNumber(segments[0])) {
        return {
          success: false,
          message: "NSID first part may not start with a digit"
        };
      }
      if (!isValidIdentifier(segments[segments.length - 1])) {
        return {
          success: false,
          message: "NSID name part must be only letters and digits (and no leading digit)"
        };
      }
      return {
        success: true,
        value: segments
      };
    }
    function hasDisallowedCharacters(v) {
      return !/^[a-zA-Z0-9.-]*$/.test(v);
    }
    function startsWithNumber(v) {
      const charCode = v.charCodeAt(0);
      return charCode >= 48 && charCode <= 57;
    }
    function startsWithHyphen(v) {
      return v.charCodeAt(0) === 45;
    }
    function endsWithHyphen(v) {
      return v.charCodeAt(v.length - 1) === 45;
    }
    function isValidIdentifier(v) {
      return !startsWithNumber(v) && !v.includes("-");
    }
    function ensureValidNsidRegex(nsid) {
      const result = validateNsidRegex(nsid);
      if (!result.success)
        throw new InvalidNsidError(result.message);
    }
    function validateNsidRegex(value) {
      if (value.length > 253 + 1 + 63) {
        return {
          success: false,
          message: "NSID is too long (317 chars max)"
        };
      }
      if (
        // Fast check for small values
        value.length < 5 || !/^[a-zA-Z](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?:\.[a-zA-Z](?:[a-zA-Z0-9]{0,62})?)$/.test(value)
      ) {
        return {
          success: false,
          message: "NSID didn't validate via regex"
        };
      }
      return {
        success: true,
        value
      };
    }
    var InvalidNsidError = class extends Error {
    };
    exports.InvalidNsidError = InvalidNsidError;
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/recordkey.js
var require_recordkey3 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/recordkey.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidRecordKeyError = void 0;
    exports.ensureValidRecordKey = ensureValidRecordKey;
    exports.isValidRecordKey = isValidRecordKey;
    var RECORD_KEY_MAX_LENGTH = 512;
    var RECORD_KEY_MIN_LENGTH = 1;
    var RECORD_KEY_INVALID_VALUES = /* @__PURE__ */ new Set([".", ".."]);
    var RECORD_KEY_REGEX = /^[a-zA-Z0-9_~.:-]{1,512}$/;
    function ensureValidRecordKey(input) {
      if (input.length > RECORD_KEY_MAX_LENGTH || input.length < RECORD_KEY_MIN_LENGTH) {
        throw new InvalidRecordKeyError(`record key must be ${RECORD_KEY_MIN_LENGTH} to ${RECORD_KEY_MAX_LENGTH} characters`);
      }
      if (RECORD_KEY_INVALID_VALUES.has(input)) {
        throw new InvalidRecordKeyError('record key can not be "." or ".."');
      }
      if (!RECORD_KEY_REGEX.test(input)) {
        throw new InvalidRecordKeyError("record key syntax not valid (regex)");
      }
    }
    function isValidRecordKey(input) {
      return input.length >= RECORD_KEY_MIN_LENGTH && input.length <= RECORD_KEY_MAX_LENGTH && RECORD_KEY_REGEX.test(input) && !RECORD_KEY_INVALID_VALUES.has(input);
    }
    var InvalidRecordKeyError = class extends Error {
    };
    exports.InvalidRecordKeyError = InvalidRecordKeyError;
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/aturi_validation.js
var require_aturi_validation3 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/aturi_validation.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ensureValidAtUri = ensureValidAtUri;
    exports.ensureValidAtUriRegex = ensureValidAtUriRegex;
    exports.isValidAtUri = isValidAtUri;
    var at_identifier_js_1 = require_at_identifier3();
    var did_js_1 = require_did3();
    var handle_js_1 = require_handle3();
    var nsid_js_1 = require_nsid3();
    function ensureValidAtUri(input) {
      const fragmentIndex = input.indexOf("#");
      if (fragmentIndex !== -1) {
        if (input.charCodeAt(fragmentIndex + 1) !== 47) {
          throw new Error("ATURI fragment must be non-empty and start with slash");
        }
        if (input.includes("#", fragmentIndex + 1)) {
          throw new Error('ATURI can have at most one "#", separating fragment out');
        }
        const fragment = input.slice(fragmentIndex + 1);
        if (!/^\/[a-zA-Z0-9._~:@!$&')(*+,;=%[\]/-]*$/.test(fragment)) {
          throw new Error("Disallowed characters in ATURI fragment (ASCII)");
        }
      }
      const uri = fragmentIndex === -1 ? input : input.slice(0, fragmentIndex);
      if (uri.length > 8 * 1024) {
        throw new Error("ATURI is far too long");
      }
      if (!uri.startsWith("at://")) {
        throw new Error('ATURI must start with "at://"');
      }
      if (!/^[a-zA-Z0-9._~:@!$&')(*+,;=%/-]*$/.test(uri)) {
        throw new Error("Disallowed characters in ATURI (ASCII)");
      }
      const authorityEnd = uri.indexOf("/", 5);
      const authority = authorityEnd === -1 ? uri.slice(5) : uri.slice(5, authorityEnd);
      try {
        (0, at_identifier_js_1.ensureValidAtIdentifier)(authority);
      } catch (cause) {
        throw new Error("ATURI authority must be a valid handle or DID", { cause });
      }
      const collectionStart = authorityEnd === -1 ? -1 : authorityEnd + 1;
      const collectionEnd = collectionStart === -1 ? -1 : uri.indexOf("/", collectionStart);
      if (collectionStart !== -1) {
        const collection = collectionEnd === -1 ? uri.slice(collectionStart) : uri.slice(collectionStart, collectionEnd);
        if (collection.length === 0) {
          throw new Error("ATURI can not have a slash after authority without a path segment");
        }
        if (!(0, nsid_js_1.isValidNsid)(collection)) {
          throw new Error("ATURI requires first path segment (if supplied) to be valid NSID");
        }
      }
      const recordKeyStart = collectionEnd === -1 ? -1 : collectionEnd + 1;
      const recordKeyEnd = recordKeyStart === -1 ? -1 : uri.indexOf("/", recordKeyStart);
      if (recordKeyStart !== -1) {
        if (recordKeyStart === uri.length) {
          throw new Error("ATURI can not have a slash after collection, unless record key is provided");
        }
      }
      if (recordKeyEnd !== -1) {
        throw new Error("ATURI path can have at most two parts, and no trailing slash");
      }
    }
    function ensureValidAtUriRegex(input) {
      const aturiRegex = /^at:\/\/(?<authority>[a-zA-Z0-9._:%-]+)(\/(?<collection>[a-zA-Z0-9-.]+)(\/(?<rkey>[a-zA-Z0-9._~:@!$&%')(*+,;=-]+))?)?(#(?<fragment>\/[a-zA-Z0-9._~:@!$&%')(*+,;=\-[\]/\\]*))?$/;
      const rm = input.match(aturiRegex);
      if (!rm || !rm.groups) {
        throw new Error("ATURI didn't validate via regex");
      }
      const groups = rm.groups;
      try {
        (0, handle_js_1.ensureValidHandleRegex)(groups.authority);
      } catch {
        try {
          (0, did_js_1.ensureValidDidRegex)(groups.authority);
        } catch {
          throw new Error("ATURI authority must be a valid handle or DID");
        }
      }
      if (groups.collection && !(0, nsid_js_1.isValidNsid)(groups.collection)) {
        throw new Error("ATURI collection path segment must be a valid NSID");
      }
      if (input.length > 8 * 1024) {
        throw new Error("ATURI is far too long");
      }
    }
    function isValidAtUri(input) {
      try {
        ensureValidAtUri(input);
      } catch {
        return false;
      }
      return true;
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/aturi.js
var require_aturi3 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/aturi.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AtUri = exports.ATP_URI_REGEX = void 0;
    var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
    var at_identifier_js_1 = require_at_identifier3();
    var did_js_1 = require_did3();
    var nsid_js_1 = require_nsid3();
    var recordkey_js_1 = require_recordkey3();
    tslib_1.__exportStar(require_aturi_validation3(), exports);
    exports.ATP_URI_REGEX = // proto-    --did--------------   --name----------------   --path----   --query--   --hash--
    /^(at:\/\/)?((?:did:[a-z0-9:%-]+)|(?:[a-z0-9][a-z0-9.:-]*))(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
    var RELATIVE_REGEX = /^(\/[^?#\s]*)?(\?[^#\s]+)?(#[^\s]+)?$/i;
    var AtUri = class _AtUri {
      hash;
      host;
      pathname;
      searchParams;
      constructor(uri, base3) {
        const parsed = base3 !== void 0 ? typeof base3 === "string" ? Object.assign(parse2(base3), parseRelative(uri)) : Object.assign({ host: base3.host }, parseRelative(uri)) : parse2(uri);
        (0, at_identifier_js_1.ensureValidAtIdentifier)(parsed.host);
        this.hash = parsed.hash ?? "";
        this.host = parsed.host;
        this.pathname = parsed.pathname ?? "";
        this.searchParams = parsed.searchParams;
      }
      static make(handleOrDid, collection, rkey) {
        let str = handleOrDid;
        if (collection)
          str += "/" + collection;
        if (rkey)
          str += "/" + rkey;
        return new _AtUri(str);
      }
      get protocol() {
        return "at:";
      }
      get origin() {
        return `at://${this.host}`;
      }
      get did() {
        const { host } = this;
        if ((0, at_identifier_js_1.isDidIdentifier)(host))
          return host;
        throw new did_js_1.InvalidDidError(`AtUri "${this}" does not have a DID hostname`);
      }
      get hostname() {
        return this.host;
      }
      set hostname(v) {
        (0, at_identifier_js_1.ensureValidAtIdentifier)(v);
        this.host = v;
      }
      get search() {
        return this.searchParams.toString();
      }
      set search(v) {
        this.searchParams = new URLSearchParams(v);
      }
      get collection() {
        return this.pathname.split("/").filter(Boolean)[0] || "";
      }
      get collectionSafe() {
        const { collection } = this;
        (0, nsid_js_1.ensureValidNsid)(collection);
        return collection;
      }
      set collection(v) {
        (0, nsid_js_1.ensureValidNsid)(v);
        this.unsafelySetCollection(v);
      }
      unsafelySetCollection(v) {
        const parts = this.pathname.split("/").filter(Boolean);
        parts[0] = v;
        this.pathname = parts.join("/");
      }
      get rkey() {
        return this.pathname.split("/").filter(Boolean)[1] || "";
      }
      get rkeySafe() {
        const { rkey } = this;
        (0, recordkey_js_1.ensureValidRecordKey)(rkey);
        return rkey;
      }
      set rkey(v) {
        (0, recordkey_js_1.ensureValidRecordKey)(v);
        this.unsafelySetRkey(v);
      }
      unsafelySetRkey(v) {
        const parts = this.pathname.split("/").filter(Boolean);
        parts[0] ||= "undefined";
        parts[1] = v;
        this.pathname = parts.join("/");
      }
      get href() {
        return this.toString();
      }
      toString() {
        let path = this.pathname || "/";
        if (!path.startsWith("/")) {
          path = `/${path}`;
        }
        let qs = "";
        if (this.searchParams.size) {
          qs = `?${this.searchParams.toString()}`;
        }
        let hash = this.hash;
        if (hash && !hash.startsWith("#")) {
          hash = `#${hash}`;
        }
        return `at://${this.host}${path}${qs}${hash}`;
      }
    };
    exports.AtUri = AtUri;
    function parse2(str) {
      const match = str.match(exports.ATP_URI_REGEX);
      if (!match) {
        throw new Error(`Invalid AT uri: ${str}`);
      }
      return {
        host: match[2],
        hash: match[5],
        pathname: match[3],
        searchParams: new URLSearchParams(match[4])
      };
    }
    function parseRelative(str) {
      const match = str.match(RELATIVE_REGEX);
      if (!match) {
        throw new Error(`Invalid path: ${str}`);
      }
      return {
        hash: match[3],
        pathname: match[1],
        searchParams: new URLSearchParams(match[2])
      };
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/datetime.js
var require_datetime3 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/datetime.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidDatetimeError = void 0;
    exports.assertAtprotoDate = assertAtprotoDate;
    exports.asAtprotoDate = asAtprotoDate;
    exports.isAtprotoDate = isAtprotoDate;
    exports.ifAtprotoDate = ifAtprotoDate;
    exports.assertDatetimeString = assertDatetimeString;
    exports.ensureValidDatetime = assertDatetimeString;
    exports.asDatetimeString = asDatetimeString;
    exports.isDatetimeString = isDatetimeString;
    exports.isValidDatetime = isDatetimeString;
    exports.ifDatetimeString = ifDatetimeString;
    exports.currentDatetimeString = currentDatetimeString;
    exports.toDatetimeString = toDatetimeString;
    exports.normalizeDatetime = normalizeDatetime;
    exports.normalizeDatetimeAlways = normalizeDatetimeAlways;
    var InvalidDatetimeError = class extends Error {
    };
    exports.InvalidDatetimeError = InvalidDatetimeError;
    function assertAtprotoDate(date) {
      const res = parseDate(date);
      if (!res.success) {
        throw new InvalidDatetimeError(res.message);
      }
    }
    function asAtprotoDate(date) {
      assertAtprotoDate(date);
      return date;
    }
    function isAtprotoDate(date) {
      return parseDate(date).success;
    }
    function ifAtprotoDate(date) {
      return isAtprotoDate(date) ? date : void 0;
    }
    function assertDatetimeString(input) {
      const result = parseString(input);
      if (!result.success) {
        throw new InvalidDatetimeError(result.message);
      }
    }
    function asDatetimeString(input) {
      assertDatetimeString(input);
      return input;
    }
    function isDatetimeString(input) {
      return parseString(input).success;
    }
    function ifDatetimeString(input) {
      return isDatetimeString(input) ? input : void 0;
    }
    function currentDatetimeString() {
      return toDatetimeString(/* @__PURE__ */ new Date());
    }
    function toDatetimeString(date) {
      return asAtprotoDate(date).toISOString();
    }
    function normalizeDatetime(dtStr) {
      const date = new Date(dtStr);
      if (isAtprotoDate(date)) {
        return date.toISOString();
      }
      if (isNaN(date.getTime()) && !/.*(([+-]\d\d:?\d\d)|[a-zA-Z])$/.test(dtStr)) {
        const date2 = /* @__PURE__ */ new Date(`${dtStr}Z`);
        if (isAtprotoDate(date2)) {
          return date2.toISOString();
        }
      }
      throw new InvalidDatetimeError("datetime did not parse as any timestamp format");
    }
    function normalizeDatetimeAlways(dtStr) {
      try {
        return normalizeDatetime(dtStr);
      } catch (err) {
        return "1970-01-01T00:00:00.000Z";
      }
    }
    var failure = (m) => ({ success: false, message: m });
    var success = (v) => ({ success: true, value: v });
    var DATETIME_REGEX = /^(?<full_year>[0-9]{4})-(?<date_month>0[1-9]|1[012])-(?<date_mday>[0-2][0-9]|3[01])T(?<time_hour>[0-1][0-9]|2[0-3]):(?<time_minute>[0-5][0-9]):(?<time_second>[0-5][0-9]|60)(?<time_secfrac>\.[0-9]+)?(?<time_offset>Z|(?<time_numoffset>[+-](?:[0-1][0-9]|2[0-3]):[0-5][0-9]))$/;
    function parseString(input) {
      if (typeof input !== "string") {
        return failure("datetime must be a string");
      }
      if (input.length > 64) {
        return failure("datetime is too long (64 chars max)");
      }
      if (input.endsWith("-00:00")) {
        return failure('datetime can not use "-00:00" for UTC timezone');
      }
      if (!DATETIME_REGEX.test(input)) {
        return failure("datetime is not in a valid format (must match RFC 3339 & ISO 8601 with 'Z' or \xB1hh:mm timezone)");
      }
      const date = new Date(input);
      return parseDate(date);
    }
    function parseDate(date) {
      const fullYear = date.getUTCFullYear();
      if (Number.isNaN(fullYear)) {
        return failure("datetime did not parse as ISO 8601");
      }
      if (fullYear < 0) {
        return failure("datetime normalized to a negative time");
      }
      if (fullYear > 9999) {
        return failure("datetime year is too far in the future");
      }
      return success(date);
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/language.js
var require_language3 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/language.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.parseLanguageString = parseLanguageString;
    exports.isValidLanguage = isValidLanguage;
    var BCP47_REGEXP = /^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUseA>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUseB>x(-[A-Za-z0-9]{1,8})+))$/;
    function parseLanguageString(input) {
      const parsed = input.match(BCP47_REGEXP);
      if (!parsed?.groups)
        return null;
      const { groups } = parsed;
      return {
        grandfathered: groups.grandfathered,
        language: groups.language,
        extlang: groups.extlang,
        script: groups.script,
        region: groups.region,
        variant: groups.variant,
        extension: groups.extension,
        privateUse: groups.privateUseA || groups.privateUseB
      };
    }
    function isValidLanguage(input) {
      return BCP47_REGEXP.test(input);
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/tid.js
var require_tid4 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/tid.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidTidError = void 0;
    exports.ensureValidTid = ensureValidTid;
    exports.isValidTid = isValidTid;
    var TID_LENGTH = 13;
    var TID_REGEX = /^[234567abcdefghij][234567abcdefghijklmnopqrstuvwxyz]{12}$/;
    function ensureValidTid(input) {
      if (input.length !== TID_LENGTH) {
        throw new InvalidTidError(`TID must be ${TID_LENGTH} characters`);
      }
      if (!TID_REGEX.test(input)) {
        throw new InvalidTidError("TID syntax not valid (regex)");
      }
    }
    function isValidTid(input) {
      return input.length === TID_LENGTH && TID_REGEX.test(input);
    }
    var InvalidTidError = class extends Error {
    };
    exports.InvalidTidError = InvalidTidError;
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/uri.js
var require_uri3 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/uri.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isValidUri = isValidUri;
    function isValidUri(input) {
      return /^\w+:(?:\/\/)?[^\s/][^\s]*$/.test(input);
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/index.js
var require_dist8 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/syntax/dist/index.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
    tslib_1.__exportStar(require_at_identifier3(), exports);
    tslib_1.__exportStar(require_aturi3(), exports);
    tslib_1.__exportStar(require_datetime3(), exports);
    tslib_1.__exportStar(require_did3(), exports);
    tslib_1.__exportStar(require_handle3(), exports);
    tslib_1.__exportStar(require_nsid3(), exports);
    tslib_1.__exportStar(require_language3(), exports);
    tslib_1.__exportStar(require_recordkey3(), exports);
    tslib_1.__exportStar(require_tid4(), exports);
    tslib_1.__exportStar(require_uri3(), exports);
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/util.js
var require_util7 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toLexUri = toLexUri;
    exports.requiredPropertiesRefinement = requiredPropertiesRefinement;
    var zod_1 = require_zod();
    function toLexUri(str, baseUri) {
      if (str.split("#").length > 2) {
        throw new Error("Uri can only have one hash segment");
      }
      if (str.startsWith("lex:")) {
        return str;
      }
      if (str.startsWith("#")) {
        if (!baseUri) {
          throw new Error(`Unable to resolve uri without anchor: ${str}`);
        }
        return `${baseUri}${str}`;
      }
      return `lex:${str}`;
    }
    function requiredPropertiesRefinement(object, ctx) {
      if (object.required === void 0) {
        return;
      }
      if (!Array.isArray(object.required)) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.invalid_type,
          received: typeof object.required,
          expected: "array"
        });
        return;
      }
      if (object.properties === void 0) {
        if (object.required.length > 0) {
          ctx.addIssue({
            code: zod_1.z.ZodIssueCode.custom,
            message: `Required fields defined but no properties defined`
          });
        }
        return;
      }
      for (const field of object.required) {
        if (object.properties[field] === void 0) {
          ctx.addIssue({
            code: zod_1.z.ZodIssueCode.custom,
            message: `Required field "${field}" not defined`
          });
        }
      }
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/types.js
var require_types5 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/types.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.LexiconDefNotFoundError = exports.InvalidLexiconError = exports.ValidationError = exports.lexiconDoc = exports.lexUserType = exports.lexRecord = exports.lexXrpcSubscription = exports.lexXrpcProcedure = exports.lexXrpcQuery = exports.lexXrpcError = exports.lexXrpcBody = exports.lexXrpcParameters = exports.lexPermissionSet = exports.lexObject = exports.lexToken = exports.lexPrimitiveArray = exports.lexArray = exports.lexBlob = exports.lexRefVariant = exports.lexRefUnion = exports.lexRef = exports.lexIpldType = exports.lexCidLink = exports.lexBytes = exports.lexPrimitive = exports.lexUnknown = exports.lexString = exports.lexStringFormat = exports.lexInteger = exports.lexBoolean = exports.lexLang = exports.languageSchema = void 0;
    exports.isValidLexiconDoc = isValidLexiconDoc;
    exports.isObj = isObj;
    exports.isDiscriminatedObject = isDiscriminatedObject;
    exports.parseLexiconDoc = parseLexiconDoc;
    var zod_1 = require_zod();
    var common_web_1 = require_dist4();
    var syntax_1 = require_dist8();
    var util_1 = require_util7();
    exports.languageSchema = zod_1.z.string().refine(common_web_1.validateLanguage, "Invalid BCP47 language tag");
    exports.lexLang = zod_1.z.record(exports.languageSchema, zod_1.z.string().optional());
    exports.lexBoolean = zod_1.z.object({
      type: zod_1.z.literal("boolean"),
      description: zod_1.z.string().optional(),
      default: zod_1.z.boolean().optional(),
      const: zod_1.z.boolean().optional()
    });
    exports.lexInteger = zod_1.z.object({
      type: zod_1.z.literal("integer"),
      description: zod_1.z.string().optional(),
      default: zod_1.z.number().int().optional(),
      minimum: zod_1.z.number().int().optional(),
      maximum: zod_1.z.number().int().optional(),
      enum: zod_1.z.number().int().array().optional(),
      const: zod_1.z.number().int().optional()
    });
    exports.lexStringFormat = zod_1.z.enum([
      "datetime",
      "uri",
      "at-uri",
      "did",
      "handle",
      "at-identifier",
      "nsid",
      "cid",
      "language",
      "tid",
      "record-key"
    ]);
    exports.lexString = zod_1.z.object({
      type: zod_1.z.literal("string"),
      format: exports.lexStringFormat.optional(),
      description: zod_1.z.string().optional(),
      default: zod_1.z.string().optional(),
      minLength: zod_1.z.number().int().optional(),
      maxLength: zod_1.z.number().int().optional(),
      minGraphemes: zod_1.z.number().int().optional(),
      maxGraphemes: zod_1.z.number().int().optional(),
      enum: zod_1.z.string().array().optional(),
      const: zod_1.z.string().optional(),
      knownValues: zod_1.z.string().array().optional()
    });
    exports.lexUnknown = zod_1.z.object({
      type: zod_1.z.literal("unknown"),
      description: zod_1.z.string().optional()
    });
    exports.lexPrimitive = zod_1.z.discriminatedUnion("type", [
      exports.lexBoolean,
      exports.lexInteger,
      exports.lexString,
      exports.lexUnknown
    ]);
    exports.lexBytes = zod_1.z.object({
      type: zod_1.z.literal("bytes"),
      description: zod_1.z.string().optional(),
      maxLength: zod_1.z.number().optional(),
      minLength: zod_1.z.number().optional()
    });
    exports.lexCidLink = zod_1.z.object({
      type: zod_1.z.literal("cid-link"),
      description: zod_1.z.string().optional()
    });
    exports.lexIpldType = zod_1.z.discriminatedUnion("type", [exports.lexBytes, exports.lexCidLink]);
    exports.lexRef = zod_1.z.object({
      type: zod_1.z.literal("ref"),
      description: zod_1.z.string().optional(),
      ref: zod_1.z.string()
    });
    exports.lexRefUnion = zod_1.z.object({
      type: zod_1.z.literal("union"),
      description: zod_1.z.string().optional(),
      refs: zod_1.z.string().array(),
      closed: zod_1.z.boolean().optional()
    });
    exports.lexRefVariant = zod_1.z.discriminatedUnion("type", [exports.lexRef, exports.lexRefUnion]);
    exports.lexBlob = zod_1.z.object({
      type: zod_1.z.literal("blob"),
      description: zod_1.z.string().optional(),
      accept: zod_1.z.string().array().optional(),
      maxSize: zod_1.z.number().optional()
    });
    exports.lexArray = zod_1.z.object({
      type: zod_1.z.literal("array"),
      description: zod_1.z.string().optional(),
      items: zod_1.z.discriminatedUnion("type", [
        // lexPrimitive
        exports.lexBoolean,
        exports.lexInteger,
        exports.lexString,
        exports.lexUnknown,
        // lexIpldType
        exports.lexBytes,
        exports.lexCidLink,
        // lexRefVariant
        exports.lexRef,
        exports.lexRefUnion,
        // other
        exports.lexBlob
      ]),
      minLength: zod_1.z.number().int().optional(),
      maxLength: zod_1.z.number().int().optional()
    });
    exports.lexPrimitiveArray = exports.lexArray.merge(zod_1.z.object({
      items: exports.lexPrimitive
    }));
    exports.lexToken = zod_1.z.object({
      type: zod_1.z.literal("token"),
      description: zod_1.z.string().optional()
    });
    exports.lexObject = zod_1.z.object({
      type: zod_1.z.literal("object"),
      description: zod_1.z.string().optional(),
      required: zod_1.z.string().array().optional(),
      nullable: zod_1.z.string().array().optional(),
      properties: zod_1.z.record(zod_1.z.string(), zod_1.z.discriminatedUnion("type", [
        exports.lexArray,
        // lexPrimitive
        exports.lexBoolean,
        exports.lexInteger,
        exports.lexString,
        exports.lexUnknown,
        // lexIpldType
        exports.lexBytes,
        exports.lexCidLink,
        // lexRefVariant
        exports.lexRef,
        exports.lexRefUnion,
        // other
        exports.lexBlob
      ]))
    }).superRefine(util_1.requiredPropertiesRefinement);
    var lexPermission = zod_1.z.intersection(zod_1.z.object({
      type: zod_1.z.literal("permission"),
      resource: zod_1.z.string().nonempty()
    }), zod_1.z.record(zod_1.z.string(), zod_1.z.union([
      zod_1.z.array(zod_1.z.union([zod_1.z.string(), zod_1.z.number().int(), zod_1.z.boolean()])),
      zod_1.z.boolean(),
      zod_1.z.number().int(),
      zod_1.z.string()
    ]).optional()));
    exports.lexPermissionSet = zod_1.z.object({
      type: zod_1.z.literal("permission-set"),
      description: zod_1.z.string().optional(),
      title: zod_1.z.string().optional(),
      "title:lang": exports.lexLang.optional(),
      detail: zod_1.z.string().optional(),
      "detail:lang": exports.lexLang.optional(),
      permissions: zod_1.z.array(lexPermission)
    });
    exports.lexXrpcParameters = zod_1.z.object({
      type: zod_1.z.literal("params"),
      description: zod_1.z.string().optional(),
      required: zod_1.z.string().array().optional(),
      properties: zod_1.z.record(zod_1.z.string(), zod_1.z.discriminatedUnion("type", [
        exports.lexPrimitiveArray,
        // lexPrimitive
        exports.lexBoolean,
        exports.lexInteger,
        exports.lexString,
        exports.lexUnknown
      ]))
    }).superRefine(util_1.requiredPropertiesRefinement);
    exports.lexXrpcBody = zod_1.z.object({
      description: zod_1.z.string().optional(),
      encoding: zod_1.z.string(),
      // @NOTE using discriminatedUnion with a refined schema requires zod >= 4
      schema: zod_1.z.union([exports.lexRefVariant, exports.lexObject]).optional()
    });
    exports.lexXrpcError = zod_1.z.object({
      name: zod_1.z.string(),
      description: zod_1.z.string().optional()
    });
    exports.lexXrpcQuery = zod_1.z.object({
      type: zod_1.z.literal("query"),
      description: zod_1.z.string().optional(),
      parameters: exports.lexXrpcParameters.optional(),
      output: exports.lexXrpcBody.optional(),
      errors: exports.lexXrpcError.array().optional()
    });
    exports.lexXrpcProcedure = zod_1.z.object({
      type: zod_1.z.literal("procedure"),
      description: zod_1.z.string().optional(),
      parameters: exports.lexXrpcParameters.optional(),
      input: exports.lexXrpcBody.optional(),
      output: exports.lexXrpcBody.optional(),
      errors: exports.lexXrpcError.array().optional()
    });
    exports.lexXrpcSubscription = zod_1.z.object({
      type: zod_1.z.literal("subscription"),
      description: zod_1.z.string().optional(),
      parameters: exports.lexXrpcParameters.optional(),
      message: zod_1.z.object({
        description: zod_1.z.string().optional(),
        schema: exports.lexRefUnion
      }),
      errors: exports.lexXrpcError.array().optional()
    });
    exports.lexRecord = zod_1.z.object({
      type: zod_1.z.literal("record"),
      description: zod_1.z.string().optional(),
      key: zod_1.z.string().optional(),
      record: exports.lexObject
    });
    exports.lexUserType = zod_1.z.custom((val) => {
      if (!val || typeof val !== "object") {
        return;
      }
      if (val["type"] === void 0) {
        return;
      }
      switch (val["type"]) {
        case "record":
          return exports.lexRecord.parse(val);
        case "permission-set":
          return exports.lexPermissionSet.parse(val);
        case "query":
          return exports.lexXrpcQuery.parse(val);
        case "procedure":
          return exports.lexXrpcProcedure.parse(val);
        case "subscription":
          return exports.lexXrpcSubscription.parse(val);
        case "blob":
          return exports.lexBlob.parse(val);
        case "array":
          return exports.lexArray.parse(val);
        case "token":
          return exports.lexToken.parse(val);
        case "object":
          return exports.lexObject.parse(val);
        case "boolean":
          return exports.lexBoolean.parse(val);
        case "integer":
          return exports.lexInteger.parse(val);
        case "string":
          return exports.lexString.parse(val);
        case "bytes":
          return exports.lexBytes.parse(val);
        case "cid-link":
          return exports.lexCidLink.parse(val);
        case "unknown":
          return exports.lexUnknown.parse(val);
      }
    }, (val) => {
      if (!val || typeof val !== "object") {
        return {
          message: "Must be an object",
          fatal: true
        };
      }
      if (val["type"] === void 0) {
        return {
          message: "Must have a type",
          fatal: true
        };
      }
      if (typeof val["type"] !== "string") {
        return {
          message: "Type property must be a string",
          fatal: true
        };
      }
      return {
        message: `Invalid type: ${val["type"]} must be one of: record, query, procedure, subscription, blob, array, token, object, boolean, integer, string, bytes, cid-link, unknown`,
        fatal: true
      };
    });
    exports.lexiconDoc = zod_1.z.object({
      lexicon: zod_1.z.literal(1),
      id: zod_1.z.string().refine(syntax_1.isValidNsid, {
        message: "Must be a valid NSID"
      }),
      revision: zod_1.z.number().optional(),
      description: zod_1.z.string().optional(),
      defs: zod_1.z.record(zod_1.z.string(), exports.lexUserType)
    }).refine((doc) => {
      for (const [defId, def] of Object.entries(doc.defs)) {
        if (defId !== "main" && (def.type === "record" || def.type === "permission-set" || def.type === "procedure" || def.type === "query" || def.type === "subscription")) {
          return false;
        }
      }
      return true;
    }, {
      message: `Records, permission sets, procedures, queries, and subscriptions must be the main definition.`
    });
    function isValidLexiconDoc(v) {
      return exports.lexiconDoc.safeParse(v).success;
    }
    function isObj(v) {
      return v != null && typeof v === "object";
    }
    function isDiscriminatedObject(v) {
      return isObj(v) && "$type" in v && typeof v.$type === "string";
    }
    function parseLexiconDoc(v) {
      exports.lexiconDoc.parse(v);
      return v;
    }
    var ValidationError = class extends Error {
    };
    exports.ValidationError = ValidationError;
    var InvalidLexiconError = class extends Error {
    };
    exports.InvalidLexiconError = InvalidLexiconError;
    var LexiconDefNotFoundError = class extends Error {
    };
    exports.LexiconDefNotFoundError = LexiconDefNotFoundError;
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/blob-refs.js
var require_blob_refs2 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/blob-refs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BlobRef = exports.jsonBlobRef = exports.untypedJsonBlobRef = exports.typedJsonBlobRef = void 0;
    var cid_1 = (init_cid(), __toCommonJS(cid_exports));
    var zod_1 = require_zod();
    var common_web_1 = require_dist4();
    exports.typedJsonBlobRef = zod_1.z.object({
      $type: zod_1.z.literal("blob"),
      ref: common_web_1.schema.cid,
      mimeType: zod_1.z.string(),
      size: zod_1.z.number()
    }).strict();
    exports.untypedJsonBlobRef = zod_1.z.object({
      cid: zod_1.z.string(),
      mimeType: zod_1.z.string()
    }).strict();
    exports.jsonBlobRef = zod_1.z.union([exports.typedJsonBlobRef, exports.untypedJsonBlobRef]);
    var BlobRef = class _BlobRef {
      constructor(ref, mimeType, size, original) {
        Object.defineProperty(this, "ref", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: ref
        });
        Object.defineProperty(this, "mimeType", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: mimeType
        });
        Object.defineProperty(this, "size", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: size
        });
        Object.defineProperty(this, "original", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.original = original ?? {
          $type: "blob",
          ref,
          mimeType,
          size
        };
      }
      static asBlobRef(obj) {
        if (common_web_1.check.is(obj, exports.jsonBlobRef)) {
          return _BlobRef.fromJsonRef(obj);
        }
        return null;
      }
      static fromJsonRef(json) {
        if (common_web_1.check.is(json, exports.typedJsonBlobRef)) {
          return new _BlobRef(json.ref, json.mimeType, json.size);
        } else {
          return new _BlobRef(cid_1.CID.parse(json.cid), json.mimeType, -1, json);
        }
      }
      ipld() {
        return this.original;
      }
      toJSON() {
        return (0, common_web_1.ipldToJson)(this.ipld());
      }
    };
    exports.BlobRef = BlobRef;
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validators/blob.js
var require_blob4 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validators/blob.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.blob = blob;
    var blob_refs_1 = require_blob_refs2();
    var types_1 = require_types5();
    function blob(lexicons, path, def, value) {
      if (!value || !(value instanceof blob_refs_1.BlobRef)) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} should be a blob ref`)
        };
      }
      return { success: true, value };
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validators/formats.js
var require_formats2 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validators/formats.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.datetime = datetime;
    exports.uri = uri;
    exports.atUri = atUri;
    exports.did = did;
    exports.handle = handle;
    exports.atIdentifier = atIdentifier;
    exports.nsid = nsid;
    exports.cid = cid;
    exports.language = language;
    exports.tid = tid;
    exports.recordKey = recordKey;
    var iso_datestring_validator_1 = require_dist6();
    var cid_1 = (init_cid(), __toCommonJS(cid_exports));
    var common_web_1 = require_dist4();
    var syntax_1 = require_dist8();
    var types_1 = require_types5();
    function datetime(path, value) {
      try {
        if (!(0, iso_datestring_validator_1.isValidISODateString)(value)) {
          throw new Error();
        }
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an valid atproto datetime (both RFC-3339 and ISO-8601)`)
        };
      }
      return { success: true, value };
    }
    function uri(path, value) {
      if (!(0, syntax_1.isValidUri)(value)) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a uri`)
        };
      }
      return { success: true, value };
    }
    function atUri(path, value) {
      try {
        (0, syntax_1.ensureValidAtUri)(value);
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a valid at-uri`)
        };
      }
      return { success: true, value };
    }
    function did(path, value) {
      try {
        (0, syntax_1.ensureValidDid)(value);
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a valid did`)
        };
      }
      return { success: true, value };
    }
    function handle(path, value) {
      try {
        (0, syntax_1.ensureValidHandle)(value);
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a valid handle`)
        };
      }
      return { success: true, value };
    }
    function atIdentifier(path, value) {
      if (value.startsWith("did:")) {
        const didResult = did(path, value);
        if (didResult.success)
          return didResult;
      } else {
        const handleResult = handle(path, value);
        if (handleResult.success)
          return handleResult;
      }
      return {
        success: false,
        error: new types_1.ValidationError(`${path} must be a valid did or a handle`)
      };
    }
    function nsid(path, value) {
      if ((0, syntax_1.isValidNsid)(value)) {
        return {
          success: true,
          value
        };
      } else {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a valid nsid`)
        };
      }
    }
    function cid(path, value) {
      try {
        cid_1.CID.parse(value);
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a cid string`)
        };
      }
      return { success: true, value };
    }
    function language(path, value) {
      if ((0, common_web_1.validateLanguage)(value)) {
        return { success: true, value };
      }
      return {
        success: false,
        error: new types_1.ValidationError(`${path} must be a well-formed BCP 47 language tag`)
      };
    }
    function tid(path, value) {
      if ((0, syntax_1.isValidTid)(value)) {
        return { success: true, value };
      }
      return {
        success: false,
        error: new types_1.ValidationError(`${path} must be a valid TID`)
      };
    }
    function recordKey(path, value) {
      try {
        (0, syntax_1.ensureValidRecordKey)(value);
      } catch {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a valid Record Key`)
        };
      }
      return { success: true, value };
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validators/primitives.js
var require_primitives2 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validators/primitives.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __setModuleDefault2 = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    } : function(o, v) {
      o["default"] = v;
    });
    var __importStar2 = exports && exports.__importStar || /* @__PURE__ */ function() {
      var ownKeys2 = function(o) {
        ownKeys2 = 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 ownKeys2(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]);
        }
        __setModuleDefault2(result, mod);
        return result;
      };
    }();
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.validate = validate;
    var cid_1 = (init_cid(), __toCommonJS(cid_exports));
    var common_web_1 = require_dist4();
    var types_1 = require_types5();
    var formats = __importStar2(require_formats2());
    function validate(lexicons, path, def, value) {
      switch (def.type) {
        case "boolean":
          return boolean(lexicons, path, def, value);
        case "integer":
          return integer(lexicons, path, def, value);
        case "string":
          return string2(lexicons, path, def, value);
        case "bytes":
          return bytes(lexicons, path, def, value);
        case "cid-link":
          return cidLink(lexicons, path, def, value);
        case "unknown":
          return unknown(lexicons, path, def, value);
        default:
          return {
            success: false,
            error: new types_1.ValidationError(`Unexpected lexicon type: ${def.type}`)
          };
      }
    }
    function boolean(lexicons, path, def, value) {
      def = def;
      const type = typeof value;
      if (type === "undefined") {
        if (typeof def.default === "boolean") {
          return { success: true, value: def.default };
        }
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a boolean`)
        };
      } else if (type !== "boolean") {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a boolean`)
        };
      }
      if (typeof def.const === "boolean") {
        if (value !== def.const) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be ${def.const}`)
          };
        }
      }
      return { success: true, value };
    }
    function integer(lexicons, path, def, value) {
      def = def;
      const type = typeof value;
      if (type === "undefined") {
        if (typeof def.default === "number") {
          return { success: true, value: def.default };
        }
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an integer`)
        };
      } else if (!Number.isInteger(value)) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an integer`)
        };
      }
      if (typeof def.const === "number") {
        if (value !== def.const) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be ${def.const}`)
          };
        }
      }
      if (Array.isArray(def.enum)) {
        if (!def.enum.includes(value)) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be one of (${def.enum.join("|")})`)
          };
        }
      }
      if (typeof def.maximum === "number") {
        if (value > def.maximum) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} can not be greater than ${def.maximum}`)
          };
        }
      }
      if (typeof def.minimum === "number") {
        if (value < def.minimum) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} can not be less than ${def.minimum}`)
          };
        }
      }
      return { success: true, value };
    }
    function string2(lexicons, path, def, value) {
      def = def;
      if (typeof value === "undefined") {
        if (typeof def.default === "string") {
          return { success: true, value: def.default };
        }
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a string`)
        };
      } else if (typeof value !== "string") {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a string`)
        };
      }
      if (typeof def.const === "string") {
        if (value !== def.const) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be ${def.const}`)
          };
        }
      }
      if (Array.isArray(def.enum)) {
        if (!def.enum.includes(value)) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be one of (${def.enum.join("|")})`)
          };
        }
      }
      if (typeof def.minLength === "number" || typeof def.maxLength === "number") {
        if (typeof def.minLength === "number" && value.length * 3 < def.minLength) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must not be shorter than ${def.minLength} characters`)
          };
        }
        let canSkipUtf8LenChecks = false;
        if (typeof def.minLength === "undefined" && typeof def.maxLength === "number" && value.length * 3 <= def.maxLength) {
          canSkipUtf8LenChecks = true;
        }
        if (!canSkipUtf8LenChecks) {
          const len = (0, common_web_1.utf8Len)(value);
          if (typeof def.maxLength === "number") {
            if (len > def.maxLength) {
              return {
                success: false,
                error: new types_1.ValidationError(`${path} must not be longer than ${def.maxLength} characters`)
              };
            }
          }
          if (typeof def.minLength === "number") {
            if (len < def.minLength) {
              return {
                success: false,
                error: new types_1.ValidationError(`${path} must not be shorter than ${def.minLength} characters`)
              };
            }
          }
        }
      }
      if (typeof def.maxGraphemes === "number" || typeof def.minGraphemes === "number") {
        let needsMaxGraphemesCheck = false;
        let needsMinGraphemesCheck = false;
        if (typeof def.maxGraphemes === "number") {
          if (value.length <= def.maxGraphemes) {
            needsMaxGraphemesCheck = false;
          } else {
            needsMaxGraphemesCheck = true;
          }
        }
        if (typeof def.minGraphemes === "number") {
          if (value.length < def.minGraphemes) {
            return {
              success: false,
              error: new types_1.ValidationError(`${path} must not be shorter than ${def.minGraphemes} graphemes`)
            };
          } else {
            needsMinGraphemesCheck = true;
          }
        }
        if (needsMaxGraphemesCheck || needsMinGraphemesCheck) {
          const len = (0, common_web_1.graphemeLen)(value);
          if (typeof def.maxGraphemes === "number") {
            if (len > def.maxGraphemes) {
              return {
                success: false,
                error: new types_1.ValidationError(`${path} must not be longer than ${def.maxGraphemes} graphemes`)
              };
            }
          }
          if (typeof def.minGraphemes === "number") {
            if (len < def.minGraphemes) {
              return {
                success: false,
                error: new types_1.ValidationError(`${path} must not be shorter than ${def.minGraphemes} graphemes`)
              };
            }
          }
        }
      }
      if (typeof def.format === "string") {
        switch (def.format) {
          case "datetime":
            return formats.datetime(path, value);
          case "uri":
            return formats.uri(path, value);
          case "at-uri":
            return formats.atUri(path, value);
          case "did":
            return formats.did(path, value);
          case "handle":
            return formats.handle(path, value);
          case "at-identifier":
            return formats.atIdentifier(path, value);
          case "nsid":
            return formats.nsid(path, value);
          case "cid":
            return formats.cid(path, value);
          case "language":
            return formats.language(path, value);
          case "tid":
            return formats.tid(path, value);
          case "record-key":
            return formats.recordKey(path, value);
        }
      }
      return { success: true, value };
    }
    function bytes(lexicons, path, def, value) {
      def = def;
      if (!value || !(value instanceof Uint8Array)) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a byte array`)
        };
      }
      if (typeof def.maxLength === "number") {
        if (value.byteLength > def.maxLength) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must not be larger than ${def.maxLength} bytes`)
          };
        }
      }
      if (typeof def.minLength === "number") {
        if (value.byteLength < def.minLength) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must not be smaller than ${def.minLength} bytes`)
          };
        }
      }
      return { success: true, value };
    }
    function cidLink(lexicons, path, def, value) {
      if (cid_1.CID.asCID(value) === null) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be a CID`)
        };
      }
      return { success: true, value };
    }
    function unknown(lexicons, path, def, value) {
      if (!value || typeof value !== "object") {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an object`)
        };
      }
      return { success: true, value };
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validators/complex.js
var require_complex2 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validators/complex.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.validate = validate;
    exports.array = array;
    exports.object = object;
    exports.validateOneOf = validateOneOf;
    var types_1 = require_types5();
    var util_1 = require_util7();
    var blob_1 = require_blob4();
    var primitives_1 = require_primitives2();
    function validate(lexicons, path, def, value) {
      switch (def.type) {
        case "object":
          return object(lexicons, path, def, value);
        case "array":
          return array(lexicons, path, def, value);
        case "blob":
          return (0, blob_1.blob)(lexicons, path, def, value);
        default:
          return (0, primitives_1.validate)(lexicons, path, def, value);
      }
    }
    function array(lexicons, path, def, value) {
      if (!Array.isArray(value)) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an array`)
        };
      }
      if (typeof def.maxLength === "number") {
        if (value.length > def.maxLength) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must not have more than ${def.maxLength} elements`)
          };
        }
      }
      if (typeof def.minLength === "number") {
        if (value.length < def.minLength) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must not have fewer than ${def.minLength} elements`)
          };
        }
      }
      const itemsDef = def.items;
      for (let i = 0; i < value.length; i++) {
        const itemValue = value[i];
        const itemPath = `${path}/${i}`;
        const res = validateOneOf(lexicons, itemPath, itemsDef, itemValue);
        if (!res.success) {
          return res;
        }
      }
      return { success: true, value };
    }
    function object(lexicons, path, def, value) {
      if (!(0, types_1.isObj)(value)) {
        return {
          success: false,
          error: new types_1.ValidationError(`${path} must be an object`)
        };
      }
      let resultValue = value;
      if ("properties" in def && def.properties != null) {
        for (const key in def.properties) {
          const keyValue = value[key];
          if (keyValue === null && def.nullable?.includes(key)) {
            continue;
          }
          const propDef = def.properties[key];
          if (keyValue === void 0 && !def.required?.includes(key)) {
            if (propDef.type === "integer" || propDef.type === "boolean" || propDef.type === "string") {
              if (propDef.default === void 0) {
                continue;
              }
            } else {
              continue;
            }
          }
          const propPath = `${path}/${key}`;
          const validated = validateOneOf(lexicons, propPath, propDef, keyValue);
          const propValue = validated.success ? validated.value : keyValue;
          if (propValue === void 0) {
            if (def.required?.includes(key)) {
              return {
                success: false,
                error: new types_1.ValidationError(`${path} must have the property "${key}"`)
              };
            }
          } else {
            if (!validated.success) {
              return validated;
            }
          }
          if (propValue !== keyValue) {
            if (resultValue === value) {
              resultValue = { ...value };
            }
            resultValue[key] = propValue;
          }
        }
      }
      return { success: true, value: resultValue };
    }
    function validateOneOf(lexicons, path, def, value, mustBeObj = false) {
      let concreteDef;
      if (def.type === "union") {
        if (!(0, types_1.isDiscriminatedObject)(value)) {
          return {
            success: false,
            error: new types_1.ValidationError(`${path} must be an object which includes the "$type" property`)
          };
        }
        if (!refsContainType(def.refs, value.$type)) {
          if (def.closed) {
            return {
              success: false,
              error: new types_1.ValidationError(`${path} $type must be one of ${def.refs.join(", ")}`)
            };
          }
          return { success: true, value };
        } else {
          concreteDef = lexicons.getDefOrThrow(value.$type);
        }
      } else if (def.type === "ref") {
        concreteDef = lexicons.getDefOrThrow(def.ref);
      } else {
        concreteDef = def;
      }
      return mustBeObj ? object(lexicons, path, concreteDef, value) : validate(lexicons, path, concreteDef, value);
    }
    var refsContainType = (refs, type) => {
      const lexUri = (0, util_1.toLexUri)(type);
      if (refs.includes(lexUri)) {
        return true;
      }
      if (lexUri.endsWith("#main")) {
        return refs.includes(lexUri.slice(0, -5));
      } else {
        return !lexUri.includes("#") && refs.includes(`${lexUri}#main`);
      }
    };
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validators/xrpc.js
var require_xrpc2 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validators/xrpc.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __setModuleDefault2 = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    } : function(o, v) {
      o["default"] = v;
    });
    var __importStar2 = exports && exports.__importStar || /* @__PURE__ */ function() {
      var ownKeys2 = function(o) {
        ownKeys2 = 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 ownKeys2(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]);
        }
        __setModuleDefault2(result, mod);
        return result;
      };
    }();
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.params = params;
    var types_1 = require_types5();
    var complex_1 = require_complex2();
    var PrimitiveValidators = __importStar2(require_primitives2());
    function params(lexicons, path, def, val) {
      const value = val && typeof val === "object" ? val : {};
      const requiredProps = new Set(def.required ?? []);
      let resultValue = value;
      if (typeof def.properties === "object") {
        for (const key in def.properties) {
          const propDef = def.properties[key];
          const validated = propDef.type === "array" ? (0, complex_1.array)(lexicons, key, propDef, value[key]) : PrimitiveValidators.validate(lexicons, key, propDef, value[key]);
          const propValue = validated.success ? validated.value : value[key];
          const propIsUndefined = typeof propValue === "undefined";
          if (propIsUndefined && requiredProps.has(key)) {
            return {
              success: false,
              error: new types_1.ValidationError(`${path} must have the property "${key}"`)
            };
          } else if (!propIsUndefined && !validated.success) {
            return validated;
          }
          if (propValue !== value[key]) {
            if (resultValue === value) {
              resultValue = { ...value };
            }
            resultValue[key] = propValue;
          }
        }
      }
      return { success: true, value: resultValue };
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validation.js
var require_validation2 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/validation.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.assertValidRecord = assertValidRecord;
    exports.assertValidXrpcParams = assertValidXrpcParams;
    exports.assertValidXrpcInput = assertValidXrpcInput;
    exports.assertValidXrpcOutput = assertValidXrpcOutput;
    exports.assertValidXrpcMessage = assertValidXrpcMessage;
    var complex_1 = require_complex2();
    var xrpc_1 = require_xrpc2();
    function assertValidRecord(lexicons, def, value) {
      const res = (0, complex_1.object)(lexicons, "Record", def.record, value);
      if (!res.success)
        throw res.error;
      return res.value;
    }
    function assertValidXrpcParams(lexicons, def, value) {
      if (def.parameters) {
        const res = (0, xrpc_1.params)(lexicons, "Params", def.parameters, value);
        if (!res.success)
          throw res.error;
        return res.value;
      }
    }
    function assertValidXrpcInput(lexicons, def, value) {
      if (def.input?.schema) {
        return assertValidOneOf(lexicons, "Input", def.input.schema, value, true);
      }
    }
    function assertValidXrpcOutput(lexicons, def, value) {
      if (def.output?.schema) {
        return assertValidOneOf(lexicons, "Output", def.output.schema, value, true);
      }
    }
    function assertValidXrpcMessage(lexicons, def, value) {
      if (def.message?.schema) {
        return assertValidOneOf(lexicons, "Message", def.message.schema, value, true);
      }
    }
    function assertValidOneOf(lexicons, path, def, value, mustBeObj = false) {
      const res = (0, complex_1.validateOneOf)(lexicons, path, def, value, mustBeObj);
      if (!res.success)
        throw res.error;
      return res.value;
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/lexicons.js
var require_lexicons3 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/lexicons.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Lexicons = void 0;
    var types_1 = require_types5();
    var util_1 = require_util7();
    var validation_1 = require_validation2();
    var complex_1 = require_complex2();
    var Lexicons = class {
      constructor(docs) {
        Object.defineProperty(this, "docs", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map()
        });
        Object.defineProperty(this, "defs", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map()
        });
        if (docs) {
          for (const doc of docs) {
            this.add(doc);
          }
        }
      }
      /**
       * @example clone a lexicon:
       * ```ts
       * const clone = new Lexicons(originalLexicon)
       * ```
       *
       * @example get docs array:
       * ```ts
       * const docs = Array.from(lexicons)
       * ```
       */
      [Symbol.iterator]() {
        return this.docs.values();
      }
      /**
       * Add a lexicon doc.
       */
      add(doc) {
        const uri = (0, util_1.toLexUri)(doc.id);
        if (this.docs.has(uri)) {
          throw new Error(`${uri} has already been registered`);
        }
        resolveRefUris(doc, uri);
        this.docs.set(uri, doc);
        for (const [defUri, def] of iterDefs(doc)) {
          this.defs.set(defUri, def);
        }
      }
      /**
       * Remove a lexicon doc.
       */
      remove(uri) {
        uri = (0, util_1.toLexUri)(uri);
        const doc = this.docs.get(uri);
        if (!doc) {
          throw new Error(`Unable to remove "${uri}": does not exist`);
        }
        for (const [defUri, _def] of iterDefs(doc)) {
          this.defs.delete(defUri);
        }
        this.docs.delete(uri);
      }
      /**
       * Get a lexicon doc.
       */
      get(uri) {
        uri = (0, util_1.toLexUri)(uri);
        return this.docs.get(uri);
      }
      /**
       * Get a definition.
       */
      getDef(uri) {
        uri = (0, util_1.toLexUri)(uri);
        return this.defs.get(uri);
      }
      getDefOrThrow(uri, types2) {
        const def = this.getDef(uri);
        if (!def) {
          throw new types_1.LexiconDefNotFoundError(`Lexicon not found: ${uri}`);
        }
        if (types2 && !types2.includes(def.type)) {
          throw new types_1.InvalidLexiconError(`Not a ${types2.join(" or ")} lexicon: ${uri}`);
        }
        return def;
      }
      /**
       * Validate a record or object.
       */
      validate(lexUri, value) {
        if (!(0, types_1.isObj)(value)) {
          throw new types_1.ValidationError(`Value must be an object`);
        }
        const lexUriNormalized = (0, util_1.toLexUri)(lexUri);
        const def = this.getDefOrThrow(lexUriNormalized, ["record", "object"]);
        if (def.type === "record") {
          return (0, complex_1.object)(this, "Record", def.record, value);
        } else if (def.type === "object") {
          return (0, complex_1.object)(this, "Object", def, value);
        } else {
          throw new types_1.InvalidLexiconError("Definition must be a record or object");
        }
      }
      /**
       * Validate a record and throw on any error.
       */
      assertValidRecord(lexUri, value) {
        if (!(0, types_1.isObj)(value)) {
          throw new types_1.ValidationError(`Record must be an object`);
        }
        if (!("$type" in value)) {
          throw new types_1.ValidationError(`Record/$type must be a string`);
        }
        const { $type } = value;
        if (typeof $type !== "string") {
          throw new types_1.ValidationError(`Record/$type must be a string`);
        }
        const lexUriNormalized = (0, util_1.toLexUri)(lexUri);
        if ((0, util_1.toLexUri)($type) !== lexUriNormalized) {
          throw new types_1.ValidationError(`Invalid $type: must be ${lexUriNormalized}, got ${$type}`);
        }
        const def = this.getDefOrThrow(lexUriNormalized, ["record"]);
        return (0, validation_1.assertValidRecord)(this, def, value);
      }
      /**
       * Validate xrpc query params and throw on any error.
       */
      assertValidXrpcParams(lexUri, value) {
        lexUri = (0, util_1.toLexUri)(lexUri);
        const def = this.getDefOrThrow(lexUri, [
          "query",
          "procedure",
          "subscription"
        ]);
        return (0, validation_1.assertValidXrpcParams)(this, def, value);
      }
      /**
       * Validate xrpc input body and throw on any error.
       */
      assertValidXrpcInput(lexUri, value) {
        lexUri = (0, util_1.toLexUri)(lexUri);
        const def = this.getDefOrThrow(lexUri, ["procedure"]);
        return (0, validation_1.assertValidXrpcInput)(this, def, value);
      }
      /**
       * Validate xrpc output body and throw on any error.
       */
      assertValidXrpcOutput(lexUri, value) {
        lexUri = (0, util_1.toLexUri)(lexUri);
        const def = this.getDefOrThrow(lexUri, ["query", "procedure"]);
        return (0, validation_1.assertValidXrpcOutput)(this, def, value);
      }
      /**
       * Validate xrpc subscription message and throw on any error.
       */
      assertValidXrpcMessage(lexUri, value) {
        lexUri = (0, util_1.toLexUri)(lexUri);
        const def = this.getDefOrThrow(lexUri, ["subscription"]);
        return (0, validation_1.assertValidXrpcMessage)(this, def, value);
      }
      /**
       * Resolve a lex uri given a ref
       */
      resolveLexUri(lexUri, ref) {
        lexUri = (0, util_1.toLexUri)(lexUri);
        return (0, util_1.toLexUri)(ref, lexUri);
      }
    };
    exports.Lexicons = Lexicons;
    function* iterDefs(doc) {
      for (const defId in doc.defs) {
        yield [`lex:${doc.id}#${defId}`, doc.defs[defId]];
        if (defId === "main") {
          yield [`lex:${doc.id}`, doc.defs[defId]];
        }
      }
    }
    function resolveRefUris(obj, baseUri) {
      for (const k in obj) {
        if (obj.type === "ref") {
          obj.ref = (0, util_1.toLexUri)(obj.ref, baseUri);
        } else if (obj.type === "union") {
          obj.refs = obj.refs.map((ref) => (0, util_1.toLexUri)(ref, baseUri));
        } else if (Array.isArray(obj[k])) {
          obj[k] = obj[k].map((item) => {
            if (typeof item === "string") {
              return item.startsWith("#") ? (0, util_1.toLexUri)(item, baseUri) : item;
            } else if (item && typeof item === "object") {
              return resolveRefUris(item, baseUri);
            }
            return item;
          });
        } else if (obj[k] && typeof obj[k] === "object") {
          obj[k] = resolveRefUris(obj[k], baseUri);
        }
      }
      return obj;
    }
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/serialize.js
var require_serialize2 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/serialize.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.jsonStringToLex = exports.jsonToLex = exports.stringifyLex = exports.lexToJson = exports.ipldToLex = exports.lexToIpld = void 0;
    var cid_1 = (init_cid(), __toCommonJS(cid_exports));
    var common_web_1 = require_dist4();
    var blob_refs_1 = require_blob_refs2();
    var lexToIpld = (val) => {
      if (Array.isArray(val)) {
        return val.map((item) => (0, exports.lexToIpld)(item));
      }
      if (val && typeof val === "object") {
        if (val instanceof blob_refs_1.BlobRef) {
          return val.original;
        }
        if (cid_1.CID.asCID(val) || val instanceof Uint8Array) {
          return val;
        }
        const toReturn = {};
        for (const key of Object.keys(val)) {
          toReturn[key] = (0, exports.lexToIpld)(val[key]);
        }
        return toReturn;
      }
      return val;
    };
    exports.lexToIpld = lexToIpld;
    var ipldToLex = (val) => {
      if (Array.isArray(val)) {
        return val.map((item) => (0, exports.ipldToLex)(item));
      }
      if (val && typeof val === "object") {
        if ((val["$type"] === "blob" || typeof val["cid"] === "string" && typeof val["mimeType"] === "string") && common_web_1.check.is(val, blob_refs_1.jsonBlobRef)) {
          return blob_refs_1.BlobRef.fromJsonRef(val);
        }
        if (cid_1.CID.asCID(val) || val instanceof Uint8Array) {
          return val;
        }
        const toReturn = {};
        for (const key of Object.keys(val)) {
          toReturn[key] = (0, exports.ipldToLex)(val[key]);
        }
        return toReturn;
      }
      return val;
    };
    exports.ipldToLex = ipldToLex;
    var lexToJson = (val) => {
      return (0, common_web_1.ipldToJson)((0, exports.lexToIpld)(val));
    };
    exports.lexToJson = lexToJson;
    var stringifyLex = (val) => {
      return JSON.stringify((0, exports.lexToJson)(val));
    };
    exports.stringifyLex = stringifyLex;
    var jsonToLex = (val) => {
      return (0, exports.ipldToLex)((0, common_web_1.jsonToIpld)(val));
    };
    exports.jsonToLex = jsonToLex;
    var jsonStringToLex = (val) => {
      return (0, exports.jsonToLex)(JSON.parse(val));
    };
    exports.jsonStringToLex = jsonStringToLex;
  }
});

// node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/index.js
var require_dist9 = __commonJS({
  "node_modules/@atproto/xrpc/node_modules/@atproto/lexicon/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_types5(), exports);
    __exportStar2(require_lexicons3(), exports);
    __exportStar2(require_blob_refs2(), exports);
    __exportStar2(require_serialize2(), exports);
  }
});

// node_modules/@atproto/xrpc/dist/types.js
var require_types6 = __commonJS({
  "node_modules/@atproto/xrpc/dist/types.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.XRPCInvalidResponseError = exports.XRPCError = exports.XRPCResponse = exports.ResponseTypeStrings = exports.ResponseType = exports.errorResponseBody = void 0;
    exports.httpResponseCodeToEnum = httpResponseCodeToEnum;
    exports.httpResponseCodeToName = httpResponseCodeToName;
    exports.httpResponseCodeToString = httpResponseCodeToString;
    var zod_1 = require_zod();
    exports.errorResponseBody = zod_1.z.object({
      error: zod_1.z.string().optional(),
      message: zod_1.z.string().optional()
    });
    var ResponseType;
    (function(ResponseType2) {
      ResponseType2[ResponseType2["Unknown"] = 1] = "Unknown";
      ResponseType2[ResponseType2["InvalidResponse"] = 2] = "InvalidResponse";
      ResponseType2[ResponseType2["Success"] = 200] = "Success";
      ResponseType2[ResponseType2["InvalidRequest"] = 400] = "InvalidRequest";
      ResponseType2[ResponseType2["AuthenticationRequired"] = 401] = "AuthenticationRequired";
      ResponseType2[ResponseType2["Forbidden"] = 403] = "Forbidden";
      ResponseType2[ResponseType2["XRPCNotSupported"] = 404] = "XRPCNotSupported";
      ResponseType2[ResponseType2["NotAcceptable"] = 406] = "NotAcceptable";
      ResponseType2[ResponseType2["PayloadTooLarge"] = 413] = "PayloadTooLarge";
      ResponseType2[ResponseType2["UnsupportedMediaType"] = 415] = "UnsupportedMediaType";
      ResponseType2[ResponseType2["RateLimitExceeded"] = 429] = "RateLimitExceeded";
      ResponseType2[ResponseType2["InternalServerError"] = 500] = "InternalServerError";
      ResponseType2[ResponseType2["MethodNotImplemented"] = 501] = "MethodNotImplemented";
      ResponseType2[ResponseType2["UpstreamFailure"] = 502] = "UpstreamFailure";
      ResponseType2[ResponseType2["NotEnoughResources"] = 503] = "NotEnoughResources";
      ResponseType2[ResponseType2["UpstreamTimeout"] = 504] = "UpstreamTimeout";
    })(ResponseType || (exports.ResponseType = ResponseType = {}));
    function httpResponseCodeToEnum(status) {
      if (status in ResponseType) {
        return status;
      } else if (status >= 100 && status < 200) {
        return ResponseType.XRPCNotSupported;
      } else if (status >= 200 && status < 300) {
        return ResponseType.Success;
      } else if (status >= 300 && status < 400) {
        return ResponseType.XRPCNotSupported;
      } else if (status >= 400 && status < 500) {
        return ResponseType.InvalidRequest;
      } else {
        return ResponseType.InternalServerError;
      }
    }
    function httpResponseCodeToName(status) {
      return ResponseType[httpResponseCodeToEnum(status)];
    }
    exports.ResponseTypeStrings = {
      [ResponseType.Unknown]: "Unknown",
      [ResponseType.InvalidResponse]: "Invalid Response",
      [ResponseType.Success]: "Success",
      [ResponseType.InvalidRequest]: "Invalid Request",
      [ResponseType.AuthenticationRequired]: "Authentication Required",
      [ResponseType.Forbidden]: "Forbidden",
      [ResponseType.XRPCNotSupported]: "XRPC Not Supported",
      [ResponseType.NotAcceptable]: "Not Acceptable",
      [ResponseType.PayloadTooLarge]: "Payload Too Large",
      [ResponseType.UnsupportedMediaType]: "Unsupported Media Type",
      [ResponseType.RateLimitExceeded]: "Rate Limit Exceeded",
      [ResponseType.InternalServerError]: "Internal Server Error",
      [ResponseType.MethodNotImplemented]: "Method Not Implemented",
      [ResponseType.UpstreamFailure]: "Upstream Failure",
      [ResponseType.NotEnoughResources]: "Not Enough Resources",
      [ResponseType.UpstreamTimeout]: "Upstream Timeout"
    };
    function httpResponseCodeToString(status) {
      return exports.ResponseTypeStrings[httpResponseCodeToEnum(status)];
    }
    var XRPCResponse = class {
      constructor(data, headers) {
        Object.defineProperty(this, "data", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: data
        });
        Object.defineProperty(this, "headers", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: headers
        });
        Object.defineProperty(this, "success", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: true
        });
      }
    };
    exports.XRPCResponse = XRPCResponse;
    var XRPCError = class _XRPCError extends Error {
      constructor(statusCode, error = httpResponseCodeToName(statusCode), message2, headers, options) {
        super(message2 || error || httpResponseCodeToString(statusCode), options);
        Object.defineProperty(this, "error", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: error
        });
        Object.defineProperty(this, "headers", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: headers
        });
        Object.defineProperty(this, "success", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: false
        });
        Object.defineProperty(this, "status", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.status = httpResponseCodeToEnum(statusCode);
        const cause = options?.cause;
        if (this.cause === void 0 && cause !== void 0) {
          this.cause = cause;
        }
      }
      static from(cause, fallbackStatus) {
        if (cause instanceof _XRPCError) {
          return cause;
        }
        const causeErr = cause instanceof Error ? cause : void 0;
        const causeResponse = cause instanceof Response ? cause : cause?.["response"] instanceof Response ? cause["response"] : void 0;
        const statusCode = (
          // Extract status code from "http-errors" like errors
          causeErr?.["statusCode"] ?? causeErr?.["status"] ?? // Use the status code from the response object as fallback
          causeResponse?.status
        );
        const status = typeof statusCode === "number" ? httpResponseCodeToEnum(statusCode) : fallbackStatus ?? ResponseType.Unknown;
        const message2 = causeErr?.message ?? String(cause);
        const headers = causeResponse ? Object.fromEntries(causeResponse.headers.entries()) : void 0;
        return new _XRPCError(status, void 0, message2, headers, { cause });
      }
    };
    exports.XRPCError = XRPCError;
    var XRPCInvalidResponseError = class extends XRPCError {
      constructor(lexiconNsid, validationError, responseBody) {
        super(
          ResponseType.InvalidResponse,
          // @NOTE: This is probably wrong and should use ResponseTypeNames instead.
          // But it would mean a breaking change.
          exports.ResponseTypeStrings[ResponseType.InvalidResponse],
          `The server gave an invalid response and may be out of date.`,
          void 0,
          { cause: validationError }
        );
        Object.defineProperty(this, "lexiconNsid", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: lexiconNsid
        });
        Object.defineProperty(this, "validationError", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: validationError
        });
        Object.defineProperty(this, "responseBody", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: responseBody
        });
      }
    };
    exports.XRPCInvalidResponseError = XRPCInvalidResponseError;
  }
});

// node_modules/@atproto/xrpc/dist/util.js
var require_util8 = __commonJS({
  "node_modules/@atproto/xrpc/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isErrorResponseBody = isErrorResponseBody;
    exports.getMethodSchemaHTTPMethod = getMethodSchemaHTTPMethod;
    exports.constructMethodCallUri = constructMethodCallUri;
    exports.constructMethodCallUrl = constructMethodCallUrl;
    exports.encodeQueryParam = encodeQueryParam;
    exports.constructMethodCallHeaders = constructMethodCallHeaders;
    exports.combineHeaders = combineHeaders;
    exports.isBodyInit = isBodyInit;
    exports.isIterable = isIterable;
    exports.encodeMethodCallBody = encodeMethodCallBody;
    exports.httpResponseBodyParse = httpResponseBodyParse;
    var lexicon_1 = require_dist9();
    var types_1 = require_types6();
    var ReadableStream = globalThis.ReadableStream || class {
      constructor() {
        throw new Error("ReadableStream is not supported in this environment");
      }
    };
    function isErrorResponseBody(v) {
      return types_1.errorResponseBody.safeParse(v).success;
    }
    function getMethodSchemaHTTPMethod(schema) {
      if (schema.type === "procedure") {
        return "post";
      }
      return "get";
    }
    function constructMethodCallUri(nsid, schema, serviceUri, params) {
      const uri = new URL(constructMethodCallUrl(nsid, schema, params), serviceUri);
      return uri.toString();
    }
    function constructMethodCallUrl(nsid, schema, params) {
      const pathname = `/xrpc/${encodeURIComponent(nsid)}`;
      if (!params)
        return pathname;
      const searchParams = [];
      for (const [key, value] of Object.entries(params)) {
        const paramSchema = schema.parameters?.properties?.[key];
        if (!paramSchema) {
          throw new Error(`Invalid query parameter: ${key}`);
        }
        if (value !== void 0) {
          if (paramSchema.type === "array") {
            const values = Array.isArray(value) ? value : [value];
            for (const val of values) {
              searchParams.push([
                key,
                encodeQueryParam(paramSchema.items.type, val)
              ]);
            }
          } else {
            searchParams.push([key, encodeQueryParam(paramSchema.type, value)]);
          }
        }
      }
      if (!searchParams.length)
        return pathname;
      return `${pathname}?${new URLSearchParams(searchParams).toString()}`;
    }
    function encodeQueryParam(type, value) {
      if (type === "string" || type === "unknown") {
        return String(value);
      }
      if (type === "float") {
        return String(Number(value));
      } else if (type === "integer") {
        return String(Number(value) | 0);
      } else if (type === "boolean") {
        return value ? "true" : "false";
      } else if (type === "datetime") {
        if (value instanceof Date) {
          return value.toISOString();
        }
        return String(value);
      }
      throw new Error(`Unsupported query param type: ${type}`);
    }
    function constructMethodCallHeaders(schema, data, opts) {
      const headers = new Headers();
      if (opts?.headers) {
        for (const name2 in opts.headers) {
          if (headers.has(name2)) {
            throw new TypeError(`Duplicate header: ${name2}`);
          }
          const value = opts.headers[name2];
          if (value != null) {
            headers.set(name2, value);
          }
        }
      }
      if (schema.type === "procedure") {
        if (opts?.encoding) {
          headers.set("content-type", opts.encoding);
        } else if (!headers.has("content-type") && typeof data !== "undefined") {
          if (data instanceof ArrayBuffer || data instanceof ReadableStream || ArrayBuffer.isView(data)) {
            headers.set("content-type", "application/octet-stream");
          } else if (data instanceof FormData) {
            headers.set("content-type", "multipart/form-data");
          } else if (data instanceof URLSearchParams) {
            headers.set("content-type", "application/x-www-form-urlencoded;charset=UTF-8");
          } else if (isBlobLike(data)) {
            headers.set("content-type", data.type || "application/octet-stream");
          } else if (typeof data === "string") {
            headers.set("content-type", "text/plain;charset=UTF-8");
          } else if (isIterable(data)) {
            headers.set("content-type", "application/octet-stream");
          } else if (typeof data === "boolean" || typeof data === "number" || typeof data === "string" || typeof data === "object") {
            headers.set("content-type", "application/json");
          } else {
            throw new types_1.XRPCError(types_1.ResponseType.InvalidRequest, `Unsupported data type: ${typeof data}`);
          }
        }
      }
      return headers;
    }
    function combineHeaders(headersInit, defaultHeaders) {
      if (!defaultHeaders)
        return headersInit;
      let headers = void 0;
      for (const [name2, definition] of defaultHeaders) {
        if (definition === void 0)
          continue;
        headers ?? (headers = new Headers(headersInit));
        if (headers.has(name2))
          continue;
        const value = typeof definition === "function" ? definition() : definition;
        if (typeof value === "string")
          headers.set(name2, value);
        else if (value === null)
          headers.delete(name2);
        else
          throw new TypeError(`Invalid "${name2}" header value: ${typeof value}`);
      }
      return headers ?? headersInit;
    }
    function isBlobLike(value) {
      if (value == null)
        return false;
      if (typeof value !== "object")
        return false;
      if (typeof Blob === "function" && value instanceof Blob)
        return true;
      const tag2 = value[Symbol.toStringTag];
      if (tag2 === "Blob" || tag2 === "File") {
        return "stream" in value && typeof value.stream === "function";
      }
      return false;
    }
    function isBodyInit(value) {
      switch (typeof value) {
        case "string":
          return true;
        case "object":
          return value instanceof ArrayBuffer || value instanceof FormData || value instanceof URLSearchParams || value instanceof ReadableStream || ArrayBuffer.isView(value) || isBlobLike(value);
        default:
          return false;
      }
    }
    function isIterable(value) {
      return value != null && typeof value === "object" && (Symbol.iterator in value || Symbol.asyncIterator in value);
    }
    function encodeMethodCallBody(headers, data) {
      const contentType = headers.get("content-type");
      if (!contentType) {
        return void 0;
      }
      if (typeof data === "undefined") {
        throw new types_1.XRPCError(types_1.ResponseType.InvalidRequest, `A request body is expected but none was provided`);
      }
      if (isBodyInit(data)) {
        if (data instanceof FormData && contentType === "multipart/form-data") {
          headers.delete("content-type");
        }
        return data;
      }
      if (isIterable(data)) {
        return iterableToReadableStream(data);
      }
      if (contentType.startsWith("text/")) {
        return new TextEncoder().encode(String(data));
      }
      if (contentType.startsWith("application/json")) {
        const json = (0, lexicon_1.stringifyLex)(data);
        if (json === void 0) {
          throw new types_1.XRPCError(types_1.ResponseType.InvalidRequest, `Failed to encode request body as JSON`);
        }
        return new TextEncoder().encode(json);
      }
      const type = !data || typeof data !== "object" ? typeof data : data.constructor !== Object && typeof data.constructor === "function" && typeof data.constructor?.name === "string" ? data.constructor.name : "object";
      throw new types_1.XRPCError(types_1.ResponseType.InvalidRequest, `Unable to encode ${type} as ${contentType} data`);
    }
    function iterableToReadableStream(iterable) {
      if ("from" in ReadableStream && typeof ReadableStream.from === "function") {
        return ReadableStream.from(iterable);
      }
      throw new TypeError("ReadableStream.from() is not supported in this environment. It is required to support using iterables as the request body. Consider using a polyfill or re-write your code to use a different body type.");
    }
    function httpResponseBodyParse(mimeType, data) {
      try {
        if (mimeType) {
          if (mimeType.includes("application/json")) {
            const str = new TextDecoder().decode(data);
            return (0, lexicon_1.jsonStringToLex)(str);
          }
          if (mimeType.startsWith("text/")) {
            return new TextDecoder().decode(data);
          }
        }
        if (data instanceof ArrayBuffer) {
          return new Uint8Array(data);
        }
        return data;
      } catch (cause) {
        throw new types_1.XRPCError(types_1.ResponseType.InvalidResponse, void 0, `Failed to parse response body: ${String(cause)}`, void 0, { cause });
      }
    }
  }
});

// node_modules/@atproto/xrpc/dist/fetch-handler.js
var require_fetch_handler = __commonJS({
  "node_modules/@atproto/xrpc/dist/fetch-handler.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.buildFetchHandler = buildFetchHandler;
    var util_1 = require_util8();
    function buildFetchHandler(options) {
      if (typeof options === "function")
        return options;
      if (typeof options === "object" && "fetchHandler" in options) {
        return options.fetchHandler.bind(options);
      }
      const { service, headers: defaultHeaders = void 0, fetch: fetch2 = globalThis.fetch } = typeof options === "string" || options instanceof URL ? { service: options } : options;
      if (typeof fetch2 !== "function") {
        throw new TypeError("XrpcDispatcher requires fetch() to be available in your environment.");
      }
      const defaultHeadersEntries = defaultHeaders != null ? Object.entries(defaultHeaders) : void 0;
      return async function(url, init) {
        const base3 = typeof service === "function" ? service() : service;
        const fullUrl = new URL(url, base3);
        const headers = (0, util_1.combineHeaders)(init.headers, defaultHeadersEntries);
        return fetch2(fullUrl, { ...init, headers });
      };
    }
  }
});

// node_modules/@atproto/xrpc/dist/xrpc-client.js
var require_xrpc_client = __commonJS({
  "node_modules/@atproto/xrpc/dist/xrpc-client.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.XrpcClient = void 0;
    var lexicon_1 = require_dist9();
    var fetch_handler_1 = require_fetch_handler();
    var types_1 = require_types6();
    var util_1 = require_util8();
    var XrpcClient = class {
      constructor(fetchHandlerOpts, lex) {
        Object.defineProperty(this, "fetchHandler", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "headers", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map()
        });
        Object.defineProperty(this, "lex", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.fetchHandler = (0, fetch_handler_1.buildFetchHandler)(fetchHandlerOpts);
        this.lex = lex instanceof lexicon_1.Lexicons ? lex : new lexicon_1.Lexicons(lex);
      }
      setHeader(key, value) {
        this.headers.set(key.toLowerCase(), value);
      }
      unsetHeader(key) {
        this.headers.delete(key.toLowerCase());
      }
      clearHeaders() {
        this.headers.clear();
      }
      async call(methodNsid, params, data, opts) {
        const def = this.lex.getDefOrThrow(methodNsid);
        if (!def || def.type !== "query" && def.type !== "procedure") {
          throw new TypeError(`Invalid lexicon: ${methodNsid}. Must be a query or procedure.`);
        }
        const reqUrl = (0, util_1.constructMethodCallUrl)(methodNsid, def, params);
        const reqMethod = (0, util_1.getMethodSchemaHTTPMethod)(def);
        const reqHeaders = (0, util_1.constructMethodCallHeaders)(def, data, opts);
        const reqBody = (0, util_1.encodeMethodCallBody)(reqHeaders, data);
        const init = {
          method: reqMethod,
          headers: (0, util_1.combineHeaders)(reqHeaders, this.headers),
          body: reqBody,
          duplex: "half",
          redirect: "follow",
          signal: opts?.signal
        };
        try {
          const response = await this.fetchHandler.call(void 0, reqUrl, init);
          const resStatus = response.status;
          const resHeaders = Object.fromEntries(response.headers.entries());
          const resBodyBytes = await response.arrayBuffer();
          const resBody = (0, util_1.httpResponseBodyParse)(response.headers.get("content-type"), resBodyBytes);
          const resCode = (0, types_1.httpResponseCodeToEnum)(resStatus);
          if (resCode !== types_1.ResponseType.Success) {
            const { error = void 0, message: message2 = void 0 } = resBody && (0, util_1.isErrorResponseBody)(resBody) ? resBody : {};
            throw new types_1.XRPCError(resCode, error, message2, resHeaders);
          }
          try {
            this.lex.assertValidXrpcOutput(methodNsid, resBody);
          } catch (e) {
            if (e instanceof lexicon_1.ValidationError) {
              throw new types_1.XRPCInvalidResponseError(methodNsid, e, resBody);
            }
            throw e;
          }
          return new types_1.XRPCResponse(resBody, resHeaders);
        } catch (err) {
          throw types_1.XRPCError.from(err);
        }
      }
    };
    exports.XrpcClient = XrpcClient;
  }
});

// node_modules/@atproto/xrpc/dist/client.js
var require_client = __commonJS({
  "node_modules/@atproto/xrpc/dist/client.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ServiceClient = exports.Client = void 0;
    var lexicon_1 = require_dist9();
    var util_1 = require_util8();
    var xrpc_client_1 = require_xrpc_client();
    var Client = class {
      constructor() {
        Object.defineProperty(this, "lex", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: new lexicon_1.Lexicons()
        });
      }
      /** @deprecated */
      get fetch() {
        throw new Error("Client.fetch is no longer supported. Use an XrpcClient instead.");
      }
      /** @deprecated */
      set fetch(_) {
        throw new Error("Client.fetch is no longer supported. Use an XrpcClient instead.");
      }
      // method calls
      //
      async call(serviceUri, methodNsid, params, data, opts) {
        return this.service(serviceUri).call(methodNsid, params, data, opts);
      }
      service(serviceUri) {
        return new ServiceClient(this, serviceUri);
      }
      // schemas
      // =
      addLexicon(doc) {
        this.lex.add(doc);
      }
      addLexicons(docs) {
        for (const doc of docs) {
          this.addLexicon(doc);
        }
      }
      removeLexicon(uri) {
        this.lex.remove(uri);
      }
    };
    exports.Client = Client;
    var ServiceClient = class extends xrpc_client_1.XrpcClient {
      constructor(baseClient, serviceUri) {
        super(async (input, init) => {
          const headers = (0, util_1.combineHeaders)(init.headers, Object.entries(this.headers));
          return fetch(new URL(input, this.uri), { ...init, headers });
        }, baseClient.lex);
        Object.defineProperty(this, "baseClient", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: baseClient
        });
        Object.defineProperty(this, "uri", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.uri = typeof serviceUri === "string" ? new URL(serviceUri) : serviceUri;
      }
    };
    exports.ServiceClient = ServiceClient;
  }
});

// node_modules/@atproto/xrpc/dist/index.js
var require_dist10 = __commonJS({
  "node_modules/@atproto/xrpc/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_client(), exports);
    __exportStar2(require_fetch_handler(), exports);
    __exportStar2(require_types6(), exports);
    __exportStar2(require_util8(), exports);
    __exportStar2(require_xrpc_client(), exports);
    var client_1 = require_client();
    var defaultInst = new client_1.Client();
    exports.default = defaultInst;
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/bookmark/createBookmark.js
var require_createBookmark = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/bookmark/createBookmark.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.UnsupportedCollectionError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var UnsupportedCollectionError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.UnsupportedCollectionError = UnsupportedCollectionError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "UnsupportedCollection")
          return new UnsupportedCollectionError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/bookmark/deleteBookmark.js
var require_deleteBookmark = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/bookmark/deleteBookmark.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.UnsupportedCollectionError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var UnsupportedCollectionError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.UnsupportedCollectionError = UnsupportedCollectionError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "UnsupportedCollection")
          return new UnsupportedCollectionError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getActorLikes.js
var require_getActorLikes = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getActorLikes.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BlockedByActorError = exports.BlockedActorError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var BlockedActorError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.BlockedActorError = BlockedActorError;
    var BlockedByActorError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.BlockedByActorError = BlockedByActorError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "BlockedActor")
          return new BlockedActorError(e);
        if (e.error === "BlockedByActor")
          return new BlockedByActorError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getAuthorFeed.js
var require_getAuthorFeed = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getAuthorFeed.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BlockedByActorError = exports.BlockedActorError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var BlockedActorError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.BlockedActorError = BlockedActorError;
    var BlockedByActorError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.BlockedByActorError = BlockedByActorError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "BlockedActor")
          return new BlockedActorError(e);
        if (e.error === "BlockedByActor")
          return new BlockedByActorError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getFeed.js
var require_getFeed = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getFeed.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.UnknownFeedError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var UnknownFeedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.UnknownFeedError = UnknownFeedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "UnknownFeed")
          return new UnknownFeedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getFeedSkeleton.js
var require_getFeedSkeleton = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getFeedSkeleton.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.UnknownFeedError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var UnknownFeedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.UnknownFeedError = UnknownFeedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "UnknownFeed")
          return new UnknownFeedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getListFeed.js
var require_getListFeed = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getListFeed.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.UnknownListError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var UnknownListError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.UnknownListError = UnknownListError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "UnknownList")
          return new UnknownListError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getPostThread.js
var require_getPostThread = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getPostThread.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.NotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var NotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.NotFoundError = NotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "NotFound")
          return new NotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/searchPosts.js
var require_searchPosts = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/searchPosts.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BadQueryStringError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var BadQueryStringError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.BadQueryStringError = BadQueryStringError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "BadQueryString")
          return new BadQueryStringError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getRelationships.js
var require_getRelationships = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getRelationships.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ActorNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var ActorNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.ActorNotFoundError = ActorNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "ActorNotFound")
          return new ActorNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/initAgeAssurance.js
var require_initAgeAssurance = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/initAgeAssurance.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidInitiationError = exports.DidTooLongError = exports.InvalidEmailError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var InvalidEmailError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidEmailError = InvalidEmailError;
    var DidTooLongError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.DidTooLongError = DidTooLongError;
    var InvalidInitiationError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidInitiationError = InvalidInitiationError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "InvalidEmail")
          return new InvalidEmailError(e);
        if (e.error === "DidTooLong")
          return new DidTooLongError(e);
        if (e.error === "InvalidInitiation")
          return new InvalidInitiationError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/searchActorsSkeleton.js
var require_searchActorsSkeleton = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/searchActorsSkeleton.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BadQueryStringError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var BadQueryStringError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.BadQueryStringError = BadQueryStringError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "BadQueryString")
          return new BadQueryStringError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/searchPostsSkeleton.js
var require_searchPostsSkeleton = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/searchPostsSkeleton.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BadQueryStringError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var BadQueryStringError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.BadQueryStringError = BadQueryStringError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "BadQueryString")
          return new BadQueryStringError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/searchStarterPacksSkeleton.js
var require_searchStarterPacksSkeleton = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/searchStarterPacksSkeleton.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BadQueryStringError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var BadQueryStringError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.BadQueryStringError = BadQueryStringError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "BadQueryString")
          return new BadQueryStringError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/addReaction.js
var require_addReaction = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/addReaction.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ReactionInvalidValueError = exports.ReactionLimitReachedError = exports.ReactionMessageDeletedError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var ReactionMessageDeletedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.ReactionMessageDeletedError = ReactionMessageDeletedError;
    var ReactionLimitReachedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.ReactionLimitReachedError = ReactionLimitReachedError;
    var ReactionInvalidValueError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.ReactionInvalidValueError = ReactionInvalidValueError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "ReactionMessageDeleted")
          return new ReactionMessageDeletedError(e);
        if (e.error === "ReactionLimitReached")
          return new ReactionLimitReachedError(e);
        if (e.error === "ReactionInvalidValue")
          return new ReactionInvalidValueError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/removeReaction.js
var require_removeReaction = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/removeReaction.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ReactionInvalidValueError = exports.ReactionMessageDeletedError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var ReactionMessageDeletedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.ReactionMessageDeletedError = ReactionMessageDeletedError;
    var ReactionInvalidValueError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.ReactionInvalidValueError = ReactionInvalidValueError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "ReactionMessageDeleted")
          return new ReactionMessageDeletedError(e);
        if (e.error === "ReactionInvalidValue")
          return new ReactionInvalidValueError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/identity/refreshIdentity.js
var require_refreshIdentity = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/identity/refreshIdentity.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DidDeactivatedError = exports.DidNotFoundError = exports.HandleNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var HandleNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.HandleNotFoundError = HandleNotFoundError;
    var DidNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.DidNotFoundError = DidNotFoundError;
    var DidDeactivatedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.DidDeactivatedError = DidDeactivatedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "HandleNotFound")
          return new HandleNotFoundError(e);
        if (e.error === "DidNotFound")
          return new DidNotFoundError(e);
        if (e.error === "DidDeactivated")
          return new DidDeactivatedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/identity/resolveDid.js
var require_resolveDid = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/identity/resolveDid.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DidDeactivatedError = exports.DidNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var DidNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.DidNotFoundError = DidNotFoundError;
    var DidDeactivatedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.DidDeactivatedError = DidDeactivatedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "DidNotFound")
          return new DidNotFoundError(e);
        if (e.error === "DidDeactivated")
          return new DidDeactivatedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/identity/resolveHandle.js
var require_resolveHandle = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/identity/resolveHandle.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.HandleNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var HandleNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.HandleNotFoundError = HandleNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "HandleNotFound")
          return new HandleNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/identity/resolveIdentity.js
var require_resolveIdentity = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/identity/resolveIdentity.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DidDeactivatedError = exports.DidNotFoundError = exports.HandleNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var HandleNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.HandleNotFoundError = HandleNotFoundError;
    var DidNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.DidNotFoundError = DidNotFoundError;
    var DidDeactivatedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.DidDeactivatedError = DidDeactivatedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "HandleNotFound")
          return new HandleNotFoundError(e);
        if (e.error === "DidNotFound")
          return new DidNotFoundError(e);
        if (e.error === "DidDeactivated")
          return new DidDeactivatedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/applyWrites.js
var require_applyWrites = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/applyWrites.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidSwapError = void 0;
    exports.toKnownErr = toKnownErr;
    exports.isCreate = isCreate;
    exports.validateCreate = validateCreate;
    exports.isUpdate = isUpdate;
    exports.validateUpdate = validateUpdate;
    exports.isDelete = isDelete;
    exports.validateDelete = validateDelete;
    exports.isCreateResult = isCreateResult;
    exports.validateCreateResult = validateCreateResult;
    exports.isUpdateResult = isUpdateResult;
    exports.validateUpdateResult = validateUpdateResult;
    exports.isDeleteResult = isDeleteResult;
    exports.validateDeleteResult = validateDeleteResult;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.repo.applyWrites";
    var InvalidSwapError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidSwapError = InvalidSwapError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "InvalidSwap")
          return new InvalidSwapError(e);
      }
      return e;
    }
    var hashCreate = "create";
    function isCreate(v) {
      return is$typed(v, id, hashCreate);
    }
    function validateCreate(v) {
      return validate(v, id, hashCreate);
    }
    var hashUpdate = "update";
    function isUpdate(v) {
      return is$typed(v, id, hashUpdate);
    }
    function validateUpdate(v) {
      return validate(v, id, hashUpdate);
    }
    var hashDelete = "delete";
    function isDelete(v) {
      return is$typed(v, id, hashDelete);
    }
    function validateDelete(v) {
      return validate(v, id, hashDelete);
    }
    var hashCreateResult = "createResult";
    function isCreateResult(v) {
      return is$typed(v, id, hashCreateResult);
    }
    function validateCreateResult(v) {
      return validate(v, id, hashCreateResult);
    }
    var hashUpdateResult = "updateResult";
    function isUpdateResult(v) {
      return is$typed(v, id, hashUpdateResult);
    }
    function validateUpdateResult(v) {
      return validate(v, id, hashUpdateResult);
    }
    var hashDeleteResult = "deleteResult";
    function isDeleteResult(v) {
      return is$typed(v, id, hashDeleteResult);
    }
    function validateDeleteResult(v) {
      return validate(v, id, hashDeleteResult);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/createRecord.js
var require_createRecord = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/createRecord.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidSwapError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var InvalidSwapError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidSwapError = InvalidSwapError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "InvalidSwap")
          return new InvalidSwapError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/deleteRecord.js
var require_deleteRecord = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/deleteRecord.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidSwapError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var InvalidSwapError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidSwapError = InvalidSwapError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "InvalidSwap")
          return new InvalidSwapError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/getRecord.js
var require_getRecord = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/getRecord.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RecordNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var RecordNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RecordNotFoundError = RecordNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "RecordNotFound")
          return new RecordNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/putRecord.js
var require_putRecord = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/putRecord.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidSwapError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var InvalidSwapError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidSwapError = InvalidSwapError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "InvalidSwap")
          return new InvalidSwapError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/confirmEmail.js
var require_confirmEmail = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/confirmEmail.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidEmailError = exports.InvalidTokenError = exports.ExpiredTokenError = exports.AccountNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var AccountNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.AccountNotFoundError = AccountNotFoundError;
    var ExpiredTokenError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.ExpiredTokenError = ExpiredTokenError;
    var InvalidTokenError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidTokenError = InvalidTokenError;
    var InvalidEmailError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidEmailError = InvalidEmailError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "AccountNotFound")
          return new AccountNotFoundError(e);
        if (e.error === "ExpiredToken")
          return new ExpiredTokenError(e);
        if (e.error === "InvalidToken")
          return new InvalidTokenError(e);
        if (e.error === "InvalidEmail")
          return new InvalidEmailError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/createAccount.js
var require_createAccount = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/createAccount.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.IncompatibleDidDocError = exports.UnresolvableDidError = exports.UnsupportedDomainError = exports.HandleNotAvailableError = exports.InvalidInviteCodeError = exports.InvalidPasswordError = exports.InvalidHandleError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var InvalidHandleError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidHandleError = InvalidHandleError;
    var InvalidPasswordError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidPasswordError = InvalidPasswordError;
    var InvalidInviteCodeError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidInviteCodeError = InvalidInviteCodeError;
    var HandleNotAvailableError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.HandleNotAvailableError = HandleNotAvailableError;
    var UnsupportedDomainError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.UnsupportedDomainError = UnsupportedDomainError;
    var UnresolvableDidError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.UnresolvableDidError = UnresolvableDidError;
    var IncompatibleDidDocError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.IncompatibleDidDocError = IncompatibleDidDocError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "InvalidHandle")
          return new InvalidHandleError(e);
        if (e.error === "InvalidPassword")
          return new InvalidPasswordError(e);
        if (e.error === "InvalidInviteCode")
          return new InvalidInviteCodeError(e);
        if (e.error === "HandleNotAvailable")
          return new HandleNotAvailableError(e);
        if (e.error === "UnsupportedDomain")
          return new UnsupportedDomainError(e);
        if (e.error === "UnresolvableDid")
          return new UnresolvableDidError(e);
        if (e.error === "IncompatibleDidDoc")
          return new IncompatibleDidDocError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/createAppPassword.js
var require_createAppPassword = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/createAppPassword.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AccountTakedownError = void 0;
    exports.toKnownErr = toKnownErr;
    exports.isAppPassword = isAppPassword;
    exports.validateAppPassword = validateAppPassword;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.server.createAppPassword";
    var AccountTakedownError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.AccountTakedownError = AccountTakedownError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "AccountTakedown")
          return new AccountTakedownError(e);
      }
      return e;
    }
    var hashAppPassword = "appPassword";
    function isAppPassword(v) {
      return is$typed(v, id, hashAppPassword);
    }
    function validateAppPassword(v) {
      return validate(v, id, hashAppPassword);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/createSession.js
var require_createSession = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/createSession.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AuthFactorTokenRequiredError = exports.AccountTakedownError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var AccountTakedownError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.AccountTakedownError = AccountTakedownError;
    var AuthFactorTokenRequiredError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.AuthFactorTokenRequiredError = AuthFactorTokenRequiredError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "AccountTakedown")
          return new AccountTakedownError(e);
        if (e.error === "AuthFactorTokenRequired")
          return new AuthFactorTokenRequiredError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/deleteAccount.js
var require_deleteAccount = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/deleteAccount.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidTokenError = exports.ExpiredTokenError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var ExpiredTokenError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.ExpiredTokenError = ExpiredTokenError;
    var InvalidTokenError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidTokenError = InvalidTokenError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "ExpiredToken")
          return new ExpiredTokenError(e);
        if (e.error === "InvalidToken")
          return new InvalidTokenError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/getAccountInviteCodes.js
var require_getAccountInviteCodes = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/getAccountInviteCodes.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DuplicateCreateError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var DuplicateCreateError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.DuplicateCreateError = DuplicateCreateError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "DuplicateCreate")
          return new DuplicateCreateError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/getServiceAuth.js
var require_getServiceAuth = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/getServiceAuth.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BadExpirationError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var BadExpirationError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.BadExpirationError = BadExpirationError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "BadExpiration")
          return new BadExpirationError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/listAppPasswords.js
var require_listAppPasswords = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/listAppPasswords.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AccountTakedownError = void 0;
    exports.toKnownErr = toKnownErr;
    exports.isAppPassword = isAppPassword;
    exports.validateAppPassword = validateAppPassword;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.server.listAppPasswords";
    var AccountTakedownError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.AccountTakedownError = AccountTakedownError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "AccountTakedown")
          return new AccountTakedownError(e);
      }
      return e;
    }
    var hashAppPassword = "appPassword";
    function isAppPassword(v) {
      return is$typed(v, id, hashAppPassword);
    }
    function validateAppPassword(v) {
      return validate(v, id, hashAppPassword);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/refreshSession.js
var require_refreshSession = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/refreshSession.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AccountTakedownError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var AccountTakedownError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.AccountTakedownError = AccountTakedownError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "AccountTakedown")
          return new AccountTakedownError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/resetPassword.js
var require_resetPassword = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/resetPassword.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidTokenError = exports.ExpiredTokenError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var ExpiredTokenError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.ExpiredTokenError = ExpiredTokenError;
    var InvalidTokenError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidTokenError = InvalidTokenError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "ExpiredToken")
          return new ExpiredTokenError(e);
        if (e.error === "InvalidToken")
          return new InvalidTokenError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/updateEmail.js
var require_updateEmail = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/updateEmail.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.TokenRequiredError = exports.InvalidTokenError = exports.ExpiredTokenError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var ExpiredTokenError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.ExpiredTokenError = ExpiredTokenError;
    var InvalidTokenError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidTokenError = InvalidTokenError;
    var TokenRequiredError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.TokenRequiredError = TokenRequiredError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "ExpiredToken")
          return new ExpiredTokenError(e);
        if (e.error === "InvalidToken")
          return new InvalidTokenError(e);
        if (e.error === "TokenRequired")
          return new TokenRequiredError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/getBlob.js
var require_getBlob = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/getBlob.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RepoDeactivatedError = exports.RepoSuspendedError = exports.RepoTakendownError = exports.RepoNotFoundError = exports.BlobNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var BlobNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.BlobNotFoundError = BlobNotFoundError;
    var RepoNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoNotFoundError = RepoNotFoundError;
    var RepoTakendownError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoTakendownError = RepoTakendownError;
    var RepoSuspendedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoSuspendedError = RepoSuspendedError;
    var RepoDeactivatedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoDeactivatedError = RepoDeactivatedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "BlobNotFound")
          return new BlobNotFoundError(e);
        if (e.error === "RepoNotFound")
          return new RepoNotFoundError(e);
        if (e.error === "RepoTakendown")
          return new RepoTakendownError(e);
        if (e.error === "RepoSuspended")
          return new RepoSuspendedError(e);
        if (e.error === "RepoDeactivated")
          return new RepoDeactivatedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/getBlocks.js
var require_getBlocks = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/getBlocks.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RepoDeactivatedError = exports.RepoSuspendedError = exports.RepoTakendownError = exports.RepoNotFoundError = exports.BlockNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var BlockNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.BlockNotFoundError = BlockNotFoundError;
    var RepoNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoNotFoundError = RepoNotFoundError;
    var RepoTakendownError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoTakendownError = RepoTakendownError;
    var RepoSuspendedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoSuspendedError = RepoSuspendedError;
    var RepoDeactivatedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoDeactivatedError = RepoDeactivatedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "BlockNotFound")
          return new BlockNotFoundError(e);
        if (e.error === "RepoNotFound")
          return new RepoNotFoundError(e);
        if (e.error === "RepoTakendown")
          return new RepoTakendownError(e);
        if (e.error === "RepoSuspended")
          return new RepoSuspendedError(e);
        if (e.error === "RepoDeactivated")
          return new RepoDeactivatedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/getHead.js
var require_getHead = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/getHead.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.HeadNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var HeadNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.HeadNotFoundError = HeadNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "HeadNotFound")
          return new HeadNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/getHostStatus.js
var require_getHostStatus = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/getHostStatus.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.HostNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var HostNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.HostNotFoundError = HostNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "HostNotFound")
          return new HostNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/getLatestCommit.js
var require_getLatestCommit = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/getLatestCommit.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RepoDeactivatedError = exports.RepoSuspendedError = exports.RepoTakendownError = exports.RepoNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var RepoNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoNotFoundError = RepoNotFoundError;
    var RepoTakendownError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoTakendownError = RepoTakendownError;
    var RepoSuspendedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoSuspendedError = RepoSuspendedError;
    var RepoDeactivatedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoDeactivatedError = RepoDeactivatedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "RepoNotFound")
          return new RepoNotFoundError(e);
        if (e.error === "RepoTakendown")
          return new RepoTakendownError(e);
        if (e.error === "RepoSuspended")
          return new RepoSuspendedError(e);
        if (e.error === "RepoDeactivated")
          return new RepoDeactivatedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/getRecord.js
var require_getRecord2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/getRecord.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RepoDeactivatedError = exports.RepoSuspendedError = exports.RepoTakendownError = exports.RepoNotFoundError = exports.RecordNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var RecordNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RecordNotFoundError = RecordNotFoundError;
    var RepoNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoNotFoundError = RepoNotFoundError;
    var RepoTakendownError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoTakendownError = RepoTakendownError;
    var RepoSuspendedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoSuspendedError = RepoSuspendedError;
    var RepoDeactivatedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoDeactivatedError = RepoDeactivatedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "RecordNotFound")
          return new RecordNotFoundError(e);
        if (e.error === "RepoNotFound")
          return new RepoNotFoundError(e);
        if (e.error === "RepoTakendown")
          return new RepoTakendownError(e);
        if (e.error === "RepoSuspended")
          return new RepoSuspendedError(e);
        if (e.error === "RepoDeactivated")
          return new RepoDeactivatedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/getRepo.js
var require_getRepo = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/getRepo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RepoDeactivatedError = exports.RepoSuspendedError = exports.RepoTakendownError = exports.RepoNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var RepoNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoNotFoundError = RepoNotFoundError;
    var RepoTakendownError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoTakendownError = RepoTakendownError;
    var RepoSuspendedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoSuspendedError = RepoSuspendedError;
    var RepoDeactivatedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoDeactivatedError = RepoDeactivatedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "RepoNotFound")
          return new RepoNotFoundError(e);
        if (e.error === "RepoTakendown")
          return new RepoTakendownError(e);
        if (e.error === "RepoSuspended")
          return new RepoSuspendedError(e);
        if (e.error === "RepoDeactivated")
          return new RepoDeactivatedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/getRepoStatus.js
var require_getRepoStatus = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/getRepoStatus.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RepoNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var RepoNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoNotFoundError = RepoNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "RepoNotFound")
          return new RepoNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/listBlobs.js
var require_listBlobs = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/listBlobs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RepoDeactivatedError = exports.RepoSuspendedError = exports.RepoTakendownError = exports.RepoNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var RepoNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoNotFoundError = RepoNotFoundError;
    var RepoTakendownError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoTakendownError = RepoTakendownError;
    var RepoSuspendedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoSuspendedError = RepoSuspendedError;
    var RepoDeactivatedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoDeactivatedError = RepoDeactivatedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "RepoNotFound")
          return new RepoNotFoundError(e);
        if (e.error === "RepoTakendown")
          return new RepoTakendownError(e);
        if (e.error === "RepoSuspended")
          return new RepoSuspendedError(e);
        if (e.error === "RepoDeactivated")
          return new RepoDeactivatedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/requestCrawl.js
var require_requestCrawl = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/requestCrawl.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.HostBannedError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var HostBannedError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.HostBannedError = HostBannedError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "HostBanned")
          return new HostBannedError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/temp/checkHandleAvailability.js
var require_checkHandleAvailability = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/temp/checkHandleAvailability.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidEmailError = void 0;
    exports.toKnownErr = toKnownErr;
    exports.isResultAvailable = isResultAvailable;
    exports.validateResultAvailable = validateResultAvailable;
    exports.isResultUnavailable = isResultUnavailable;
    exports.validateResultUnavailable = validateResultUnavailable;
    exports.isSuggestion = isSuggestion;
    exports.validateSuggestion = validateSuggestion;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.temp.checkHandleAvailability";
    var InvalidEmailError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidEmailError = InvalidEmailError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "InvalidEmail")
          return new InvalidEmailError(e);
      }
      return e;
    }
    var hashResultAvailable = "resultAvailable";
    function isResultAvailable(v) {
      return is$typed(v, id, hashResultAvailable);
    }
    function validateResultAvailable(v) {
      return validate(v, id, hashResultAvailable);
    }
    var hashResultUnavailable = "resultUnavailable";
    function isResultUnavailable(v) {
      return is$typed(v, id, hashResultUnavailable);
    }
    function validateResultUnavailable(v) {
      return validate(v, id, hashResultUnavailable);
    }
    var hashSuggestion = "suggestion";
    function isSuggestion(v) {
      return is$typed(v, id, hashSuggestion);
    }
    function validateSuggestion(v) {
      return validate(v, id, hashSuggestion);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/temp/dereferenceScope.js
var require_dereferenceScope = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/temp/dereferenceScope.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidScopeReferenceError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var InvalidScopeReferenceError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidScopeReferenceError = InvalidScopeReferenceError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "InvalidScopeReference")
          return new InvalidScopeReferenceError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/communication/createTemplate.js
var require_createTemplate = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/communication/createTemplate.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DuplicateTemplateNameError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var DuplicateTemplateNameError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.DuplicateTemplateNameError = DuplicateTemplateNameError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "DuplicateTemplateName")
          return new DuplicateTemplateNameError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/communication/updateTemplate.js
var require_updateTemplate = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/communication/updateTemplate.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DuplicateTemplateNameError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var DuplicateTemplateNameError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.DuplicateTemplateNameError = DuplicateTemplateNameError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "DuplicateTemplateName")
          return new DuplicateTemplateNameError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/emitEvent.js
var require_emitEvent = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/emitEvent.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DuplicateExternalIdError = exports.SubjectHasActionError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var SubjectHasActionError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.SubjectHasActionError = SubjectHasActionError;
    var DuplicateExternalIdError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.DuplicateExternalIdError = DuplicateExternalIdError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "SubjectHasAction")
          return new SubjectHasActionError(e);
        if (e.error === "DuplicateExternalId")
          return new DuplicateExternalIdError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getAccountTimeline.js
var require_getAccountTimeline = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getAccountTimeline.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RepoNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    exports.isTimelineItem = isTimelineItem;
    exports.validateTimelineItem = validateTimelineItem;
    exports.isTimelineItemSummary = isTimelineItemSummary;
    exports.validateTimelineItemSummary = validateTimelineItemSummary;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.moderation.getAccountTimeline";
    var RepoNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoNotFoundError = RepoNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "RepoNotFound")
          return new RepoNotFoundError(e);
      }
      return e;
    }
    var hashTimelineItem = "timelineItem";
    function isTimelineItem(v) {
      return is$typed(v, id, hashTimelineItem);
    }
    function validateTimelineItem(v) {
      return validate(v, id, hashTimelineItem);
    }
    var hashTimelineItemSummary = "timelineItemSummary";
    function isTimelineItemSummary(v) {
      return is$typed(v, id, hashTimelineItemSummary);
    }
    function validateTimelineItemSummary(v) {
      return validate(v, id, hashTimelineItemSummary);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getRecord.js
var require_getRecord3 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getRecord.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RecordNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var RecordNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RecordNotFoundError = RecordNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "RecordNotFound")
          return new RecordNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getRepo.js
var require_getRepo2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getRepo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RepoNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var RepoNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RepoNotFoundError = RepoNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "RepoNotFound")
          return new RepoNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/addRule.js
var require_addRule = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/addRule.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RuleAlreadyExistsError = exports.InvalidUrlError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var InvalidUrlError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.InvalidUrlError = InvalidUrlError;
    var RuleAlreadyExistsError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RuleAlreadyExistsError = RuleAlreadyExistsError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "InvalidUrl")
          return new InvalidUrlError(e);
        if (e.error === "RuleAlreadyExists")
          return new RuleAlreadyExistsError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/removeRule.js
var require_removeRule = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/removeRule.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RuleNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var RuleNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RuleNotFoundError = RuleNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "RuleNotFound")
          return new RuleNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/updateRule.js
var require_updateRule = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/updateRule.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RuleNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var RuleNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.RuleNotFoundError = RuleNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "RuleNotFound")
          return new RuleNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/set/deleteSet.js
var require_deleteSet = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/set/deleteSet.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.SetNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var SetNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.SetNotFoundError = SetNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "SetNotFound")
          return new SetNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/set/deleteValues.js
var require_deleteValues = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/set/deleteValues.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.SetNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var SetNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.SetNotFoundError = SetNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "SetNotFound")
          return new SetNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/set/getValues.js
var require_getValues = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/set/getValues.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.SetNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var SetNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.SetNotFoundError = SetNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "SetNotFound")
          return new SetNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/team/addMember.js
var require_addMember = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/team/addMember.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.MemberAlreadyExistsError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var MemberAlreadyExistsError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.MemberAlreadyExistsError = MemberAlreadyExistsError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "MemberAlreadyExists")
          return new MemberAlreadyExistsError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/team/deleteMember.js
var require_deleteMember = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/team/deleteMember.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.CannotDeleteSelfError = exports.MemberNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var MemberNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.MemberNotFoundError = MemberNotFoundError;
    var CannotDeleteSelfError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.CannotDeleteSelfError = CannotDeleteSelfError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "MemberNotFound")
          return new MemberNotFoundError(e);
        if (e.error === "CannotDeleteSelf")
          return new CannotDeleteSelfError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/team/updateMember.js
var require_updateMember = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/team/updateMember.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.MemberNotFoundError = void 0;
    exports.toKnownErr = toKnownErr;
    var xrpc_1 = require_dist10();
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var MemberNotFoundError = class extends xrpc_1.XRPCError {
      constructor(src2) {
        super(src2.status, src2.error, src2.message, src2.headers, { cause: src2 });
      }
    };
    exports.MemberNotFoundError = MemberNotFoundError;
    function toKnownErr(e) {
      if (e instanceof xrpc_1.XRPCError) {
        if (e.error === "MemberNotFound")
          return new MemberNotFoundError(e);
      }
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/actor/defs.js
var require_defs = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/actor/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isProfileViewBasic = isProfileViewBasic;
    exports.validateProfileViewBasic = validateProfileViewBasic;
    exports.isProfileView = isProfileView;
    exports.validateProfileView = validateProfileView;
    exports.isProfileViewDetailed = isProfileViewDetailed;
    exports.validateProfileViewDetailed = validateProfileViewDetailed;
    exports.isProfileAssociated = isProfileAssociated;
    exports.validateProfileAssociated = validateProfileAssociated;
    exports.isProfileAssociatedChat = isProfileAssociatedChat;
    exports.validateProfileAssociatedChat = validateProfileAssociatedChat;
    exports.isProfileAssociatedActivitySubscription = isProfileAssociatedActivitySubscription;
    exports.validateProfileAssociatedActivitySubscription = validateProfileAssociatedActivitySubscription;
    exports.isViewerState = isViewerState;
    exports.validateViewerState = validateViewerState;
    exports.isKnownFollowers = isKnownFollowers;
    exports.validateKnownFollowers = validateKnownFollowers;
    exports.isVerificationState = isVerificationState;
    exports.validateVerificationState = validateVerificationState;
    exports.isVerificationView = isVerificationView;
    exports.validateVerificationView = validateVerificationView;
    exports.isAdultContentPref = isAdultContentPref;
    exports.validateAdultContentPref = validateAdultContentPref;
    exports.isContentLabelPref = isContentLabelPref;
    exports.validateContentLabelPref = validateContentLabelPref;
    exports.isSavedFeed = isSavedFeed;
    exports.validateSavedFeed = validateSavedFeed;
    exports.isSavedFeedsPrefV2 = isSavedFeedsPrefV2;
    exports.validateSavedFeedsPrefV2 = validateSavedFeedsPrefV2;
    exports.isSavedFeedsPref = isSavedFeedsPref;
    exports.validateSavedFeedsPref = validateSavedFeedsPref;
    exports.isPersonalDetailsPref = isPersonalDetailsPref;
    exports.validatePersonalDetailsPref = validatePersonalDetailsPref;
    exports.isFeedViewPref = isFeedViewPref;
    exports.validateFeedViewPref = validateFeedViewPref;
    exports.isThreadViewPref = isThreadViewPref;
    exports.validateThreadViewPref = validateThreadViewPref;
    exports.isInterestsPref = isInterestsPref;
    exports.validateInterestsPref = validateInterestsPref;
    exports.isMutedWord = isMutedWord;
    exports.validateMutedWord = validateMutedWord;
    exports.isMutedWordsPref = isMutedWordsPref;
    exports.validateMutedWordsPref = validateMutedWordsPref;
    exports.isHiddenPostsPref = isHiddenPostsPref;
    exports.validateHiddenPostsPref = validateHiddenPostsPref;
    exports.isLabelersPref = isLabelersPref;
    exports.validateLabelersPref = validateLabelersPref;
    exports.isLabelerPrefItem = isLabelerPrefItem;
    exports.validateLabelerPrefItem = validateLabelerPrefItem;
    exports.isBskyAppStatePref = isBskyAppStatePref;
    exports.validateBskyAppStatePref = validateBskyAppStatePref;
    exports.isBskyAppProgressGuide = isBskyAppProgressGuide;
    exports.validateBskyAppProgressGuide = validateBskyAppProgressGuide;
    exports.isNux = isNux;
    exports.validateNux = validateNux;
    exports.isVerificationPrefs = isVerificationPrefs;
    exports.validateVerificationPrefs = validateVerificationPrefs;
    exports.isPostInteractionSettingsPref = isPostInteractionSettingsPref;
    exports.validatePostInteractionSettingsPref = validatePostInteractionSettingsPref;
    exports.isStatusView = isStatusView;
    exports.validateStatusView = validateStatusView;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.actor.defs";
    var hashProfileViewBasic = "profileViewBasic";
    function isProfileViewBasic(v) {
      return is$typed(v, id, hashProfileViewBasic);
    }
    function validateProfileViewBasic(v) {
      return validate(v, id, hashProfileViewBasic);
    }
    var hashProfileView = "profileView";
    function isProfileView(v) {
      return is$typed(v, id, hashProfileView);
    }
    function validateProfileView(v) {
      return validate(v, id, hashProfileView);
    }
    var hashProfileViewDetailed = "profileViewDetailed";
    function isProfileViewDetailed(v) {
      return is$typed(v, id, hashProfileViewDetailed);
    }
    function validateProfileViewDetailed(v) {
      return validate(v, id, hashProfileViewDetailed);
    }
    var hashProfileAssociated = "profileAssociated";
    function isProfileAssociated(v) {
      return is$typed(v, id, hashProfileAssociated);
    }
    function validateProfileAssociated(v) {
      return validate(v, id, hashProfileAssociated);
    }
    var hashProfileAssociatedChat = "profileAssociatedChat";
    function isProfileAssociatedChat(v) {
      return is$typed(v, id, hashProfileAssociatedChat);
    }
    function validateProfileAssociatedChat(v) {
      return validate(v, id, hashProfileAssociatedChat);
    }
    var hashProfileAssociatedActivitySubscription = "profileAssociatedActivitySubscription";
    function isProfileAssociatedActivitySubscription(v) {
      return is$typed(v, id, hashProfileAssociatedActivitySubscription);
    }
    function validateProfileAssociatedActivitySubscription(v) {
      return validate(v, id, hashProfileAssociatedActivitySubscription);
    }
    var hashViewerState = "viewerState";
    function isViewerState(v) {
      return is$typed(v, id, hashViewerState);
    }
    function validateViewerState(v) {
      return validate(v, id, hashViewerState);
    }
    var hashKnownFollowers = "knownFollowers";
    function isKnownFollowers(v) {
      return is$typed(v, id, hashKnownFollowers);
    }
    function validateKnownFollowers(v) {
      return validate(v, id, hashKnownFollowers);
    }
    var hashVerificationState = "verificationState";
    function isVerificationState(v) {
      return is$typed(v, id, hashVerificationState);
    }
    function validateVerificationState(v) {
      return validate(v, id, hashVerificationState);
    }
    var hashVerificationView = "verificationView";
    function isVerificationView(v) {
      return is$typed(v, id, hashVerificationView);
    }
    function validateVerificationView(v) {
      return validate(v, id, hashVerificationView);
    }
    var hashAdultContentPref = "adultContentPref";
    function isAdultContentPref(v) {
      return is$typed(v, id, hashAdultContentPref);
    }
    function validateAdultContentPref(v) {
      return validate(v, id, hashAdultContentPref);
    }
    var hashContentLabelPref = "contentLabelPref";
    function isContentLabelPref(v) {
      return is$typed(v, id, hashContentLabelPref);
    }
    function validateContentLabelPref(v) {
      return validate(v, id, hashContentLabelPref);
    }
    var hashSavedFeed = "savedFeed";
    function isSavedFeed(v) {
      return is$typed(v, id, hashSavedFeed);
    }
    function validateSavedFeed(v) {
      return validate(v, id, hashSavedFeed);
    }
    var hashSavedFeedsPrefV2 = "savedFeedsPrefV2";
    function isSavedFeedsPrefV2(v) {
      return is$typed(v, id, hashSavedFeedsPrefV2);
    }
    function validateSavedFeedsPrefV2(v) {
      return validate(v, id, hashSavedFeedsPrefV2);
    }
    var hashSavedFeedsPref = "savedFeedsPref";
    function isSavedFeedsPref(v) {
      return is$typed(v, id, hashSavedFeedsPref);
    }
    function validateSavedFeedsPref(v) {
      return validate(v, id, hashSavedFeedsPref);
    }
    var hashPersonalDetailsPref = "personalDetailsPref";
    function isPersonalDetailsPref(v) {
      return is$typed(v, id, hashPersonalDetailsPref);
    }
    function validatePersonalDetailsPref(v) {
      return validate(v, id, hashPersonalDetailsPref);
    }
    var hashFeedViewPref = "feedViewPref";
    function isFeedViewPref(v) {
      return is$typed(v, id, hashFeedViewPref);
    }
    function validateFeedViewPref(v) {
      return validate(v, id, hashFeedViewPref);
    }
    var hashThreadViewPref = "threadViewPref";
    function isThreadViewPref(v) {
      return is$typed(v, id, hashThreadViewPref);
    }
    function validateThreadViewPref(v) {
      return validate(v, id, hashThreadViewPref);
    }
    var hashInterestsPref = "interestsPref";
    function isInterestsPref(v) {
      return is$typed(v, id, hashInterestsPref);
    }
    function validateInterestsPref(v) {
      return validate(v, id, hashInterestsPref);
    }
    var hashMutedWord = "mutedWord";
    function isMutedWord(v) {
      return is$typed(v, id, hashMutedWord);
    }
    function validateMutedWord(v) {
      return validate(v, id, hashMutedWord);
    }
    var hashMutedWordsPref = "mutedWordsPref";
    function isMutedWordsPref(v) {
      return is$typed(v, id, hashMutedWordsPref);
    }
    function validateMutedWordsPref(v) {
      return validate(v, id, hashMutedWordsPref);
    }
    var hashHiddenPostsPref = "hiddenPostsPref";
    function isHiddenPostsPref(v) {
      return is$typed(v, id, hashHiddenPostsPref);
    }
    function validateHiddenPostsPref(v) {
      return validate(v, id, hashHiddenPostsPref);
    }
    var hashLabelersPref = "labelersPref";
    function isLabelersPref(v) {
      return is$typed(v, id, hashLabelersPref);
    }
    function validateLabelersPref(v) {
      return validate(v, id, hashLabelersPref);
    }
    var hashLabelerPrefItem = "labelerPrefItem";
    function isLabelerPrefItem(v) {
      return is$typed(v, id, hashLabelerPrefItem);
    }
    function validateLabelerPrefItem(v) {
      return validate(v, id, hashLabelerPrefItem);
    }
    var hashBskyAppStatePref = "bskyAppStatePref";
    function isBskyAppStatePref(v) {
      return is$typed(v, id, hashBskyAppStatePref);
    }
    function validateBskyAppStatePref(v) {
      return validate(v, id, hashBskyAppStatePref);
    }
    var hashBskyAppProgressGuide = "bskyAppProgressGuide";
    function isBskyAppProgressGuide(v) {
      return is$typed(v, id, hashBskyAppProgressGuide);
    }
    function validateBskyAppProgressGuide(v) {
      return validate(v, id, hashBskyAppProgressGuide);
    }
    var hashNux = "nux";
    function isNux(v) {
      return is$typed(v, id, hashNux);
    }
    function validateNux(v) {
      return validate(v, id, hashNux);
    }
    var hashVerificationPrefs = "verificationPrefs";
    function isVerificationPrefs(v) {
      return is$typed(v, id, hashVerificationPrefs);
    }
    function validateVerificationPrefs(v) {
      return validate(v, id, hashVerificationPrefs);
    }
    var hashPostInteractionSettingsPref = "postInteractionSettingsPref";
    function isPostInteractionSettingsPref(v) {
      return is$typed(v, id, hashPostInteractionSettingsPref);
    }
    function validatePostInteractionSettingsPref(v) {
      return validate(v, id, hashPostInteractionSettingsPref);
    }
    var hashStatusView = "statusView";
    function isStatusView(v) {
      return is$typed(v, id, hashStatusView);
    }
    function validateStatusView(v) {
      return validate(v, id, hashStatusView);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/actor/getPreferences.js
var require_getPreferences = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/actor/getPreferences.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/actor/getProfile.js
var require_getProfile = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/actor/getProfile.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/actor/getProfiles.js
var require_getProfiles = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/actor/getProfiles.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/actor/getSuggestions.js
var require_getSuggestions = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/actor/getSuggestions.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/actor/profile.js
var require_profile = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/actor/profile.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.actor.profile";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/actor/putPreferences.js
var require_putPreferences = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/actor/putPreferences.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/actor/searchActors.js
var require_searchActors = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/actor/searchActors.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/actor/searchActorsTypeahead.js
var require_searchActorsTypeahead = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/actor/searchActorsTypeahead.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/actor/status.js
var require_status = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/actor/status.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.LIVE = void 0;
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.actor.status";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
    exports.LIVE = `${id}#live`;
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/bookmark/defs.js
var require_defs2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/bookmark/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isBookmark = isBookmark;
    exports.validateBookmark = validateBookmark;
    exports.isBookmarkView = isBookmarkView;
    exports.validateBookmarkView = validateBookmarkView;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.bookmark.defs";
    var hashBookmark = "bookmark";
    function isBookmark(v) {
      return is$typed(v, id, hashBookmark);
    }
    function validateBookmark(v) {
      return validate(v, id, hashBookmark);
    }
    var hashBookmarkView = "bookmarkView";
    function isBookmarkView(v) {
      return is$typed(v, id, hashBookmarkView);
    }
    function validateBookmarkView(v) {
      return validate(v, id, hashBookmarkView);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/bookmark/getBookmarks.js
var require_getBookmarks = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/bookmark/getBookmarks.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/embed/defs.js
var require_defs3 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/embed/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isAspectRatio = isAspectRatio;
    exports.validateAspectRatio = validateAspectRatio;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.embed.defs";
    var hashAspectRatio = "aspectRatio";
    function isAspectRatio(v) {
      return is$typed(v, id, hashAspectRatio);
    }
    function validateAspectRatio(v) {
      return validate(v, id, hashAspectRatio);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/embed/external.js
var require_external2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/embed/external.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isMain = isMain;
    exports.validateMain = validateMain;
    exports.isExternal = isExternal;
    exports.validateExternal = validateExternal;
    exports.isView = isView;
    exports.validateView = validateView;
    exports.isViewExternal = isViewExternal;
    exports.validateViewExternal = validateViewExternal;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.embed.external";
    var hashMain = "main";
    function isMain(v) {
      return is$typed(v, id, hashMain);
    }
    function validateMain(v) {
      return validate(v, id, hashMain);
    }
    var hashExternal = "external";
    function isExternal(v) {
      return is$typed(v, id, hashExternal);
    }
    function validateExternal(v) {
      return validate(v, id, hashExternal);
    }
    var hashView = "view";
    function isView(v) {
      return is$typed(v, id, hashView);
    }
    function validateView(v) {
      return validate(v, id, hashView);
    }
    var hashViewExternal = "viewExternal";
    function isViewExternal(v) {
      return is$typed(v, id, hashViewExternal);
    }
    function validateViewExternal(v) {
      return validate(v, id, hashViewExternal);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/embed/images.js
var require_images = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/embed/images.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isMain = isMain;
    exports.validateMain = validateMain;
    exports.isImage = isImage;
    exports.validateImage = validateImage;
    exports.isView = isView;
    exports.validateView = validateView;
    exports.isViewImage = isViewImage;
    exports.validateViewImage = validateViewImage;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.embed.images";
    var hashMain = "main";
    function isMain(v) {
      return is$typed(v, id, hashMain);
    }
    function validateMain(v) {
      return validate(v, id, hashMain);
    }
    var hashImage = "image";
    function isImage(v) {
      return is$typed(v, id, hashImage);
    }
    function validateImage(v) {
      return validate(v, id, hashImage);
    }
    var hashView = "view";
    function isView(v) {
      return is$typed(v, id, hashView);
    }
    function validateView(v) {
      return validate(v, id, hashView);
    }
    var hashViewImage = "viewImage";
    function isViewImage(v) {
      return is$typed(v, id, hashViewImage);
    }
    function validateViewImage(v) {
      return validate(v, id, hashViewImage);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/embed/record.js
var require_record = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/embed/record.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isMain = isMain;
    exports.validateMain = validateMain;
    exports.isView = isView;
    exports.validateView = validateView;
    exports.isViewRecord = isViewRecord;
    exports.validateViewRecord = validateViewRecord;
    exports.isViewNotFound = isViewNotFound;
    exports.validateViewNotFound = validateViewNotFound;
    exports.isViewBlocked = isViewBlocked;
    exports.validateViewBlocked = validateViewBlocked;
    exports.isViewDetached = isViewDetached;
    exports.validateViewDetached = validateViewDetached;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.embed.record";
    var hashMain = "main";
    function isMain(v) {
      return is$typed(v, id, hashMain);
    }
    function validateMain(v) {
      return validate(v, id, hashMain);
    }
    var hashView = "view";
    function isView(v) {
      return is$typed(v, id, hashView);
    }
    function validateView(v) {
      return validate(v, id, hashView);
    }
    var hashViewRecord = "viewRecord";
    function isViewRecord(v) {
      return is$typed(v, id, hashViewRecord);
    }
    function validateViewRecord(v) {
      return validate(v, id, hashViewRecord);
    }
    var hashViewNotFound = "viewNotFound";
    function isViewNotFound(v) {
      return is$typed(v, id, hashViewNotFound);
    }
    function validateViewNotFound(v) {
      return validate(v, id, hashViewNotFound);
    }
    var hashViewBlocked = "viewBlocked";
    function isViewBlocked(v) {
      return is$typed(v, id, hashViewBlocked);
    }
    function validateViewBlocked(v) {
      return validate(v, id, hashViewBlocked);
    }
    var hashViewDetached = "viewDetached";
    function isViewDetached(v) {
      return is$typed(v, id, hashViewDetached);
    }
    function validateViewDetached(v) {
      return validate(v, id, hashViewDetached);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/embed/recordWithMedia.js
var require_recordWithMedia = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/embed/recordWithMedia.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isMain = isMain;
    exports.validateMain = validateMain;
    exports.isView = isView;
    exports.validateView = validateView;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.embed.recordWithMedia";
    var hashMain = "main";
    function isMain(v) {
      return is$typed(v, id, hashMain);
    }
    function validateMain(v) {
      return validate(v, id, hashMain);
    }
    var hashView = "view";
    function isView(v) {
      return is$typed(v, id, hashView);
    }
    function validateView(v) {
      return validate(v, id, hashView);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/embed/video.js
var require_video = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/embed/video.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isMain = isMain;
    exports.validateMain = validateMain;
    exports.isCaption = isCaption;
    exports.validateCaption = validateCaption;
    exports.isView = isView;
    exports.validateView = validateView;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.embed.video";
    var hashMain = "main";
    function isMain(v) {
      return is$typed(v, id, hashMain);
    }
    function validateMain(v) {
      return validate(v, id, hashMain);
    }
    var hashCaption = "caption";
    function isCaption(v) {
      return is$typed(v, id, hashCaption);
    }
    function validateCaption(v) {
      return validate(v, id, hashCaption);
    }
    var hashView = "view";
    function isView(v) {
      return is$typed(v, id, hashView);
    }
    function validateView(v) {
      return validate(v, id, hashView);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/defs.js
var require_defs4 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.INTERACTIONSHARE = exports.INTERACTIONQUOTE = exports.INTERACTIONREPLY = exports.INTERACTIONREPOST = exports.INTERACTIONLIKE = exports.INTERACTIONSEEN = exports.CONTENTMODEVIDEO = exports.CONTENTMODEUNSPECIFIED = exports.CLICKTHROUGHEMBED = exports.CLICKTHROUGHREPOSTER = exports.CLICKTHROUGHAUTHOR = exports.CLICKTHROUGHITEM = exports.REQUESTMORE = exports.REQUESTLESS = void 0;
    exports.isPostView = isPostView;
    exports.validatePostView = validatePostView;
    exports.isViewerState = isViewerState;
    exports.validateViewerState = validateViewerState;
    exports.isThreadContext = isThreadContext;
    exports.validateThreadContext = validateThreadContext;
    exports.isFeedViewPost = isFeedViewPost;
    exports.validateFeedViewPost = validateFeedViewPost;
    exports.isReplyRef = isReplyRef;
    exports.validateReplyRef = validateReplyRef;
    exports.isReasonRepost = isReasonRepost;
    exports.validateReasonRepost = validateReasonRepost;
    exports.isReasonPin = isReasonPin;
    exports.validateReasonPin = validateReasonPin;
    exports.isThreadViewPost = isThreadViewPost;
    exports.validateThreadViewPost = validateThreadViewPost;
    exports.isNotFoundPost = isNotFoundPost;
    exports.validateNotFoundPost = validateNotFoundPost;
    exports.isBlockedPost = isBlockedPost;
    exports.validateBlockedPost = validateBlockedPost;
    exports.isBlockedAuthor = isBlockedAuthor;
    exports.validateBlockedAuthor = validateBlockedAuthor;
    exports.isGeneratorView = isGeneratorView;
    exports.validateGeneratorView = validateGeneratorView;
    exports.isGeneratorViewerState = isGeneratorViewerState;
    exports.validateGeneratorViewerState = validateGeneratorViewerState;
    exports.isSkeletonFeedPost = isSkeletonFeedPost;
    exports.validateSkeletonFeedPost = validateSkeletonFeedPost;
    exports.isSkeletonReasonRepost = isSkeletonReasonRepost;
    exports.validateSkeletonReasonRepost = validateSkeletonReasonRepost;
    exports.isSkeletonReasonPin = isSkeletonReasonPin;
    exports.validateSkeletonReasonPin = validateSkeletonReasonPin;
    exports.isThreadgateView = isThreadgateView;
    exports.validateThreadgateView = validateThreadgateView;
    exports.isInteraction = isInteraction;
    exports.validateInteraction = validateInteraction;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.feed.defs";
    var hashPostView = "postView";
    function isPostView(v) {
      return is$typed(v, id, hashPostView);
    }
    function validatePostView(v) {
      return validate(v, id, hashPostView);
    }
    var hashViewerState = "viewerState";
    function isViewerState(v) {
      return is$typed(v, id, hashViewerState);
    }
    function validateViewerState(v) {
      return validate(v, id, hashViewerState);
    }
    var hashThreadContext = "threadContext";
    function isThreadContext(v) {
      return is$typed(v, id, hashThreadContext);
    }
    function validateThreadContext(v) {
      return validate(v, id, hashThreadContext);
    }
    var hashFeedViewPost = "feedViewPost";
    function isFeedViewPost(v) {
      return is$typed(v, id, hashFeedViewPost);
    }
    function validateFeedViewPost(v) {
      return validate(v, id, hashFeedViewPost);
    }
    var hashReplyRef = "replyRef";
    function isReplyRef(v) {
      return is$typed(v, id, hashReplyRef);
    }
    function validateReplyRef(v) {
      return validate(v, id, hashReplyRef);
    }
    var hashReasonRepost = "reasonRepost";
    function isReasonRepost(v) {
      return is$typed(v, id, hashReasonRepost);
    }
    function validateReasonRepost(v) {
      return validate(v, id, hashReasonRepost);
    }
    var hashReasonPin = "reasonPin";
    function isReasonPin(v) {
      return is$typed(v, id, hashReasonPin);
    }
    function validateReasonPin(v) {
      return validate(v, id, hashReasonPin);
    }
    var hashThreadViewPost = "threadViewPost";
    function isThreadViewPost(v) {
      return is$typed(v, id, hashThreadViewPost);
    }
    function validateThreadViewPost(v) {
      return validate(v, id, hashThreadViewPost);
    }
    var hashNotFoundPost = "notFoundPost";
    function isNotFoundPost(v) {
      return is$typed(v, id, hashNotFoundPost);
    }
    function validateNotFoundPost(v) {
      return validate(v, id, hashNotFoundPost);
    }
    var hashBlockedPost = "blockedPost";
    function isBlockedPost(v) {
      return is$typed(v, id, hashBlockedPost);
    }
    function validateBlockedPost(v) {
      return validate(v, id, hashBlockedPost);
    }
    var hashBlockedAuthor = "blockedAuthor";
    function isBlockedAuthor(v) {
      return is$typed(v, id, hashBlockedAuthor);
    }
    function validateBlockedAuthor(v) {
      return validate(v, id, hashBlockedAuthor);
    }
    var hashGeneratorView = "generatorView";
    function isGeneratorView(v) {
      return is$typed(v, id, hashGeneratorView);
    }
    function validateGeneratorView(v) {
      return validate(v, id, hashGeneratorView);
    }
    var hashGeneratorViewerState = "generatorViewerState";
    function isGeneratorViewerState(v) {
      return is$typed(v, id, hashGeneratorViewerState);
    }
    function validateGeneratorViewerState(v) {
      return validate(v, id, hashGeneratorViewerState);
    }
    var hashSkeletonFeedPost = "skeletonFeedPost";
    function isSkeletonFeedPost(v) {
      return is$typed(v, id, hashSkeletonFeedPost);
    }
    function validateSkeletonFeedPost(v) {
      return validate(v, id, hashSkeletonFeedPost);
    }
    var hashSkeletonReasonRepost = "skeletonReasonRepost";
    function isSkeletonReasonRepost(v) {
      return is$typed(v, id, hashSkeletonReasonRepost);
    }
    function validateSkeletonReasonRepost(v) {
      return validate(v, id, hashSkeletonReasonRepost);
    }
    var hashSkeletonReasonPin = "skeletonReasonPin";
    function isSkeletonReasonPin(v) {
      return is$typed(v, id, hashSkeletonReasonPin);
    }
    function validateSkeletonReasonPin(v) {
      return validate(v, id, hashSkeletonReasonPin);
    }
    var hashThreadgateView = "threadgateView";
    function isThreadgateView(v) {
      return is$typed(v, id, hashThreadgateView);
    }
    function validateThreadgateView(v) {
      return validate(v, id, hashThreadgateView);
    }
    var hashInteraction = "interaction";
    function isInteraction(v) {
      return is$typed(v, id, hashInteraction);
    }
    function validateInteraction(v) {
      return validate(v, id, hashInteraction);
    }
    exports.REQUESTLESS = `${id}#requestLess`;
    exports.REQUESTMORE = `${id}#requestMore`;
    exports.CLICKTHROUGHITEM = `${id}#clickthroughItem`;
    exports.CLICKTHROUGHAUTHOR = `${id}#clickthroughAuthor`;
    exports.CLICKTHROUGHREPOSTER = `${id}#clickthroughReposter`;
    exports.CLICKTHROUGHEMBED = `${id}#clickthroughEmbed`;
    exports.CONTENTMODEUNSPECIFIED = `${id}#contentModeUnspecified`;
    exports.CONTENTMODEVIDEO = `${id}#contentModeVideo`;
    exports.INTERACTIONSEEN = `${id}#interactionSeen`;
    exports.INTERACTIONLIKE = `${id}#interactionLike`;
    exports.INTERACTIONREPOST = `${id}#interactionRepost`;
    exports.INTERACTIONREPLY = `${id}#interactionReply`;
    exports.INTERACTIONQUOTE = `${id}#interactionQuote`;
    exports.INTERACTIONSHARE = `${id}#interactionShare`;
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/describeFeedGenerator.js
var require_describeFeedGenerator = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/describeFeedGenerator.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isFeed = isFeed;
    exports.validateFeed = validateFeed;
    exports.isLinks = isLinks;
    exports.validateLinks = validateLinks;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.feed.describeFeedGenerator";
    function toKnownErr(e) {
      return e;
    }
    var hashFeed = "feed";
    function isFeed(v) {
      return is$typed(v, id, hashFeed);
    }
    function validateFeed(v) {
      return validate(v, id, hashFeed);
    }
    var hashLinks = "links";
    function isLinks(v) {
      return is$typed(v, id, hashLinks);
    }
    function validateLinks(v) {
      return validate(v, id, hashLinks);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/generator.js
var require_generator = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/generator.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.feed.generator";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getActorFeeds.js
var require_getActorFeeds = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getActorFeeds.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getFeedGenerator.js
var require_getFeedGenerator = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getFeedGenerator.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getFeedGenerators.js
var require_getFeedGenerators = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getFeedGenerators.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getLikes.js
var require_getLikes = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getLikes.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isLike = isLike;
    exports.validateLike = validateLike;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.feed.getLikes";
    function toKnownErr(e) {
      return e;
    }
    var hashLike = "like";
    function isLike(v) {
      return is$typed(v, id, hashLike);
    }
    function validateLike(v) {
      return validate(v, id, hashLike);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getPosts.js
var require_getPosts = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getPosts.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getQuotes.js
var require_getQuotes = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getQuotes.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getRepostedBy.js
var require_getRepostedBy = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getRepostedBy.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getSuggestedFeeds.js
var require_getSuggestedFeeds = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getSuggestedFeeds.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/getTimeline.js
var require_getTimeline = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/getTimeline.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/like.js
var require_like = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/like.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.feed.like";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/post.js
var require_post = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/post.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    exports.isReplyRef = isReplyRef;
    exports.validateReplyRef = validateReplyRef;
    exports.isEntity = isEntity;
    exports.validateEntity = validateEntity;
    exports.isTextSlice = isTextSlice;
    exports.validateTextSlice = validateTextSlice;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.feed.post";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
    var hashReplyRef = "replyRef";
    function isReplyRef(v) {
      return is$typed(v, id, hashReplyRef);
    }
    function validateReplyRef(v) {
      return validate(v, id, hashReplyRef);
    }
    var hashEntity = "entity";
    function isEntity(v) {
      return is$typed(v, id, hashEntity);
    }
    function validateEntity(v) {
      return validate(v, id, hashEntity);
    }
    var hashTextSlice = "textSlice";
    function isTextSlice(v) {
      return is$typed(v, id, hashTextSlice);
    }
    function validateTextSlice(v) {
      return validate(v, id, hashTextSlice);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/postgate.js
var require_postgate = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/postgate.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    exports.isDisableRule = isDisableRule;
    exports.validateDisableRule = validateDisableRule;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.feed.postgate";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
    var hashDisableRule = "disableRule";
    function isDisableRule(v) {
      return is$typed(v, id, hashDisableRule);
    }
    function validateDisableRule(v) {
      return validate(v, id, hashDisableRule);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/repost.js
var require_repost = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/repost.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.feed.repost";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/sendInteractions.js
var require_sendInteractions = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/sendInteractions.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/feed/threadgate.js
var require_threadgate = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/feed/threadgate.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    exports.isMentionRule = isMentionRule;
    exports.validateMentionRule = validateMentionRule;
    exports.isFollowerRule = isFollowerRule;
    exports.validateFollowerRule = validateFollowerRule;
    exports.isFollowingRule = isFollowingRule;
    exports.validateFollowingRule = validateFollowingRule;
    exports.isListRule = isListRule;
    exports.validateListRule = validateListRule;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.feed.threadgate";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
    var hashMentionRule = "mentionRule";
    function isMentionRule(v) {
      return is$typed(v, id, hashMentionRule);
    }
    function validateMentionRule(v) {
      return validate(v, id, hashMentionRule);
    }
    var hashFollowerRule = "followerRule";
    function isFollowerRule(v) {
      return is$typed(v, id, hashFollowerRule);
    }
    function validateFollowerRule(v) {
      return validate(v, id, hashFollowerRule);
    }
    var hashFollowingRule = "followingRule";
    function isFollowingRule(v) {
      return is$typed(v, id, hashFollowingRule);
    }
    function validateFollowingRule(v) {
      return validate(v, id, hashFollowingRule);
    }
    var hashListRule = "listRule";
    function isListRule(v) {
      return is$typed(v, id, hashListRule);
    }
    function validateListRule(v) {
      return validate(v, id, hashListRule);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/block.js
var require_block = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/block.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.graph.block";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/defs.js
var require_defs5 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.REFERENCELIST = exports.CURATELIST = exports.MODLIST = void 0;
    exports.isListViewBasic = isListViewBasic;
    exports.validateListViewBasic = validateListViewBasic;
    exports.isListView = isListView;
    exports.validateListView = validateListView;
    exports.isListItemView = isListItemView;
    exports.validateListItemView = validateListItemView;
    exports.isStarterPackView = isStarterPackView;
    exports.validateStarterPackView = validateStarterPackView;
    exports.isStarterPackViewBasic = isStarterPackViewBasic;
    exports.validateStarterPackViewBasic = validateStarterPackViewBasic;
    exports.isListViewerState = isListViewerState;
    exports.validateListViewerState = validateListViewerState;
    exports.isNotFoundActor = isNotFoundActor;
    exports.validateNotFoundActor = validateNotFoundActor;
    exports.isRelationship = isRelationship;
    exports.validateRelationship = validateRelationship;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.graph.defs";
    var hashListViewBasic = "listViewBasic";
    function isListViewBasic(v) {
      return is$typed(v, id, hashListViewBasic);
    }
    function validateListViewBasic(v) {
      return validate(v, id, hashListViewBasic);
    }
    var hashListView = "listView";
    function isListView(v) {
      return is$typed(v, id, hashListView);
    }
    function validateListView(v) {
      return validate(v, id, hashListView);
    }
    var hashListItemView = "listItemView";
    function isListItemView(v) {
      return is$typed(v, id, hashListItemView);
    }
    function validateListItemView(v) {
      return validate(v, id, hashListItemView);
    }
    var hashStarterPackView = "starterPackView";
    function isStarterPackView(v) {
      return is$typed(v, id, hashStarterPackView);
    }
    function validateStarterPackView(v) {
      return validate(v, id, hashStarterPackView);
    }
    var hashStarterPackViewBasic = "starterPackViewBasic";
    function isStarterPackViewBasic(v) {
      return is$typed(v, id, hashStarterPackViewBasic);
    }
    function validateStarterPackViewBasic(v) {
      return validate(v, id, hashStarterPackViewBasic);
    }
    exports.MODLIST = `${id}#modlist`;
    exports.CURATELIST = `${id}#curatelist`;
    exports.REFERENCELIST = `${id}#referencelist`;
    var hashListViewerState = "listViewerState";
    function isListViewerState(v) {
      return is$typed(v, id, hashListViewerState);
    }
    function validateListViewerState(v) {
      return validate(v, id, hashListViewerState);
    }
    var hashNotFoundActor = "notFoundActor";
    function isNotFoundActor(v) {
      return is$typed(v, id, hashNotFoundActor);
    }
    function validateNotFoundActor(v) {
      return validate(v, id, hashNotFoundActor);
    }
    var hashRelationship = "relationship";
    function isRelationship(v) {
      return is$typed(v, id, hashRelationship);
    }
    function validateRelationship(v) {
      return validate(v, id, hashRelationship);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/follow.js
var require_follow = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/follow.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.graph.follow";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getActorStarterPacks.js
var require_getActorStarterPacks = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getActorStarterPacks.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getBlocks.js
var require_getBlocks2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getBlocks.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getFollowers.js
var require_getFollowers = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getFollowers.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getFollows.js
var require_getFollows = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getFollows.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getKnownFollowers.js
var require_getKnownFollowers = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getKnownFollowers.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getList.js
var require_getList = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getList.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getListBlocks.js
var require_getListBlocks = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getListBlocks.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getListMutes.js
var require_getListMutes = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getListMutes.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getLists.js
var require_getLists = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getLists.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getListsWithMembership.js
var require_getListsWithMembership = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getListsWithMembership.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isListWithMembership = isListWithMembership;
    exports.validateListWithMembership = validateListWithMembership;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.graph.getListsWithMembership";
    function toKnownErr(e) {
      return e;
    }
    var hashListWithMembership = "listWithMembership";
    function isListWithMembership(v) {
      return is$typed(v, id, hashListWithMembership);
    }
    function validateListWithMembership(v) {
      return validate(v, id, hashListWithMembership);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getMutes.js
var require_getMutes = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getMutes.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getStarterPack.js
var require_getStarterPack = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getStarterPack.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getStarterPacks.js
var require_getStarterPacks = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getStarterPacks.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getStarterPacksWithMembership.js
var require_getStarterPacksWithMembership = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getStarterPacksWithMembership.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isStarterPackWithMembership = isStarterPackWithMembership;
    exports.validateStarterPackWithMembership = validateStarterPackWithMembership;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.graph.getStarterPacksWithMembership";
    function toKnownErr(e) {
      return e;
    }
    var hashStarterPackWithMembership = "starterPackWithMembership";
    function isStarterPackWithMembership(v) {
      return is$typed(v, id, hashStarterPackWithMembership);
    }
    function validateStarterPackWithMembership(v) {
      return validate(v, id, hashStarterPackWithMembership);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.js
var require_getSuggestedFollowsByActor = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/getSuggestedFollowsByActor.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/list.js
var require_list = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/list.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.graph.list";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/listblock.js
var require_listblock = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/listblock.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.graph.listblock";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/listitem.js
var require_listitem = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/listitem.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.graph.listitem";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/muteActor.js
var require_muteActor = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/muteActor.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/muteActorList.js
var require_muteActorList = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/muteActorList.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/muteThread.js
var require_muteThread = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/muteThread.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/searchStarterPacks.js
var require_searchStarterPacks = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/searchStarterPacks.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/starterpack.js
var require_starterpack = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/starterpack.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    exports.isFeedItem = isFeedItem;
    exports.validateFeedItem = validateFeedItem;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.graph.starterpack";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
    var hashFeedItem = "feedItem";
    function isFeedItem(v) {
      return is$typed(v, id, hashFeedItem);
    }
    function validateFeedItem(v) {
      return validate(v, id, hashFeedItem);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/unmuteActor.js
var require_unmuteActor = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/unmuteActor.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/unmuteActorList.js
var require_unmuteActorList = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/unmuteActorList.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/unmuteThread.js
var require_unmuteThread = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/unmuteThread.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/graph/verification.js
var require_verification = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/graph/verification.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.graph.verification";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/labeler/defs.js
var require_defs6 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/labeler/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isLabelerView = isLabelerView;
    exports.validateLabelerView = validateLabelerView;
    exports.isLabelerViewDetailed = isLabelerViewDetailed;
    exports.validateLabelerViewDetailed = validateLabelerViewDetailed;
    exports.isLabelerViewerState = isLabelerViewerState;
    exports.validateLabelerViewerState = validateLabelerViewerState;
    exports.isLabelerPolicies = isLabelerPolicies;
    exports.validateLabelerPolicies = validateLabelerPolicies;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.labeler.defs";
    var hashLabelerView = "labelerView";
    function isLabelerView(v) {
      return is$typed(v, id, hashLabelerView);
    }
    function validateLabelerView(v) {
      return validate(v, id, hashLabelerView);
    }
    var hashLabelerViewDetailed = "labelerViewDetailed";
    function isLabelerViewDetailed(v) {
      return is$typed(v, id, hashLabelerViewDetailed);
    }
    function validateLabelerViewDetailed(v) {
      return validate(v, id, hashLabelerViewDetailed);
    }
    var hashLabelerViewerState = "labelerViewerState";
    function isLabelerViewerState(v) {
      return is$typed(v, id, hashLabelerViewerState);
    }
    function validateLabelerViewerState(v) {
      return validate(v, id, hashLabelerViewerState);
    }
    var hashLabelerPolicies = "labelerPolicies";
    function isLabelerPolicies(v) {
      return is$typed(v, id, hashLabelerPolicies);
    }
    function validateLabelerPolicies(v) {
      return validate(v, id, hashLabelerPolicies);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/labeler/getServices.js
var require_getServices = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/labeler/getServices.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/labeler/service.js
var require_service = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/labeler/service.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.labeler.service";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/declaration.js
var require_declaration = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/declaration.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.notification.declaration";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/defs.js
var require_defs7 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecordDeleted = isRecordDeleted;
    exports.validateRecordDeleted = validateRecordDeleted;
    exports.isChatPreference = isChatPreference;
    exports.validateChatPreference = validateChatPreference;
    exports.isFilterablePreference = isFilterablePreference;
    exports.validateFilterablePreference = validateFilterablePreference;
    exports.isPreference = isPreference;
    exports.validatePreference = validatePreference;
    exports.isPreferences = isPreferences;
    exports.validatePreferences = validatePreferences;
    exports.isActivitySubscription = isActivitySubscription;
    exports.validateActivitySubscription = validateActivitySubscription;
    exports.isSubjectActivitySubscription = isSubjectActivitySubscription;
    exports.validateSubjectActivitySubscription = validateSubjectActivitySubscription;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.notification.defs";
    var hashRecordDeleted = "recordDeleted";
    function isRecordDeleted(v) {
      return is$typed(v, id, hashRecordDeleted);
    }
    function validateRecordDeleted(v) {
      return validate(v, id, hashRecordDeleted);
    }
    var hashChatPreference = "chatPreference";
    function isChatPreference(v) {
      return is$typed(v, id, hashChatPreference);
    }
    function validateChatPreference(v) {
      return validate(v, id, hashChatPreference);
    }
    var hashFilterablePreference = "filterablePreference";
    function isFilterablePreference(v) {
      return is$typed(v, id, hashFilterablePreference);
    }
    function validateFilterablePreference(v) {
      return validate(v, id, hashFilterablePreference);
    }
    var hashPreference = "preference";
    function isPreference(v) {
      return is$typed(v, id, hashPreference);
    }
    function validatePreference(v) {
      return validate(v, id, hashPreference);
    }
    var hashPreferences = "preferences";
    function isPreferences(v) {
      return is$typed(v, id, hashPreferences);
    }
    function validatePreferences(v) {
      return validate(v, id, hashPreferences);
    }
    var hashActivitySubscription = "activitySubscription";
    function isActivitySubscription(v) {
      return is$typed(v, id, hashActivitySubscription);
    }
    function validateActivitySubscription(v) {
      return validate(v, id, hashActivitySubscription);
    }
    var hashSubjectActivitySubscription = "subjectActivitySubscription";
    function isSubjectActivitySubscription(v) {
      return is$typed(v, id, hashSubjectActivitySubscription);
    }
    function validateSubjectActivitySubscription(v) {
      return validate(v, id, hashSubjectActivitySubscription);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/getPreferences.js
var require_getPreferences2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/getPreferences.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/getUnreadCount.js
var require_getUnreadCount = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/getUnreadCount.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/listActivitySubscriptions.js
var require_listActivitySubscriptions = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/listActivitySubscriptions.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/listNotifications.js
var require_listNotifications = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/listNotifications.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isNotification = isNotification;
    exports.validateNotification = validateNotification;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.notification.listNotifications";
    function toKnownErr(e) {
      return e;
    }
    var hashNotification = "notification";
    function isNotification(v) {
      return is$typed(v, id, hashNotification);
    }
    function validateNotification(v) {
      return validate(v, id, hashNotification);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/putActivitySubscription.js
var require_putActivitySubscription = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/putActivitySubscription.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/putPreferences.js
var require_putPreferences2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/putPreferences.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/putPreferencesV2.js
var require_putPreferencesV2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/putPreferencesV2.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/registerPush.js
var require_registerPush = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/registerPush.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/unregisterPush.js
var require_unregisterPush = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/unregisterPush.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/notification/updateSeen.js
var require_updateSeen = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/notification/updateSeen.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/richtext/facet.js
var require_facet = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/richtext/facet.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isMain = isMain;
    exports.validateMain = validateMain;
    exports.isMention = isMention;
    exports.validateMention = validateMention;
    exports.isLink = isLink;
    exports.validateLink = validateLink;
    exports.isTag = isTag;
    exports.validateTag = validateTag;
    exports.isByteSlice = isByteSlice;
    exports.validateByteSlice = validateByteSlice;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.richtext.facet";
    var hashMain = "main";
    function isMain(v) {
      return is$typed(v, id, hashMain);
    }
    function validateMain(v) {
      return validate(v, id, hashMain);
    }
    var hashMention = "mention";
    function isMention(v) {
      return is$typed(v, id, hashMention);
    }
    function validateMention(v) {
      return validate(v, id, hashMention);
    }
    var hashLink = "link";
    function isLink(v) {
      return is$typed(v, id, hashLink);
    }
    function validateLink(v) {
      return validate(v, id, hashLink);
    }
    var hashTag = "tag";
    function isTag(v) {
      return is$typed(v, id, hashTag);
    }
    function validateTag(v) {
      return validate(v, id, hashTag);
    }
    var hashByteSlice = "byteSlice";
    function isByteSlice(v) {
      return is$typed(v, id, hashByteSlice);
    }
    function validateByteSlice(v) {
      return validate(v, id, hashByteSlice);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/defs.js
var require_defs8 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isSkeletonSearchPost = isSkeletonSearchPost;
    exports.validateSkeletonSearchPost = validateSkeletonSearchPost;
    exports.isSkeletonSearchActor = isSkeletonSearchActor;
    exports.validateSkeletonSearchActor = validateSkeletonSearchActor;
    exports.isSkeletonSearchStarterPack = isSkeletonSearchStarterPack;
    exports.validateSkeletonSearchStarterPack = validateSkeletonSearchStarterPack;
    exports.isTrendingTopic = isTrendingTopic;
    exports.validateTrendingTopic = validateTrendingTopic;
    exports.isSkeletonTrend = isSkeletonTrend;
    exports.validateSkeletonTrend = validateSkeletonTrend;
    exports.isTrendView = isTrendView;
    exports.validateTrendView = validateTrendView;
    exports.isThreadItemPost = isThreadItemPost;
    exports.validateThreadItemPost = validateThreadItemPost;
    exports.isThreadItemNoUnauthenticated = isThreadItemNoUnauthenticated;
    exports.validateThreadItemNoUnauthenticated = validateThreadItemNoUnauthenticated;
    exports.isThreadItemNotFound = isThreadItemNotFound;
    exports.validateThreadItemNotFound = validateThreadItemNotFound;
    exports.isThreadItemBlocked = isThreadItemBlocked;
    exports.validateThreadItemBlocked = validateThreadItemBlocked;
    exports.isAgeAssuranceState = isAgeAssuranceState;
    exports.validateAgeAssuranceState = validateAgeAssuranceState;
    exports.isAgeAssuranceEvent = isAgeAssuranceEvent;
    exports.validateAgeAssuranceEvent = validateAgeAssuranceEvent;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.unspecced.defs";
    var hashSkeletonSearchPost = "skeletonSearchPost";
    function isSkeletonSearchPost(v) {
      return is$typed(v, id, hashSkeletonSearchPost);
    }
    function validateSkeletonSearchPost(v) {
      return validate(v, id, hashSkeletonSearchPost);
    }
    var hashSkeletonSearchActor = "skeletonSearchActor";
    function isSkeletonSearchActor(v) {
      return is$typed(v, id, hashSkeletonSearchActor);
    }
    function validateSkeletonSearchActor(v) {
      return validate(v, id, hashSkeletonSearchActor);
    }
    var hashSkeletonSearchStarterPack = "skeletonSearchStarterPack";
    function isSkeletonSearchStarterPack(v) {
      return is$typed(v, id, hashSkeletonSearchStarterPack);
    }
    function validateSkeletonSearchStarterPack(v) {
      return validate(v, id, hashSkeletonSearchStarterPack);
    }
    var hashTrendingTopic = "trendingTopic";
    function isTrendingTopic(v) {
      return is$typed(v, id, hashTrendingTopic);
    }
    function validateTrendingTopic(v) {
      return validate(v, id, hashTrendingTopic);
    }
    var hashSkeletonTrend = "skeletonTrend";
    function isSkeletonTrend(v) {
      return is$typed(v, id, hashSkeletonTrend);
    }
    function validateSkeletonTrend(v) {
      return validate(v, id, hashSkeletonTrend);
    }
    var hashTrendView = "trendView";
    function isTrendView(v) {
      return is$typed(v, id, hashTrendView);
    }
    function validateTrendView(v) {
      return validate(v, id, hashTrendView);
    }
    var hashThreadItemPost = "threadItemPost";
    function isThreadItemPost(v) {
      return is$typed(v, id, hashThreadItemPost);
    }
    function validateThreadItemPost(v) {
      return validate(v, id, hashThreadItemPost);
    }
    var hashThreadItemNoUnauthenticated = "threadItemNoUnauthenticated";
    function isThreadItemNoUnauthenticated(v) {
      return is$typed(v, id, hashThreadItemNoUnauthenticated);
    }
    function validateThreadItemNoUnauthenticated(v) {
      return validate(v, id, hashThreadItemNoUnauthenticated);
    }
    var hashThreadItemNotFound = "threadItemNotFound";
    function isThreadItemNotFound(v) {
      return is$typed(v, id, hashThreadItemNotFound);
    }
    function validateThreadItemNotFound(v) {
      return validate(v, id, hashThreadItemNotFound);
    }
    var hashThreadItemBlocked = "threadItemBlocked";
    function isThreadItemBlocked(v) {
      return is$typed(v, id, hashThreadItemBlocked);
    }
    function validateThreadItemBlocked(v) {
      return validate(v, id, hashThreadItemBlocked);
    }
    var hashAgeAssuranceState = "ageAssuranceState";
    function isAgeAssuranceState(v) {
      return is$typed(v, id, hashAgeAssuranceState);
    }
    function validateAgeAssuranceState(v) {
      return validate(v, id, hashAgeAssuranceState);
    }
    var hashAgeAssuranceEvent = "ageAssuranceEvent";
    function isAgeAssuranceEvent(v) {
      return is$typed(v, id, hashAgeAssuranceEvent);
    }
    function validateAgeAssuranceEvent(v) {
      return validate(v, id, hashAgeAssuranceEvent);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getAgeAssuranceState.js
var require_getAgeAssuranceState = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getAgeAssuranceState.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getConfig.js
var require_getConfig = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getConfig.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isLiveNowConfig = isLiveNowConfig;
    exports.validateLiveNowConfig = validateLiveNowConfig;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.unspecced.getConfig";
    function toKnownErr(e) {
      return e;
    }
    var hashLiveNowConfig = "liveNowConfig";
    function isLiveNowConfig(v) {
      return is$typed(v, id, hashLiveNowConfig);
    }
    function validateLiveNowConfig(v) {
      return validate(v, id, hashLiveNowConfig);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getPopularFeedGenerators.js
var require_getPopularFeedGenerators = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getPopularFeedGenerators.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getPostThreadOtherV2.js
var require_getPostThreadOtherV2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getPostThreadOtherV2.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isThreadItem = isThreadItem;
    exports.validateThreadItem = validateThreadItem;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.unspecced.getPostThreadOtherV2";
    function toKnownErr(e) {
      return e;
    }
    var hashThreadItem = "threadItem";
    function isThreadItem(v) {
      return is$typed(v, id, hashThreadItem);
    }
    function validateThreadItem(v) {
      return validate(v, id, hashThreadItem);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getPostThreadV2.js
var require_getPostThreadV2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getPostThreadV2.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isThreadItem = isThreadItem;
    exports.validateThreadItem = validateThreadItem;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.unspecced.getPostThreadV2";
    function toKnownErr(e) {
      return e;
    }
    var hashThreadItem = "threadItem";
    function isThreadItem(v) {
      return is$typed(v, id, hashThreadItem);
    }
    function validateThreadItem(v) {
      return validate(v, id, hashThreadItem);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedFeeds.js
var require_getSuggestedFeeds2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedFeeds.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedFeedsSkeleton.js
var require_getSuggestedFeedsSkeleton = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedFeedsSkeleton.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedStarterPacks.js
var require_getSuggestedStarterPacks = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedStarterPacks.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedStarterPacksSkeleton.js
var require_getSuggestedStarterPacksSkeleton = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedStarterPacksSkeleton.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedUsers.js
var require_getSuggestedUsers = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedUsers.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedUsersSkeleton.js
var require_getSuggestedUsersSkeleton = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestedUsersSkeleton.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestionsSkeleton.js
var require_getSuggestionsSkeleton = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getSuggestionsSkeleton.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getTaggedSuggestions.js
var require_getTaggedSuggestions = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getTaggedSuggestions.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isSuggestion = isSuggestion;
    exports.validateSuggestion = validateSuggestion;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.unspecced.getTaggedSuggestions";
    function toKnownErr(e) {
      return e;
    }
    var hashSuggestion = "suggestion";
    function isSuggestion(v) {
      return is$typed(v, id, hashSuggestion);
    }
    function validateSuggestion(v) {
      return validate(v, id, hashSuggestion);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getTrendingTopics.js
var require_getTrendingTopics = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getTrendingTopics.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getTrends.js
var require_getTrends = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getTrends.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getTrendsSkeleton.js
var require_getTrendsSkeleton = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/unspecced/getTrendsSkeleton.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/video/defs.js
var require_defs9 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/video/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isJobStatus = isJobStatus;
    exports.validateJobStatus = validateJobStatus;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "app.bsky.video.defs";
    var hashJobStatus = "jobStatus";
    function isJobStatus(v) {
      return is$typed(v, id, hashJobStatus);
    }
    function validateJobStatus(v) {
      return validate(v, id, hashJobStatus);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/video/getJobStatus.js
var require_getJobStatus = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/video/getJobStatus.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/video/getUploadLimits.js
var require_getUploadLimits = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/video/getUploadLimits.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/app/bsky/video/uploadVideo.js
var require_uploadVideo = __commonJS({
  "node_modules/@atproto/api/dist/client/types/app/bsky/video/uploadVideo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/actor/declaration.js
var require_declaration2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/actor/declaration.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "chat.bsky.actor.declaration";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/actor/defs.js
var require_defs10 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/actor/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isProfileViewBasic = isProfileViewBasic;
    exports.validateProfileViewBasic = validateProfileViewBasic;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "chat.bsky.actor.defs";
    var hashProfileViewBasic = "profileViewBasic";
    function isProfileViewBasic(v) {
      return is$typed(v, id, hashProfileViewBasic);
    }
    function validateProfileViewBasic(v) {
      return validate(v, id, hashProfileViewBasic);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/actor/deleteAccount.js
var require_deleteAccount2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/actor/deleteAccount.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/actor/exportAccountData.js
var require_exportAccountData = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/actor/exportAccountData.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/acceptConvo.js
var require_acceptConvo = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/acceptConvo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/defs.js
var require_defs11 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isMessageRef = isMessageRef;
    exports.validateMessageRef = validateMessageRef;
    exports.isMessageInput = isMessageInput;
    exports.validateMessageInput = validateMessageInput;
    exports.isMessageView = isMessageView;
    exports.validateMessageView = validateMessageView;
    exports.isDeletedMessageView = isDeletedMessageView;
    exports.validateDeletedMessageView = validateDeletedMessageView;
    exports.isMessageViewSender = isMessageViewSender;
    exports.validateMessageViewSender = validateMessageViewSender;
    exports.isReactionView = isReactionView;
    exports.validateReactionView = validateReactionView;
    exports.isReactionViewSender = isReactionViewSender;
    exports.validateReactionViewSender = validateReactionViewSender;
    exports.isMessageAndReactionView = isMessageAndReactionView;
    exports.validateMessageAndReactionView = validateMessageAndReactionView;
    exports.isConvoView = isConvoView;
    exports.validateConvoView = validateConvoView;
    exports.isLogBeginConvo = isLogBeginConvo;
    exports.validateLogBeginConvo = validateLogBeginConvo;
    exports.isLogAcceptConvo = isLogAcceptConvo;
    exports.validateLogAcceptConvo = validateLogAcceptConvo;
    exports.isLogLeaveConvo = isLogLeaveConvo;
    exports.validateLogLeaveConvo = validateLogLeaveConvo;
    exports.isLogMuteConvo = isLogMuteConvo;
    exports.validateLogMuteConvo = validateLogMuteConvo;
    exports.isLogUnmuteConvo = isLogUnmuteConvo;
    exports.validateLogUnmuteConvo = validateLogUnmuteConvo;
    exports.isLogCreateMessage = isLogCreateMessage;
    exports.validateLogCreateMessage = validateLogCreateMessage;
    exports.isLogDeleteMessage = isLogDeleteMessage;
    exports.validateLogDeleteMessage = validateLogDeleteMessage;
    exports.isLogReadMessage = isLogReadMessage;
    exports.validateLogReadMessage = validateLogReadMessage;
    exports.isLogAddReaction = isLogAddReaction;
    exports.validateLogAddReaction = validateLogAddReaction;
    exports.isLogRemoveReaction = isLogRemoveReaction;
    exports.validateLogRemoveReaction = validateLogRemoveReaction;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "chat.bsky.convo.defs";
    var hashMessageRef = "messageRef";
    function isMessageRef(v) {
      return is$typed(v, id, hashMessageRef);
    }
    function validateMessageRef(v) {
      return validate(v, id, hashMessageRef);
    }
    var hashMessageInput = "messageInput";
    function isMessageInput(v) {
      return is$typed(v, id, hashMessageInput);
    }
    function validateMessageInput(v) {
      return validate(v, id, hashMessageInput);
    }
    var hashMessageView = "messageView";
    function isMessageView(v) {
      return is$typed(v, id, hashMessageView);
    }
    function validateMessageView(v) {
      return validate(v, id, hashMessageView);
    }
    var hashDeletedMessageView = "deletedMessageView";
    function isDeletedMessageView(v) {
      return is$typed(v, id, hashDeletedMessageView);
    }
    function validateDeletedMessageView(v) {
      return validate(v, id, hashDeletedMessageView);
    }
    var hashMessageViewSender = "messageViewSender";
    function isMessageViewSender(v) {
      return is$typed(v, id, hashMessageViewSender);
    }
    function validateMessageViewSender(v) {
      return validate(v, id, hashMessageViewSender);
    }
    var hashReactionView = "reactionView";
    function isReactionView(v) {
      return is$typed(v, id, hashReactionView);
    }
    function validateReactionView(v) {
      return validate(v, id, hashReactionView);
    }
    var hashReactionViewSender = "reactionViewSender";
    function isReactionViewSender(v) {
      return is$typed(v, id, hashReactionViewSender);
    }
    function validateReactionViewSender(v) {
      return validate(v, id, hashReactionViewSender);
    }
    var hashMessageAndReactionView = "messageAndReactionView";
    function isMessageAndReactionView(v) {
      return is$typed(v, id, hashMessageAndReactionView);
    }
    function validateMessageAndReactionView(v) {
      return validate(v, id, hashMessageAndReactionView);
    }
    var hashConvoView = "convoView";
    function isConvoView(v) {
      return is$typed(v, id, hashConvoView);
    }
    function validateConvoView(v) {
      return validate(v, id, hashConvoView);
    }
    var hashLogBeginConvo = "logBeginConvo";
    function isLogBeginConvo(v) {
      return is$typed(v, id, hashLogBeginConvo);
    }
    function validateLogBeginConvo(v) {
      return validate(v, id, hashLogBeginConvo);
    }
    var hashLogAcceptConvo = "logAcceptConvo";
    function isLogAcceptConvo(v) {
      return is$typed(v, id, hashLogAcceptConvo);
    }
    function validateLogAcceptConvo(v) {
      return validate(v, id, hashLogAcceptConvo);
    }
    var hashLogLeaveConvo = "logLeaveConvo";
    function isLogLeaveConvo(v) {
      return is$typed(v, id, hashLogLeaveConvo);
    }
    function validateLogLeaveConvo(v) {
      return validate(v, id, hashLogLeaveConvo);
    }
    var hashLogMuteConvo = "logMuteConvo";
    function isLogMuteConvo(v) {
      return is$typed(v, id, hashLogMuteConvo);
    }
    function validateLogMuteConvo(v) {
      return validate(v, id, hashLogMuteConvo);
    }
    var hashLogUnmuteConvo = "logUnmuteConvo";
    function isLogUnmuteConvo(v) {
      return is$typed(v, id, hashLogUnmuteConvo);
    }
    function validateLogUnmuteConvo(v) {
      return validate(v, id, hashLogUnmuteConvo);
    }
    var hashLogCreateMessage = "logCreateMessage";
    function isLogCreateMessage(v) {
      return is$typed(v, id, hashLogCreateMessage);
    }
    function validateLogCreateMessage(v) {
      return validate(v, id, hashLogCreateMessage);
    }
    var hashLogDeleteMessage = "logDeleteMessage";
    function isLogDeleteMessage(v) {
      return is$typed(v, id, hashLogDeleteMessage);
    }
    function validateLogDeleteMessage(v) {
      return validate(v, id, hashLogDeleteMessage);
    }
    var hashLogReadMessage = "logReadMessage";
    function isLogReadMessage(v) {
      return is$typed(v, id, hashLogReadMessage);
    }
    function validateLogReadMessage(v) {
      return validate(v, id, hashLogReadMessage);
    }
    var hashLogAddReaction = "logAddReaction";
    function isLogAddReaction(v) {
      return is$typed(v, id, hashLogAddReaction);
    }
    function validateLogAddReaction(v) {
      return validate(v, id, hashLogAddReaction);
    }
    var hashLogRemoveReaction = "logRemoveReaction";
    function isLogRemoveReaction(v) {
      return is$typed(v, id, hashLogRemoveReaction);
    }
    function validateLogRemoveReaction(v) {
      return validate(v, id, hashLogRemoveReaction);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/deleteMessageForSelf.js
var require_deleteMessageForSelf = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/deleteMessageForSelf.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/getConvo.js
var require_getConvo = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/getConvo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/getConvoAvailability.js
var require_getConvoAvailability = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/getConvoAvailability.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/getConvoForMembers.js
var require_getConvoForMembers = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/getConvoForMembers.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/getLog.js
var require_getLog = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/getLog.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/getMessages.js
var require_getMessages = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/getMessages.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/leaveConvo.js
var require_leaveConvo = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/leaveConvo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/listConvos.js
var require_listConvos = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/listConvos.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/muteConvo.js
var require_muteConvo = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/muteConvo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/sendMessage.js
var require_sendMessage = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/sendMessage.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/sendMessageBatch.js
var require_sendMessageBatch = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/sendMessageBatch.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isBatchItem = isBatchItem;
    exports.validateBatchItem = validateBatchItem;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "chat.bsky.convo.sendMessageBatch";
    function toKnownErr(e) {
      return e;
    }
    var hashBatchItem = "batchItem";
    function isBatchItem(v) {
      return is$typed(v, id, hashBatchItem);
    }
    function validateBatchItem(v) {
      return validate(v, id, hashBatchItem);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/unmuteConvo.js
var require_unmuteConvo = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/unmuteConvo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/updateAllRead.js
var require_updateAllRead = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/updateAllRead.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/convo/updateRead.js
var require_updateRead = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/convo/updateRead.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/moderation/getActorMetadata.js
var require_getActorMetadata = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/moderation/getActorMetadata.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isMetadata = isMetadata;
    exports.validateMetadata = validateMetadata;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "chat.bsky.moderation.getActorMetadata";
    function toKnownErr(e) {
      return e;
    }
    var hashMetadata = "metadata";
    function isMetadata(v) {
      return is$typed(v, id, hashMetadata);
    }
    function validateMetadata(v) {
      return validate(v, id, hashMetadata);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/moderation/getMessageContext.js
var require_getMessageContext = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/moderation/getMessageContext.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/chat/bsky/moderation/updateActorAccess.js
var require_updateActorAccess = __commonJS({
  "node_modules/@atproto/api/dist/client/types/chat/bsky/moderation/updateActorAccess.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/defs.js
var require_defs12 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isStatusAttr = isStatusAttr;
    exports.validateStatusAttr = validateStatusAttr;
    exports.isAccountView = isAccountView;
    exports.validateAccountView = validateAccountView;
    exports.isRepoRef = isRepoRef;
    exports.validateRepoRef = validateRepoRef;
    exports.isRepoBlobRef = isRepoBlobRef;
    exports.validateRepoBlobRef = validateRepoBlobRef;
    exports.isThreatSignature = isThreatSignature;
    exports.validateThreatSignature = validateThreatSignature;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.admin.defs";
    var hashStatusAttr = "statusAttr";
    function isStatusAttr(v) {
      return is$typed(v, id, hashStatusAttr);
    }
    function validateStatusAttr(v) {
      return validate(v, id, hashStatusAttr);
    }
    var hashAccountView = "accountView";
    function isAccountView(v) {
      return is$typed(v, id, hashAccountView);
    }
    function validateAccountView(v) {
      return validate(v, id, hashAccountView);
    }
    var hashRepoRef = "repoRef";
    function isRepoRef(v) {
      return is$typed(v, id, hashRepoRef);
    }
    function validateRepoRef(v) {
      return validate(v, id, hashRepoRef);
    }
    var hashRepoBlobRef = "repoBlobRef";
    function isRepoBlobRef(v) {
      return is$typed(v, id, hashRepoBlobRef);
    }
    function validateRepoBlobRef(v) {
      return validate(v, id, hashRepoBlobRef);
    }
    var hashThreatSignature = "threatSignature";
    function isThreatSignature(v) {
      return is$typed(v, id, hashThreatSignature);
    }
    function validateThreatSignature(v) {
      return validate(v, id, hashThreatSignature);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/deleteAccount.js
var require_deleteAccount3 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/deleteAccount.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/disableAccountInvites.js
var require_disableAccountInvites = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/disableAccountInvites.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/disableInviteCodes.js
var require_disableInviteCodes = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/disableInviteCodes.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/enableAccountInvites.js
var require_enableAccountInvites = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/enableAccountInvites.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/getAccountInfo.js
var require_getAccountInfo = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/getAccountInfo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/getAccountInfos.js
var require_getAccountInfos = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/getAccountInfos.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/getInviteCodes.js
var require_getInviteCodes = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/getInviteCodes.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/getSubjectStatus.js
var require_getSubjectStatus = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/getSubjectStatus.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/searchAccounts.js
var require_searchAccounts = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/searchAccounts.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/sendEmail.js
var require_sendEmail = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/sendEmail.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/updateAccountEmail.js
var require_updateAccountEmail = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/updateAccountEmail.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/updateAccountHandle.js
var require_updateAccountHandle = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/updateAccountHandle.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/updateAccountPassword.js
var require_updateAccountPassword = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/updateAccountPassword.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/updateAccountSigningKey.js
var require_updateAccountSigningKey = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/updateAccountSigningKey.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/admin/updateSubjectStatus.js
var require_updateSubjectStatus = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/admin/updateSubjectStatus.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/identity/defs.js
var require_defs13 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/identity/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isIdentityInfo = isIdentityInfo;
    exports.validateIdentityInfo = validateIdentityInfo;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.identity.defs";
    var hashIdentityInfo = "identityInfo";
    function isIdentityInfo(v) {
      return is$typed(v, id, hashIdentityInfo);
    }
    function validateIdentityInfo(v) {
      return validate(v, id, hashIdentityInfo);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/identity/getRecommendedDidCredentials.js
var require_getRecommendedDidCredentials = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/identity/getRecommendedDidCredentials.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/identity/requestPlcOperationSignature.js
var require_requestPlcOperationSignature = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/identity/requestPlcOperationSignature.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/identity/signPlcOperation.js
var require_signPlcOperation = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/identity/signPlcOperation.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/identity/submitPlcOperation.js
var require_submitPlcOperation = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/identity/submitPlcOperation.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/identity/updateHandle.js
var require_updateHandle = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/identity/updateHandle.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/label/defs.js
var require_defs14 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/label/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isLabel = isLabel;
    exports.validateLabel = validateLabel;
    exports.isSelfLabels = isSelfLabels;
    exports.validateSelfLabels = validateSelfLabels;
    exports.isSelfLabel = isSelfLabel;
    exports.validateSelfLabel = validateSelfLabel;
    exports.isLabelValueDefinition = isLabelValueDefinition;
    exports.validateLabelValueDefinition = validateLabelValueDefinition;
    exports.isLabelValueDefinitionStrings = isLabelValueDefinitionStrings;
    exports.validateLabelValueDefinitionStrings = validateLabelValueDefinitionStrings;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.label.defs";
    var hashLabel = "label";
    function isLabel(v) {
      return is$typed(v, id, hashLabel);
    }
    function validateLabel(v) {
      return validate(v, id, hashLabel);
    }
    var hashSelfLabels = "selfLabels";
    function isSelfLabels(v) {
      return is$typed(v, id, hashSelfLabels);
    }
    function validateSelfLabels(v) {
      return validate(v, id, hashSelfLabels);
    }
    var hashSelfLabel = "selfLabel";
    function isSelfLabel(v) {
      return is$typed(v, id, hashSelfLabel);
    }
    function validateSelfLabel(v) {
      return validate(v, id, hashSelfLabel);
    }
    var hashLabelValueDefinition = "labelValueDefinition";
    function isLabelValueDefinition(v) {
      return is$typed(v, id, hashLabelValueDefinition);
    }
    function validateLabelValueDefinition(v) {
      return validate(v, id, hashLabelValueDefinition);
    }
    var hashLabelValueDefinitionStrings = "labelValueDefinitionStrings";
    function isLabelValueDefinitionStrings(v) {
      return is$typed(v, id, hashLabelValueDefinitionStrings);
    }
    function validateLabelValueDefinitionStrings(v) {
      return validate(v, id, hashLabelValueDefinitionStrings);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/label/queryLabels.js
var require_queryLabels = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/label/queryLabels.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/label/subscribeLabels.js
var require_subscribeLabels = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/label/subscribeLabels.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isLabels = isLabels;
    exports.validateLabels = validateLabels;
    exports.isInfo = isInfo;
    exports.validateInfo = validateInfo;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.label.subscribeLabels";
    var hashLabels = "labels";
    function isLabels(v) {
      return is$typed(v, id, hashLabels);
    }
    function validateLabels(v) {
      return validate(v, id, hashLabels);
    }
    var hashInfo = "info";
    function isInfo(v) {
      return is$typed(v, id, hashInfo);
    }
    function validateInfo(v) {
      return validate(v, id, hashInfo);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/lexicon/schema.js
var require_schema = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/lexicon/schema.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.lexicon.schema";
    var hashRecord = "main";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord, true);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/moderation/createReport.js
var require_createReport = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/moderation/createReport.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isModTool = isModTool;
    exports.validateModTool = validateModTool;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.moderation.createReport";
    function toKnownErr(e) {
      return e;
    }
    var hashModTool = "modTool";
    function isModTool(v) {
      return is$typed(v, id, hashModTool);
    }
    function validateModTool(v) {
      return validate(v, id, hashModTool);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/moderation/defs.js
var require_defs15 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/moderation/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.REASONAPPEAL = exports.REASONOTHER = exports.REASONRUDE = exports.REASONSEXUAL = exports.REASONMISLEADING = exports.REASONVIOLATION = exports.REASONSPAM = void 0;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.moderation.defs";
    exports.REASONSPAM = `${id}#reasonSpam`;
    exports.REASONVIOLATION = `${id}#reasonViolation`;
    exports.REASONMISLEADING = `${id}#reasonMisleading`;
    exports.REASONSEXUAL = `${id}#reasonSexual`;
    exports.REASONRUDE = `${id}#reasonRude`;
    exports.REASONOTHER = `${id}#reasonOther`;
    exports.REASONAPPEAL = `${id}#reasonAppeal`;
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/defs.js
var require_defs16 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isCommitMeta = isCommitMeta;
    exports.validateCommitMeta = validateCommitMeta;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.repo.defs";
    var hashCommitMeta = "commitMeta";
    function isCommitMeta(v) {
      return is$typed(v, id, hashCommitMeta);
    }
    function validateCommitMeta(v) {
      return validate(v, id, hashCommitMeta);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/describeRepo.js
var require_describeRepo = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/describeRepo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/importRepo.js
var require_importRepo = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/importRepo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/listMissingBlobs.js
var require_listMissingBlobs = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/listMissingBlobs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isRecordBlob = isRecordBlob;
    exports.validateRecordBlob = validateRecordBlob;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.repo.listMissingBlobs";
    function toKnownErr(e) {
      return e;
    }
    var hashRecordBlob = "recordBlob";
    function isRecordBlob(v) {
      return is$typed(v, id, hashRecordBlob);
    }
    function validateRecordBlob(v) {
      return validate(v, id, hashRecordBlob);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/listRecords.js
var require_listRecords = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/listRecords.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isRecord = isRecord;
    exports.validateRecord = validateRecord;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.repo.listRecords";
    function toKnownErr(e) {
      return e;
    }
    var hashRecord = "record";
    function isRecord(v) {
      return is$typed(v, id, hashRecord);
    }
    function validateRecord(v) {
      return validate(v, id, hashRecord);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/strongRef.js
var require_strongRef = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/strongRef.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isMain = isMain;
    exports.validateMain = validateMain;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.repo.strongRef";
    var hashMain = "main";
    function isMain(v) {
      return is$typed(v, id, hashMain);
    }
    function validateMain(v) {
      return validate(v, id, hashMain);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/repo/uploadBlob.js
var require_uploadBlob = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/repo/uploadBlob.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/activateAccount.js
var require_activateAccount = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/activateAccount.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/checkAccountStatus.js
var require_checkAccountStatus = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/checkAccountStatus.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/createInviteCode.js
var require_createInviteCode = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/createInviteCode.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/createInviteCodes.js
var require_createInviteCodes = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/createInviteCodes.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isAccountCodes = isAccountCodes;
    exports.validateAccountCodes = validateAccountCodes;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.server.createInviteCodes";
    function toKnownErr(e) {
      return e;
    }
    var hashAccountCodes = "accountCodes";
    function isAccountCodes(v) {
      return is$typed(v, id, hashAccountCodes);
    }
    function validateAccountCodes(v) {
      return validate(v, id, hashAccountCodes);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/deactivateAccount.js
var require_deactivateAccount = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/deactivateAccount.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/defs.js
var require_defs17 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isInviteCode = isInviteCode;
    exports.validateInviteCode = validateInviteCode;
    exports.isInviteCodeUse = isInviteCodeUse;
    exports.validateInviteCodeUse = validateInviteCodeUse;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.server.defs";
    var hashInviteCode = "inviteCode";
    function isInviteCode(v) {
      return is$typed(v, id, hashInviteCode);
    }
    function validateInviteCode(v) {
      return validate(v, id, hashInviteCode);
    }
    var hashInviteCodeUse = "inviteCodeUse";
    function isInviteCodeUse(v) {
      return is$typed(v, id, hashInviteCodeUse);
    }
    function validateInviteCodeUse(v) {
      return validate(v, id, hashInviteCodeUse);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/deleteSession.js
var require_deleteSession = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/deleteSession.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/describeServer.js
var require_describeServer = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/describeServer.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isLinks = isLinks;
    exports.validateLinks = validateLinks;
    exports.isContact = isContact;
    exports.validateContact = validateContact;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.server.describeServer";
    function toKnownErr(e) {
      return e;
    }
    var hashLinks = "links";
    function isLinks(v) {
      return is$typed(v, id, hashLinks);
    }
    function validateLinks(v) {
      return validate(v, id, hashLinks);
    }
    var hashContact = "contact";
    function isContact(v) {
      return is$typed(v, id, hashContact);
    }
    function validateContact(v) {
      return validate(v, id, hashContact);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/getSession.js
var require_getSession = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/getSession.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/requestAccountDelete.js
var require_requestAccountDelete = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/requestAccountDelete.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/requestEmailConfirmation.js
var require_requestEmailConfirmation = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/requestEmailConfirmation.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/requestEmailUpdate.js
var require_requestEmailUpdate = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/requestEmailUpdate.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/requestPasswordReset.js
var require_requestPasswordReset = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/requestPasswordReset.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/reserveSigningKey.js
var require_reserveSigningKey = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/reserveSigningKey.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/server/revokeAppPassword.js
var require_revokeAppPassword = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/server/revokeAppPassword.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/defs.js
var require_defs18 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/getCheckout.js
var require_getCheckout = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/getCheckout.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/listHosts.js
var require_listHosts = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/listHosts.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isHost = isHost;
    exports.validateHost = validateHost;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.sync.listHosts";
    function toKnownErr(e) {
      return e;
    }
    var hashHost = "host";
    function isHost(v) {
      return is$typed(v, id, hashHost);
    }
    function validateHost(v) {
      return validate(v, id, hashHost);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/listRepos.js
var require_listRepos = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/listRepos.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isRepo = isRepo;
    exports.validateRepo = validateRepo;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.sync.listRepos";
    function toKnownErr(e) {
      return e;
    }
    var hashRepo = "repo";
    function isRepo(v) {
      return is$typed(v, id, hashRepo);
    }
    function validateRepo(v) {
      return validate(v, id, hashRepo);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/listReposByCollection.js
var require_listReposByCollection = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/listReposByCollection.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isRepo = isRepo;
    exports.validateRepo = validateRepo;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.sync.listReposByCollection";
    function toKnownErr(e) {
      return e;
    }
    var hashRepo = "repo";
    function isRepo(v) {
      return is$typed(v, id, hashRepo);
    }
    function validateRepo(v) {
      return validate(v, id, hashRepo);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/notifyOfUpdate.js
var require_notifyOfUpdate = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/notifyOfUpdate.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/sync/subscribeRepos.js
var require_subscribeRepos = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/sync/subscribeRepos.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isCommit = isCommit;
    exports.validateCommit = validateCommit;
    exports.isSync = isSync;
    exports.validateSync = validateSync;
    exports.isIdentity = isIdentity;
    exports.validateIdentity = validateIdentity;
    exports.isAccount = isAccount;
    exports.validateAccount = validateAccount;
    exports.isInfo = isInfo;
    exports.validateInfo = validateInfo;
    exports.isRepoOp = isRepoOp;
    exports.validateRepoOp = validateRepoOp;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "com.atproto.sync.subscribeRepos";
    var hashCommit = "commit";
    function isCommit(v) {
      return is$typed(v, id, hashCommit);
    }
    function validateCommit(v) {
      return validate(v, id, hashCommit);
    }
    var hashSync = "sync";
    function isSync(v) {
      return is$typed(v, id, hashSync);
    }
    function validateSync(v) {
      return validate(v, id, hashSync);
    }
    var hashIdentity = "identity";
    function isIdentity(v) {
      return is$typed(v, id, hashIdentity);
    }
    function validateIdentity(v) {
      return validate(v, id, hashIdentity);
    }
    var hashAccount = "account";
    function isAccount(v) {
      return is$typed(v, id, hashAccount);
    }
    function validateAccount(v) {
      return validate(v, id, hashAccount);
    }
    var hashInfo = "info";
    function isInfo(v) {
      return is$typed(v, id, hashInfo);
    }
    function validateInfo(v) {
      return validate(v, id, hashInfo);
    }
    var hashRepoOp = "repoOp";
    function isRepoOp(v) {
      return is$typed(v, id, hashRepoOp);
    }
    function validateRepoOp(v) {
      return validate(v, id, hashRepoOp);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/temp/addReservedHandle.js
var require_addReservedHandle = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/temp/addReservedHandle.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/temp/checkSignupQueue.js
var require_checkSignupQueue = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/temp/checkSignupQueue.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/temp/fetchLabels.js
var require_fetchLabels = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/temp/fetchLabels.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/temp/requestPhoneVerification.js
var require_requestPhoneVerification = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/temp/requestPhoneVerification.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/com/atproto/temp/revokeAccountCredentials.js
var require_revokeAccountCredentials = __commonJS({
  "node_modules/@atproto/api/dist/client/types/com/atproto/temp/revokeAccountCredentials.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/communication/defs.js
var require_defs19 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/communication/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isTemplateView = isTemplateView;
    exports.validateTemplateView = validateTemplateView;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.communication.defs";
    var hashTemplateView = "templateView";
    function isTemplateView(v) {
      return is$typed(v, id, hashTemplateView);
    }
    function validateTemplateView(v) {
      return validate(v, id, hashTemplateView);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/communication/deleteTemplate.js
var require_deleteTemplate = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/communication/deleteTemplate.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/communication/listTemplates.js
var require_listTemplates = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/communication/listTemplates.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/hosting/getAccountHistory.js
var require_getAccountHistory = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/hosting/getAccountHistory.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isEvent = isEvent;
    exports.validateEvent = validateEvent;
    exports.isAccountCreated = isAccountCreated;
    exports.validateAccountCreated = validateAccountCreated;
    exports.isEmailUpdated = isEmailUpdated;
    exports.validateEmailUpdated = validateEmailUpdated;
    exports.isEmailConfirmed = isEmailConfirmed;
    exports.validateEmailConfirmed = validateEmailConfirmed;
    exports.isPasswordUpdated = isPasswordUpdated;
    exports.validatePasswordUpdated = validatePasswordUpdated;
    exports.isHandleUpdated = isHandleUpdated;
    exports.validateHandleUpdated = validateHandleUpdated;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.hosting.getAccountHistory";
    function toKnownErr(e) {
      return e;
    }
    var hashEvent = "event";
    function isEvent(v) {
      return is$typed(v, id, hashEvent);
    }
    function validateEvent(v) {
      return validate(v, id, hashEvent);
    }
    var hashAccountCreated = "accountCreated";
    function isAccountCreated(v) {
      return is$typed(v, id, hashAccountCreated);
    }
    function validateAccountCreated(v) {
      return validate(v, id, hashAccountCreated);
    }
    var hashEmailUpdated = "emailUpdated";
    function isEmailUpdated(v) {
      return is$typed(v, id, hashEmailUpdated);
    }
    function validateEmailUpdated(v) {
      return validate(v, id, hashEmailUpdated);
    }
    var hashEmailConfirmed = "emailConfirmed";
    function isEmailConfirmed(v) {
      return is$typed(v, id, hashEmailConfirmed);
    }
    function validateEmailConfirmed(v) {
      return validate(v, id, hashEmailConfirmed);
    }
    var hashPasswordUpdated = "passwordUpdated";
    function isPasswordUpdated(v) {
      return is$typed(v, id, hashPasswordUpdated);
    }
    function validatePasswordUpdated(v) {
      return validate(v, id, hashPasswordUpdated);
    }
    var hashHandleUpdated = "handleUpdated";
    function isHandleUpdated(v) {
      return is$typed(v, id, hashHandleUpdated);
    }
    function validateHandleUpdated(v) {
      return validate(v, id, hashHandleUpdated);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/defs.js
var require_defs20 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.TIMELINEEVENTPLCTOMBSTONE = exports.TIMELINEEVENTPLCOPERATION = exports.TIMELINEEVENTPLCCREATE = exports.REVIEWNONE = exports.REVIEWCLOSED = exports.REVIEWESCALATED = exports.REVIEWOPEN = void 0;
    exports.isModEventView = isModEventView;
    exports.validateModEventView = validateModEventView;
    exports.isModEventViewDetail = isModEventViewDetail;
    exports.validateModEventViewDetail = validateModEventViewDetail;
    exports.isSubjectStatusView = isSubjectStatusView;
    exports.validateSubjectStatusView = validateSubjectStatusView;
    exports.isSubjectView = isSubjectView;
    exports.validateSubjectView = validateSubjectView;
    exports.isAccountStats = isAccountStats;
    exports.validateAccountStats = validateAccountStats;
    exports.isRecordsStats = isRecordsStats;
    exports.validateRecordsStats = validateRecordsStats;
    exports.isModEventTakedown = isModEventTakedown;
    exports.validateModEventTakedown = validateModEventTakedown;
    exports.isModEventReverseTakedown = isModEventReverseTakedown;
    exports.validateModEventReverseTakedown = validateModEventReverseTakedown;
    exports.isModEventResolveAppeal = isModEventResolveAppeal;
    exports.validateModEventResolveAppeal = validateModEventResolveAppeal;
    exports.isModEventComment = isModEventComment;
    exports.validateModEventComment = validateModEventComment;
    exports.isModEventReport = isModEventReport;
    exports.validateModEventReport = validateModEventReport;
    exports.isModEventLabel = isModEventLabel;
    exports.validateModEventLabel = validateModEventLabel;
    exports.isModEventPriorityScore = isModEventPriorityScore;
    exports.validateModEventPriorityScore = validateModEventPriorityScore;
    exports.isAgeAssuranceEvent = isAgeAssuranceEvent;
    exports.validateAgeAssuranceEvent = validateAgeAssuranceEvent;
    exports.isAgeAssuranceOverrideEvent = isAgeAssuranceOverrideEvent;
    exports.validateAgeAssuranceOverrideEvent = validateAgeAssuranceOverrideEvent;
    exports.isRevokeAccountCredentialsEvent = isRevokeAccountCredentialsEvent;
    exports.validateRevokeAccountCredentialsEvent = validateRevokeAccountCredentialsEvent;
    exports.isModEventAcknowledge = isModEventAcknowledge;
    exports.validateModEventAcknowledge = validateModEventAcknowledge;
    exports.isModEventEscalate = isModEventEscalate;
    exports.validateModEventEscalate = validateModEventEscalate;
    exports.isModEventMute = isModEventMute;
    exports.validateModEventMute = validateModEventMute;
    exports.isModEventUnmute = isModEventUnmute;
    exports.validateModEventUnmute = validateModEventUnmute;
    exports.isModEventMuteReporter = isModEventMuteReporter;
    exports.validateModEventMuteReporter = validateModEventMuteReporter;
    exports.isModEventUnmuteReporter = isModEventUnmuteReporter;
    exports.validateModEventUnmuteReporter = validateModEventUnmuteReporter;
    exports.isModEventEmail = isModEventEmail;
    exports.validateModEventEmail = validateModEventEmail;
    exports.isModEventDivert = isModEventDivert;
    exports.validateModEventDivert = validateModEventDivert;
    exports.isModEventTag = isModEventTag;
    exports.validateModEventTag = validateModEventTag;
    exports.isAccountEvent = isAccountEvent;
    exports.validateAccountEvent = validateAccountEvent;
    exports.isIdentityEvent = isIdentityEvent;
    exports.validateIdentityEvent = validateIdentityEvent;
    exports.isRecordEvent = isRecordEvent;
    exports.validateRecordEvent = validateRecordEvent;
    exports.isRepoView = isRepoView;
    exports.validateRepoView = validateRepoView;
    exports.isRepoViewDetail = isRepoViewDetail;
    exports.validateRepoViewDetail = validateRepoViewDetail;
    exports.isRepoViewNotFound = isRepoViewNotFound;
    exports.validateRepoViewNotFound = validateRepoViewNotFound;
    exports.isRecordView = isRecordView;
    exports.validateRecordView = validateRecordView;
    exports.isRecordViewDetail = isRecordViewDetail;
    exports.validateRecordViewDetail = validateRecordViewDetail;
    exports.isRecordViewNotFound = isRecordViewNotFound;
    exports.validateRecordViewNotFound = validateRecordViewNotFound;
    exports.isModeration = isModeration;
    exports.validateModeration = validateModeration;
    exports.isModerationDetail = isModerationDetail;
    exports.validateModerationDetail = validateModerationDetail;
    exports.isBlobView = isBlobView;
    exports.validateBlobView = validateBlobView;
    exports.isImageDetails = isImageDetails;
    exports.validateImageDetails = validateImageDetails;
    exports.isVideoDetails = isVideoDetails;
    exports.validateVideoDetails = validateVideoDetails;
    exports.isAccountHosting = isAccountHosting;
    exports.validateAccountHosting = validateAccountHosting;
    exports.isRecordHosting = isRecordHosting;
    exports.validateRecordHosting = validateRecordHosting;
    exports.isReporterStats = isReporterStats;
    exports.validateReporterStats = validateReporterStats;
    exports.isModTool = isModTool;
    exports.validateModTool = validateModTool;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.moderation.defs";
    var hashModEventView = "modEventView";
    function isModEventView(v) {
      return is$typed(v, id, hashModEventView);
    }
    function validateModEventView(v) {
      return validate(v, id, hashModEventView);
    }
    var hashModEventViewDetail = "modEventViewDetail";
    function isModEventViewDetail(v) {
      return is$typed(v, id, hashModEventViewDetail);
    }
    function validateModEventViewDetail(v) {
      return validate(v, id, hashModEventViewDetail);
    }
    var hashSubjectStatusView = "subjectStatusView";
    function isSubjectStatusView(v) {
      return is$typed(v, id, hashSubjectStatusView);
    }
    function validateSubjectStatusView(v) {
      return validate(v, id, hashSubjectStatusView);
    }
    var hashSubjectView = "subjectView";
    function isSubjectView(v) {
      return is$typed(v, id, hashSubjectView);
    }
    function validateSubjectView(v) {
      return validate(v, id, hashSubjectView);
    }
    var hashAccountStats = "accountStats";
    function isAccountStats(v) {
      return is$typed(v, id, hashAccountStats);
    }
    function validateAccountStats(v) {
      return validate(v, id, hashAccountStats);
    }
    var hashRecordsStats = "recordsStats";
    function isRecordsStats(v) {
      return is$typed(v, id, hashRecordsStats);
    }
    function validateRecordsStats(v) {
      return validate(v, id, hashRecordsStats);
    }
    exports.REVIEWOPEN = `${id}#reviewOpen`;
    exports.REVIEWESCALATED = `${id}#reviewEscalated`;
    exports.REVIEWCLOSED = `${id}#reviewClosed`;
    exports.REVIEWNONE = `${id}#reviewNone`;
    var hashModEventTakedown = "modEventTakedown";
    function isModEventTakedown(v) {
      return is$typed(v, id, hashModEventTakedown);
    }
    function validateModEventTakedown(v) {
      return validate(v, id, hashModEventTakedown);
    }
    var hashModEventReverseTakedown = "modEventReverseTakedown";
    function isModEventReverseTakedown(v) {
      return is$typed(v, id, hashModEventReverseTakedown);
    }
    function validateModEventReverseTakedown(v) {
      return validate(v, id, hashModEventReverseTakedown);
    }
    var hashModEventResolveAppeal = "modEventResolveAppeal";
    function isModEventResolveAppeal(v) {
      return is$typed(v, id, hashModEventResolveAppeal);
    }
    function validateModEventResolveAppeal(v) {
      return validate(v, id, hashModEventResolveAppeal);
    }
    var hashModEventComment = "modEventComment";
    function isModEventComment(v) {
      return is$typed(v, id, hashModEventComment);
    }
    function validateModEventComment(v) {
      return validate(v, id, hashModEventComment);
    }
    var hashModEventReport = "modEventReport";
    function isModEventReport(v) {
      return is$typed(v, id, hashModEventReport);
    }
    function validateModEventReport(v) {
      return validate(v, id, hashModEventReport);
    }
    var hashModEventLabel = "modEventLabel";
    function isModEventLabel(v) {
      return is$typed(v, id, hashModEventLabel);
    }
    function validateModEventLabel(v) {
      return validate(v, id, hashModEventLabel);
    }
    var hashModEventPriorityScore = "modEventPriorityScore";
    function isModEventPriorityScore(v) {
      return is$typed(v, id, hashModEventPriorityScore);
    }
    function validateModEventPriorityScore(v) {
      return validate(v, id, hashModEventPriorityScore);
    }
    var hashAgeAssuranceEvent = "ageAssuranceEvent";
    function isAgeAssuranceEvent(v) {
      return is$typed(v, id, hashAgeAssuranceEvent);
    }
    function validateAgeAssuranceEvent(v) {
      return validate(v, id, hashAgeAssuranceEvent);
    }
    var hashAgeAssuranceOverrideEvent = "ageAssuranceOverrideEvent";
    function isAgeAssuranceOverrideEvent(v) {
      return is$typed(v, id, hashAgeAssuranceOverrideEvent);
    }
    function validateAgeAssuranceOverrideEvent(v) {
      return validate(v, id, hashAgeAssuranceOverrideEvent);
    }
    var hashRevokeAccountCredentialsEvent = "revokeAccountCredentialsEvent";
    function isRevokeAccountCredentialsEvent(v) {
      return is$typed(v, id, hashRevokeAccountCredentialsEvent);
    }
    function validateRevokeAccountCredentialsEvent(v) {
      return validate(v, id, hashRevokeAccountCredentialsEvent);
    }
    var hashModEventAcknowledge = "modEventAcknowledge";
    function isModEventAcknowledge(v) {
      return is$typed(v, id, hashModEventAcknowledge);
    }
    function validateModEventAcknowledge(v) {
      return validate(v, id, hashModEventAcknowledge);
    }
    var hashModEventEscalate = "modEventEscalate";
    function isModEventEscalate(v) {
      return is$typed(v, id, hashModEventEscalate);
    }
    function validateModEventEscalate(v) {
      return validate(v, id, hashModEventEscalate);
    }
    var hashModEventMute = "modEventMute";
    function isModEventMute(v) {
      return is$typed(v, id, hashModEventMute);
    }
    function validateModEventMute(v) {
      return validate(v, id, hashModEventMute);
    }
    var hashModEventUnmute = "modEventUnmute";
    function isModEventUnmute(v) {
      return is$typed(v, id, hashModEventUnmute);
    }
    function validateModEventUnmute(v) {
      return validate(v, id, hashModEventUnmute);
    }
    var hashModEventMuteReporter = "modEventMuteReporter";
    function isModEventMuteReporter(v) {
      return is$typed(v, id, hashModEventMuteReporter);
    }
    function validateModEventMuteReporter(v) {
      return validate(v, id, hashModEventMuteReporter);
    }
    var hashModEventUnmuteReporter = "modEventUnmuteReporter";
    function isModEventUnmuteReporter(v) {
      return is$typed(v, id, hashModEventUnmuteReporter);
    }
    function validateModEventUnmuteReporter(v) {
      return validate(v, id, hashModEventUnmuteReporter);
    }
    var hashModEventEmail = "modEventEmail";
    function isModEventEmail(v) {
      return is$typed(v, id, hashModEventEmail);
    }
    function validateModEventEmail(v) {
      return validate(v, id, hashModEventEmail);
    }
    var hashModEventDivert = "modEventDivert";
    function isModEventDivert(v) {
      return is$typed(v, id, hashModEventDivert);
    }
    function validateModEventDivert(v) {
      return validate(v, id, hashModEventDivert);
    }
    var hashModEventTag = "modEventTag";
    function isModEventTag(v) {
      return is$typed(v, id, hashModEventTag);
    }
    function validateModEventTag(v) {
      return validate(v, id, hashModEventTag);
    }
    var hashAccountEvent = "accountEvent";
    function isAccountEvent(v) {
      return is$typed(v, id, hashAccountEvent);
    }
    function validateAccountEvent(v) {
      return validate(v, id, hashAccountEvent);
    }
    var hashIdentityEvent = "identityEvent";
    function isIdentityEvent(v) {
      return is$typed(v, id, hashIdentityEvent);
    }
    function validateIdentityEvent(v) {
      return validate(v, id, hashIdentityEvent);
    }
    var hashRecordEvent = "recordEvent";
    function isRecordEvent(v) {
      return is$typed(v, id, hashRecordEvent);
    }
    function validateRecordEvent(v) {
      return validate(v, id, hashRecordEvent);
    }
    var hashRepoView = "repoView";
    function isRepoView(v) {
      return is$typed(v, id, hashRepoView);
    }
    function validateRepoView(v) {
      return validate(v, id, hashRepoView);
    }
    var hashRepoViewDetail = "repoViewDetail";
    function isRepoViewDetail(v) {
      return is$typed(v, id, hashRepoViewDetail);
    }
    function validateRepoViewDetail(v) {
      return validate(v, id, hashRepoViewDetail);
    }
    var hashRepoViewNotFound = "repoViewNotFound";
    function isRepoViewNotFound(v) {
      return is$typed(v, id, hashRepoViewNotFound);
    }
    function validateRepoViewNotFound(v) {
      return validate(v, id, hashRepoViewNotFound);
    }
    var hashRecordView = "recordView";
    function isRecordView(v) {
      return is$typed(v, id, hashRecordView);
    }
    function validateRecordView(v) {
      return validate(v, id, hashRecordView);
    }
    var hashRecordViewDetail = "recordViewDetail";
    function isRecordViewDetail(v) {
      return is$typed(v, id, hashRecordViewDetail);
    }
    function validateRecordViewDetail(v) {
      return validate(v, id, hashRecordViewDetail);
    }
    var hashRecordViewNotFound = "recordViewNotFound";
    function isRecordViewNotFound(v) {
      return is$typed(v, id, hashRecordViewNotFound);
    }
    function validateRecordViewNotFound(v) {
      return validate(v, id, hashRecordViewNotFound);
    }
    var hashModeration = "moderation";
    function isModeration(v) {
      return is$typed(v, id, hashModeration);
    }
    function validateModeration(v) {
      return validate(v, id, hashModeration);
    }
    var hashModerationDetail = "moderationDetail";
    function isModerationDetail(v) {
      return is$typed(v, id, hashModerationDetail);
    }
    function validateModerationDetail(v) {
      return validate(v, id, hashModerationDetail);
    }
    var hashBlobView = "blobView";
    function isBlobView(v) {
      return is$typed(v, id, hashBlobView);
    }
    function validateBlobView(v) {
      return validate(v, id, hashBlobView);
    }
    var hashImageDetails = "imageDetails";
    function isImageDetails(v) {
      return is$typed(v, id, hashImageDetails);
    }
    function validateImageDetails(v) {
      return validate(v, id, hashImageDetails);
    }
    var hashVideoDetails = "videoDetails";
    function isVideoDetails(v) {
      return is$typed(v, id, hashVideoDetails);
    }
    function validateVideoDetails(v) {
      return validate(v, id, hashVideoDetails);
    }
    var hashAccountHosting = "accountHosting";
    function isAccountHosting(v) {
      return is$typed(v, id, hashAccountHosting);
    }
    function validateAccountHosting(v) {
      return validate(v, id, hashAccountHosting);
    }
    var hashRecordHosting = "recordHosting";
    function isRecordHosting(v) {
      return is$typed(v, id, hashRecordHosting);
    }
    function validateRecordHosting(v) {
      return validate(v, id, hashRecordHosting);
    }
    var hashReporterStats = "reporterStats";
    function isReporterStats(v) {
      return is$typed(v, id, hashReporterStats);
    }
    function validateReporterStats(v) {
      return validate(v, id, hashReporterStats);
    }
    var hashModTool = "modTool";
    function isModTool(v) {
      return is$typed(v, id, hashModTool);
    }
    function validateModTool(v) {
      return validate(v, id, hashModTool);
    }
    exports.TIMELINEEVENTPLCCREATE = `${id}#timelineEventPlcCreate`;
    exports.TIMELINEEVENTPLCOPERATION = `${id}#timelineEventPlcOperation`;
    exports.TIMELINEEVENTPLCTOMBSTONE = `${id}#timelineEventPlcTombstone`;
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getEvent.js
var require_getEvent = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getEvent.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getRecords.js
var require_getRecords = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getRecords.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getReporterStats.js
var require_getReporterStats = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getReporterStats.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getRepos.js
var require_getRepos = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getRepos.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getSubjects.js
var require_getSubjects = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/getSubjects.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/queryEvents.js
var require_queryEvents = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/queryEvents.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/queryStatuses.js
var require_queryStatuses = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/queryStatuses.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/searchRepos.js
var require_searchRepos = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/moderation/searchRepos.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/report/defs.js
var require_defs21 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/report/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.REASONCIVICIMPERSONATION = exports.REASONCIVICMISINFORMATION = exports.REASONCIVICINTERFERENCE = exports.REASONCIVICDISCLOSURE = exports.REASONCIVICELECTORALPROCESS = exports.REASONRULEOTHER = exports.REASONRULEBANEVASION = exports.REASONRULEPROHIBITEDSALES = exports.REASONRULESTOLENCONTENT = exports.REASONRULESITESECURITY = exports.REASONMISLEADINGOTHER = exports.REASONMISLEADINGMISINFORMATION = exports.REASONMISLEADINGSYNTHETICCONTENT = exports.REASONMISLEADINGSCAM = exports.REASONMISLEADINGSPAM = exports.REASONMISLEADINGIMPERSONATION = exports.REASONMISLEADINGBOT = exports.REASONHARASSMENTOTHER = exports.REASONHARASSMENTDOXXING = exports.REASONHARASSMENTHATESPEECH = exports.REASONHARASSMENTTARGETED = exports.REASONHARASSMENTTROLL = exports.REASONCHILDSAFETYOTHER = exports.REASONCHILDSAFETYPROMOTION = exports.REASONCHILDSAFETYHARASSMENT = exports.REASONCHILDSAFETYENDANGERMENT = exports.REASONCHILDSAFETYMINORPRIVACY = exports.REASONCHILDSAFETYGROOM = exports.REASONCHILDSAFETYCSAM = exports.REASONSEXUALOTHER = exports.REASONSEXUALUNLABELED = exports.REASONSEXUALANIMAL = exports.REASONSEXUALDEEPFAKE = exports.REASONSEXUALSEXTORTION = exports.REASONSEXUALNCII = exports.REASONSEXUALABUSECONTENT = exports.REASONVIOLENCEOTHER = exports.REASONVIOLENCETRAFFICKING = exports.REASONVIOLENCEEXTREMISTCONTENT = exports.REASONVIOLENCEGLORIFICATION = exports.REASONVIOLENCESELFHARM = exports.REASONVIOLENCEGRAPHICCONTENT = exports.REASONVIOLENCETHREATS = exports.REASONVIOLENCEANIMALWELFARE = exports.REASONAPPEAL = void 0;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.report.defs";
    exports.REASONAPPEAL = `${id}#reasonAppeal`;
    exports.REASONVIOLENCEANIMALWELFARE = `${id}#reasonViolenceAnimalWelfare`;
    exports.REASONVIOLENCETHREATS = `${id}#reasonViolenceThreats`;
    exports.REASONVIOLENCEGRAPHICCONTENT = `${id}#reasonViolenceGraphicContent`;
    exports.REASONVIOLENCESELFHARM = `${id}#reasonViolenceSelfHarm`;
    exports.REASONVIOLENCEGLORIFICATION = `${id}#reasonViolenceGlorification`;
    exports.REASONVIOLENCEEXTREMISTCONTENT = `${id}#reasonViolenceExtremistContent`;
    exports.REASONVIOLENCETRAFFICKING = `${id}#reasonViolenceTrafficking`;
    exports.REASONVIOLENCEOTHER = `${id}#reasonViolenceOther`;
    exports.REASONSEXUALABUSECONTENT = `${id}#reasonSexualAbuseContent`;
    exports.REASONSEXUALNCII = `${id}#reasonSexualNCII`;
    exports.REASONSEXUALSEXTORTION = `${id}#reasonSexualSextortion`;
    exports.REASONSEXUALDEEPFAKE = `${id}#reasonSexualDeepfake`;
    exports.REASONSEXUALANIMAL = `${id}#reasonSexualAnimal`;
    exports.REASONSEXUALUNLABELED = `${id}#reasonSexualUnlabeled`;
    exports.REASONSEXUALOTHER = `${id}#reasonSexualOther`;
    exports.REASONCHILDSAFETYCSAM = `${id}#reasonChildSafetyCSAM`;
    exports.REASONCHILDSAFETYGROOM = `${id}#reasonChildSafetyGroom`;
    exports.REASONCHILDSAFETYMINORPRIVACY = `${id}#reasonChildSafetyMinorPrivacy`;
    exports.REASONCHILDSAFETYENDANGERMENT = `${id}#reasonChildSafetyEndangerment`;
    exports.REASONCHILDSAFETYHARASSMENT = `${id}#reasonChildSafetyHarassment`;
    exports.REASONCHILDSAFETYPROMOTION = `${id}#reasonChildSafetyPromotion`;
    exports.REASONCHILDSAFETYOTHER = `${id}#reasonChildSafetyOther`;
    exports.REASONHARASSMENTTROLL = `${id}#reasonHarassmentTroll`;
    exports.REASONHARASSMENTTARGETED = `${id}#reasonHarassmentTargeted`;
    exports.REASONHARASSMENTHATESPEECH = `${id}#reasonHarassmentHateSpeech`;
    exports.REASONHARASSMENTDOXXING = `${id}#reasonHarassmentDoxxing`;
    exports.REASONHARASSMENTOTHER = `${id}#reasonHarassmentOther`;
    exports.REASONMISLEADINGBOT = `${id}#reasonMisleadingBot`;
    exports.REASONMISLEADINGIMPERSONATION = `${id}#reasonMisleadingImpersonation`;
    exports.REASONMISLEADINGSPAM = `${id}#reasonMisleadingSpam`;
    exports.REASONMISLEADINGSCAM = `${id}#reasonMisleadingScam`;
    exports.REASONMISLEADINGSYNTHETICCONTENT = `${id}#reasonMisleadingSyntheticContent`;
    exports.REASONMISLEADINGMISINFORMATION = `${id}#reasonMisleadingMisinformation`;
    exports.REASONMISLEADINGOTHER = `${id}#reasonMisleadingOther`;
    exports.REASONRULESITESECURITY = `${id}#reasonRuleSiteSecurity`;
    exports.REASONRULESTOLENCONTENT = `${id}#reasonRuleStolenContent`;
    exports.REASONRULEPROHIBITEDSALES = `${id}#reasonRuleProhibitedSales`;
    exports.REASONRULEBANEVASION = `${id}#reasonRuleBanEvasion`;
    exports.REASONRULEOTHER = `${id}#reasonRuleOther`;
    exports.REASONCIVICELECTORALPROCESS = `${id}#reasonCivicElectoralProcess`;
    exports.REASONCIVICDISCLOSURE = `${id}#reasonCivicDisclosure`;
    exports.REASONCIVICINTERFERENCE = `${id}#reasonCivicInterference`;
    exports.REASONCIVICMISINFORMATION = `${id}#reasonCivicMisinformation`;
    exports.REASONCIVICIMPERSONATION = `${id}#reasonCivicImpersonation`;
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/defs.js
var require_defs22 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isEvent = isEvent;
    exports.validateEvent = validateEvent;
    exports.isUrlRule = isUrlRule;
    exports.validateUrlRule = validateUrlRule;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.safelink.defs";
    var hashEvent = "event";
    function isEvent(v) {
      return is$typed(v, id, hashEvent);
    }
    function validateEvent(v) {
      return validate(v, id, hashEvent);
    }
    var hashUrlRule = "urlRule";
    function isUrlRule(v) {
      return is$typed(v, id, hashUrlRule);
    }
    function validateUrlRule(v) {
      return validate(v, id, hashUrlRule);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/queryEvents.js
var require_queryEvents2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/queryEvents.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/queryRules.js
var require_queryRules = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/safelink/queryRules.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/server/getConfig.js
var require_getConfig2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/server/getConfig.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isServiceConfig = isServiceConfig;
    exports.validateServiceConfig = validateServiceConfig;
    exports.isViewerConfig = isViewerConfig;
    exports.validateViewerConfig = validateViewerConfig;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.server.getConfig";
    function toKnownErr(e) {
      return e;
    }
    var hashServiceConfig = "serviceConfig";
    function isServiceConfig(v) {
      return is$typed(v, id, hashServiceConfig);
    }
    function validateServiceConfig(v) {
      return validate(v, id, hashServiceConfig);
    }
    var hashViewerConfig = "viewerConfig";
    function isViewerConfig(v) {
      return is$typed(v, id, hashViewerConfig);
    }
    function validateViewerConfig(v) {
      return validate(v, id, hashViewerConfig);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/set/addValues.js
var require_addValues = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/set/addValues.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/set/defs.js
var require_defs23 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/set/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isSet = isSet;
    exports.validateSet = validateSet;
    exports.isSetView = isSetView;
    exports.validateSetView = validateSetView;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.set.defs";
    var hashSet = "set";
    function isSet(v) {
      return is$typed(v, id, hashSet);
    }
    function validateSet(v) {
      return validate(v, id, hashSet);
    }
    var hashSetView = "setView";
    function isSetView(v) {
      return is$typed(v, id, hashSetView);
    }
    function validateSetView(v) {
      return validate(v, id, hashSetView);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/set/querySets.js
var require_querySets = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/set/querySets.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/set/upsertSet.js
var require_upsertSet = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/set/upsertSet.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/setting/defs.js
var require_defs24 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/setting/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isOption = isOption;
    exports.validateOption = validateOption;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.setting.defs";
    var hashOption = "option";
    function isOption(v) {
      return is$typed(v, id, hashOption);
    }
    function validateOption(v) {
      return validate(v, id, hashOption);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/setting/listOptions.js
var require_listOptions = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/setting/listOptions.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/setting/removeOptions.js
var require_removeOptions = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/setting/removeOptions.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/setting/upsertOption.js
var require_upsertOption = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/setting/upsertOption.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/signature/defs.js
var require_defs25 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/signature/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isSigDetail = isSigDetail;
    exports.validateSigDetail = validateSigDetail;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.signature.defs";
    var hashSigDetail = "sigDetail";
    function isSigDetail(v) {
      return is$typed(v, id, hashSigDetail);
    }
    function validateSigDetail(v) {
      return validate(v, id, hashSigDetail);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/signature/findCorrelation.js
var require_findCorrelation = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/signature/findCorrelation.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/signature/findRelatedAccounts.js
var require_findRelatedAccounts = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/signature/findRelatedAccounts.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isRelatedAccount = isRelatedAccount;
    exports.validateRelatedAccount = validateRelatedAccount;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.signature.findRelatedAccounts";
    function toKnownErr(e) {
      return e;
    }
    var hashRelatedAccount = "relatedAccount";
    function isRelatedAccount(v) {
      return is$typed(v, id, hashRelatedAccount);
    }
    function validateRelatedAccount(v) {
      return validate(v, id, hashRelatedAccount);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/signature/searchAccounts.js
var require_searchAccounts2 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/signature/searchAccounts.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/team/defs.js
var require_defs26 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/team/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ROLEVERIFIER = exports.ROLETRIAGE = exports.ROLEMODERATOR = exports.ROLEADMIN = void 0;
    exports.isMember = isMember;
    exports.validateMember = validateMember;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.team.defs";
    var hashMember = "member";
    function isMember(v) {
      return is$typed(v, id, hashMember);
    }
    function validateMember(v) {
      return validate(v, id, hashMember);
    }
    exports.ROLEADMIN = `${id}#roleAdmin`;
    exports.ROLEMODERATOR = `${id}#roleModerator`;
    exports.ROLETRIAGE = `${id}#roleTriage`;
    exports.ROLEVERIFIER = `${id}#roleVerifier`;
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/team/listMembers.js
var require_listMembers = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/team/listMembers.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/verification/defs.js
var require_defs27 = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/verification/defs.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isVerificationView = isVerificationView;
    exports.validateVerificationView = validateVerificationView;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.verification.defs";
    var hashVerificationView = "verificationView";
    function isVerificationView(v) {
      return is$typed(v, id, hashVerificationView);
    }
    function validateVerificationView(v) {
      return validate(v, id, hashVerificationView);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/verification/grantVerifications.js
var require_grantVerifications = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/verification/grantVerifications.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isVerificationInput = isVerificationInput;
    exports.validateVerificationInput = validateVerificationInput;
    exports.isGrantError = isGrantError;
    exports.validateGrantError = validateGrantError;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.verification.grantVerifications";
    function toKnownErr(e) {
      return e;
    }
    var hashVerificationInput = "verificationInput";
    function isVerificationInput(v) {
      return is$typed(v, id, hashVerificationInput);
    }
    function validateVerificationInput(v) {
      return validate(v, id, hashVerificationInput);
    }
    var hashGrantError = "grantError";
    function isGrantError(v) {
      return is$typed(v, id, hashGrantError);
    }
    function validateGrantError(v) {
      return validate(v, id, hashGrantError);
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/verification/listVerifications.js
var require_listVerifications = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/verification/listVerifications.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    function toKnownErr(e) {
      return e;
    }
  }
});

// node_modules/@atproto/api/dist/client/types/tools/ozone/verification/revokeVerifications.js
var require_revokeVerifications = __commonJS({
  "node_modules/@atproto/api/dist/client/types/tools/ozone/verification/revokeVerifications.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toKnownErr = toKnownErr;
    exports.isRevokeError = isRevokeError;
    exports.validateRevokeError = validateRevokeError;
    var lexicons_1 = require_lexicons2();
    var util_1 = require_util5();
    var is$typed = util_1.is$typed;
    var validate = lexicons_1.validate;
    var id = "tools.ozone.verification.revokeVerifications";
    function toKnownErr(e) {
      return e;
    }
    var hashRevokeError = "revokeError";
    function isRevokeError(v) {
      return is$typed(v, id, hashRevokeError);
    }
    function validateRevokeError(v) {
      return validate(v, id, hashRevokeError);
    }
  }
});

// node_modules/@atproto/api/dist/client/index.js
var require_client2 = __commonJS({
  "node_modules/@atproto/api/dist/client/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __setModuleDefault2 = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    } : function(o, v) {
      o["default"] = v;
    });
    var __importStar2 = exports && exports.__importStar || /* @__PURE__ */ function() {
      var ownKeys2 = function(o) {
        ownKeys2 = 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 ownKeys2(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]);
        }
        __setModuleDefault2(result, mod);
        return result;
      };
    }();
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AppBskyGraphGetBlocks = exports.AppBskyGraphGetActorStarterPacks = exports.AppBskyGraphFollow = exports.AppBskyGraphDefs = exports.AppBskyGraphBlock = exports.AppBskyFeedThreadgate = exports.AppBskyFeedSendInteractions = exports.AppBskyFeedSearchPosts = exports.AppBskyFeedRepost = exports.AppBskyFeedPostgate = exports.AppBskyFeedPost = exports.AppBskyFeedLike = exports.AppBskyFeedGetTimeline = exports.AppBskyFeedGetSuggestedFeeds = exports.AppBskyFeedGetRepostedBy = exports.AppBskyFeedGetQuotes = exports.AppBskyFeedGetPosts = exports.AppBskyFeedGetPostThread = exports.AppBskyFeedGetListFeed = exports.AppBskyFeedGetLikes = exports.AppBskyFeedGetFeedSkeleton = exports.AppBskyFeedGetFeedGenerators = exports.AppBskyFeedGetFeedGenerator = exports.AppBskyFeedGetFeed = exports.AppBskyFeedGetAuthorFeed = exports.AppBskyFeedGetActorLikes = exports.AppBskyFeedGetActorFeeds = exports.AppBskyFeedGenerator = exports.AppBskyFeedDescribeFeedGenerator = exports.AppBskyFeedDefs = exports.AppBskyEmbedVideo = exports.AppBskyEmbedRecordWithMedia = exports.AppBskyEmbedRecord = exports.AppBskyEmbedImages = exports.AppBskyEmbedExternal = exports.AppBskyEmbedDefs = exports.AppBskyBookmarkGetBookmarks = exports.AppBskyBookmarkDeleteBookmark = exports.AppBskyBookmarkDefs = exports.AppBskyBookmarkCreateBookmark = exports.AppBskyActorStatus = exports.AppBskyActorSearchActorsTypeahead = exports.AppBskyActorSearchActors = exports.AppBskyActorPutPreferences = exports.AppBskyActorProfile = exports.AppBskyActorGetSuggestions = exports.AppBskyActorGetProfiles = exports.AppBskyActorGetProfile = exports.AppBskyActorGetPreferences = exports.AppBskyActorDefs = void 0;
    exports.AppBskyUnspeccedGetSuggestedFeedsSkeleton = exports.AppBskyUnspeccedGetSuggestedFeeds = exports.AppBskyUnspeccedGetPostThreadV2 = exports.AppBskyUnspeccedGetPostThreadOtherV2 = exports.AppBskyUnspeccedGetPopularFeedGenerators = exports.AppBskyUnspeccedGetConfig = exports.AppBskyUnspeccedGetAgeAssuranceState = exports.AppBskyUnspeccedDefs = exports.AppBskyRichtextFacet = exports.AppBskyNotificationUpdateSeen = exports.AppBskyNotificationUnregisterPush = exports.AppBskyNotificationRegisterPush = exports.AppBskyNotificationPutPreferencesV2 = exports.AppBskyNotificationPutPreferences = exports.AppBskyNotificationPutActivitySubscription = exports.AppBskyNotificationListNotifications = exports.AppBskyNotificationListActivitySubscriptions = exports.AppBskyNotificationGetUnreadCount = exports.AppBskyNotificationGetPreferences = exports.AppBskyNotificationDefs = exports.AppBskyNotificationDeclaration = exports.AppBskyLabelerService = exports.AppBskyLabelerGetServices = exports.AppBskyLabelerDefs = exports.AppBskyGraphVerification = exports.AppBskyGraphUnmuteThread = exports.AppBskyGraphUnmuteActorList = exports.AppBskyGraphUnmuteActor = exports.AppBskyGraphStarterpack = exports.AppBskyGraphSearchStarterPacks = exports.AppBskyGraphMuteThread = exports.AppBskyGraphMuteActorList = exports.AppBskyGraphMuteActor = exports.AppBskyGraphListitem = exports.AppBskyGraphListblock = exports.AppBskyGraphList = exports.AppBskyGraphGetSuggestedFollowsByActor = exports.AppBskyGraphGetStarterPacksWithMembership = exports.AppBskyGraphGetStarterPacks = exports.AppBskyGraphGetStarterPack = exports.AppBskyGraphGetRelationships = exports.AppBskyGraphGetMutes = exports.AppBskyGraphGetListsWithMembership = exports.AppBskyGraphGetLists = exports.AppBskyGraphGetListMutes = exports.AppBskyGraphGetListBlocks = exports.AppBskyGraphGetList = exports.AppBskyGraphGetKnownFollowers = exports.AppBskyGraphGetFollows = exports.AppBskyGraphGetFollowers = void 0;
    exports.ComAtprotoAdminGetInviteCodes = exports.ComAtprotoAdminGetAccountInfos = exports.ComAtprotoAdminGetAccountInfo = exports.ComAtprotoAdminEnableAccountInvites = exports.ComAtprotoAdminDisableInviteCodes = exports.ComAtprotoAdminDisableAccountInvites = exports.ComAtprotoAdminDeleteAccount = exports.ComAtprotoAdminDefs = exports.ChatBskyModerationUpdateActorAccess = exports.ChatBskyModerationGetMessageContext = exports.ChatBskyModerationGetActorMetadata = exports.ChatBskyConvoUpdateRead = exports.ChatBskyConvoUpdateAllRead = exports.ChatBskyConvoUnmuteConvo = exports.ChatBskyConvoSendMessageBatch = exports.ChatBskyConvoSendMessage = exports.ChatBskyConvoRemoveReaction = exports.ChatBskyConvoMuteConvo = exports.ChatBskyConvoListConvos = exports.ChatBskyConvoLeaveConvo = exports.ChatBskyConvoGetMessages = exports.ChatBskyConvoGetLog = exports.ChatBskyConvoGetConvoForMembers = exports.ChatBskyConvoGetConvoAvailability = exports.ChatBskyConvoGetConvo = exports.ChatBskyConvoDeleteMessageForSelf = exports.ChatBskyConvoDefs = exports.ChatBskyConvoAddReaction = exports.ChatBskyConvoAcceptConvo = exports.ChatBskyActorExportAccountData = exports.ChatBskyActorDeleteAccount = exports.ChatBskyActorDefs = exports.ChatBskyActorDeclaration = exports.AppBskyVideoUploadVideo = exports.AppBskyVideoGetUploadLimits = exports.AppBskyVideoGetJobStatus = exports.AppBskyVideoDefs = exports.AppBskyUnspeccedSearchStarterPacksSkeleton = exports.AppBskyUnspeccedSearchPostsSkeleton = exports.AppBskyUnspeccedSearchActorsSkeleton = exports.AppBskyUnspeccedInitAgeAssurance = exports.AppBskyUnspeccedGetTrendsSkeleton = exports.AppBskyUnspeccedGetTrends = exports.AppBskyUnspeccedGetTrendingTopics = exports.AppBskyUnspeccedGetTaggedSuggestions = exports.AppBskyUnspeccedGetSuggestionsSkeleton = exports.AppBskyUnspeccedGetSuggestedUsersSkeleton = exports.AppBskyUnspeccedGetSuggestedUsers = exports.AppBskyUnspeccedGetSuggestedStarterPacksSkeleton = exports.AppBskyUnspeccedGetSuggestedStarterPacks = void 0;
    exports.ComAtprotoServerGetAccountInviteCodes = exports.ComAtprotoServerDescribeServer = exports.ComAtprotoServerDeleteSession = exports.ComAtprotoServerDeleteAccount = exports.ComAtprotoServerDefs = exports.ComAtprotoServerDeactivateAccount = exports.ComAtprotoServerCreateSession = exports.ComAtprotoServerCreateInviteCodes = exports.ComAtprotoServerCreateInviteCode = exports.ComAtprotoServerCreateAppPassword = exports.ComAtprotoServerCreateAccount = exports.ComAtprotoServerConfirmEmail = exports.ComAtprotoServerCheckAccountStatus = exports.ComAtprotoServerActivateAccount = exports.ComAtprotoRepoUploadBlob = exports.ComAtprotoRepoStrongRef = exports.ComAtprotoRepoPutRecord = exports.ComAtprotoRepoListRecords = exports.ComAtprotoRepoListMissingBlobs = exports.ComAtprotoRepoImportRepo = exports.ComAtprotoRepoGetRecord = exports.ComAtprotoRepoDescribeRepo = exports.ComAtprotoRepoDeleteRecord = exports.ComAtprotoRepoDefs = exports.ComAtprotoRepoCreateRecord = exports.ComAtprotoRepoApplyWrites = exports.ComAtprotoModerationDefs = exports.ComAtprotoModerationCreateReport = exports.ComAtprotoLexiconSchema = exports.ComAtprotoLabelSubscribeLabels = exports.ComAtprotoLabelQueryLabels = exports.ComAtprotoLabelDefs = exports.ComAtprotoIdentityUpdateHandle = exports.ComAtprotoIdentitySubmitPlcOperation = exports.ComAtprotoIdentitySignPlcOperation = exports.ComAtprotoIdentityResolveIdentity = exports.ComAtprotoIdentityResolveHandle = exports.ComAtprotoIdentityResolveDid = exports.ComAtprotoIdentityRequestPlcOperationSignature = exports.ComAtprotoIdentityRefreshIdentity = exports.ComAtprotoIdentityGetRecommendedDidCredentials = exports.ComAtprotoIdentityDefs = exports.ComAtprotoAdminUpdateSubjectStatus = exports.ComAtprotoAdminUpdateAccountSigningKey = exports.ComAtprotoAdminUpdateAccountPassword = exports.ComAtprotoAdminUpdateAccountHandle = exports.ComAtprotoAdminUpdateAccountEmail = exports.ComAtprotoAdminSendEmail = exports.ComAtprotoAdminSearchAccounts = exports.ComAtprotoAdminGetSubjectStatus = void 0;
    exports.ToolsOzoneModerationGetReporterStats = exports.ToolsOzoneModerationGetRepo = exports.ToolsOzoneModerationGetRecords = exports.ToolsOzoneModerationGetRecord = exports.ToolsOzoneModerationGetEvent = exports.ToolsOzoneModerationGetAccountTimeline = exports.ToolsOzoneModerationEmitEvent = exports.ToolsOzoneModerationDefs = exports.ToolsOzoneHostingGetAccountHistory = exports.ToolsOzoneCommunicationUpdateTemplate = exports.ToolsOzoneCommunicationListTemplates = exports.ToolsOzoneCommunicationDeleteTemplate = exports.ToolsOzoneCommunicationDefs = exports.ToolsOzoneCommunicationCreateTemplate = exports.ComAtprotoTempRevokeAccountCredentials = exports.ComAtprotoTempRequestPhoneVerification = exports.ComAtprotoTempFetchLabels = exports.ComAtprotoTempDereferenceScope = exports.ComAtprotoTempCheckSignupQueue = exports.ComAtprotoTempCheckHandleAvailability = exports.ComAtprotoTempAddReservedHandle = exports.ComAtprotoSyncSubscribeRepos = exports.ComAtprotoSyncRequestCrawl = exports.ComAtprotoSyncNotifyOfUpdate = exports.ComAtprotoSyncListReposByCollection = exports.ComAtprotoSyncListRepos = exports.ComAtprotoSyncListHosts = exports.ComAtprotoSyncListBlobs = exports.ComAtprotoSyncGetRepoStatus = exports.ComAtprotoSyncGetRepo = exports.ComAtprotoSyncGetRecord = exports.ComAtprotoSyncGetLatestCommit = exports.ComAtprotoSyncGetHostStatus = exports.ComAtprotoSyncGetHead = exports.ComAtprotoSyncGetCheckout = exports.ComAtprotoSyncGetBlocks = exports.ComAtprotoSyncGetBlob = exports.ComAtprotoSyncDefs = exports.ComAtprotoServerUpdateEmail = exports.ComAtprotoServerRevokeAppPassword = exports.ComAtprotoServerResetPassword = exports.ComAtprotoServerReserveSigningKey = exports.ComAtprotoServerRequestPasswordReset = exports.ComAtprotoServerRequestEmailUpdate = exports.ComAtprotoServerRequestEmailConfirmation = exports.ComAtprotoServerRequestAccountDelete = exports.ComAtprotoServerRefreshSession = exports.ComAtprotoServerListAppPasswords = exports.ComAtprotoServerGetSession = exports.ComAtprotoServerGetServiceAuth = void 0;
    exports.AppBskyActorStatusRecord = exports.AppBskyActorProfileRecord = exports.AppBskyActorNS = exports.AppBskyNS = exports.AppNS = exports.AtpBaseClient = exports.TOOLS_OZONE_TEAM = exports.TOOLS_OZONE_REPORT = exports.TOOLS_OZONE_MODERATION = exports.COM_ATPROTO_MODERATION = exports.APP_BSKY_GRAPH = exports.APP_BSKY_FEED = exports.APP_BSKY_ACTOR = exports.ToolsOzoneVerificationRevokeVerifications = exports.ToolsOzoneVerificationListVerifications = exports.ToolsOzoneVerificationGrantVerifications = exports.ToolsOzoneVerificationDefs = exports.ToolsOzoneTeamUpdateMember = exports.ToolsOzoneTeamListMembers = exports.ToolsOzoneTeamDeleteMember = exports.ToolsOzoneTeamDefs = exports.ToolsOzoneTeamAddMember = exports.ToolsOzoneSignatureSearchAccounts = exports.ToolsOzoneSignatureFindRelatedAccounts = exports.ToolsOzoneSignatureFindCorrelation = exports.ToolsOzoneSignatureDefs = exports.ToolsOzoneSettingUpsertOption = exports.ToolsOzoneSettingRemoveOptions = exports.ToolsOzoneSettingListOptions = exports.ToolsOzoneSettingDefs = exports.ToolsOzoneSetUpsertSet = exports.ToolsOzoneSetQuerySets = exports.ToolsOzoneSetGetValues = exports.ToolsOzoneSetDeleteValues = exports.ToolsOzoneSetDeleteSet = exports.ToolsOzoneSetDefs = exports.ToolsOzoneSetAddValues = exports.ToolsOzoneServerGetConfig = exports.ToolsOzoneSafelinkUpdateRule = exports.ToolsOzoneSafelinkRemoveRule = exports.ToolsOzoneSafelinkQueryRules = exports.ToolsOzoneSafelinkQueryEvents = exports.ToolsOzoneSafelinkDefs = exports.ToolsOzoneSafelinkAddRule = exports.ToolsOzoneReportDefs = exports.ToolsOzoneModerationSearchRepos = exports.ToolsOzoneModerationQueryStatuses = exports.ToolsOzoneModerationQueryEvents = exports.ToolsOzoneModerationGetSubjects = exports.ToolsOzoneModerationGetRepos = void 0;
    exports.ToolsOzoneSetNS = exports.ToolsOzoneServerNS = exports.ToolsOzoneSafelinkNS = exports.ToolsOzoneModerationNS = exports.ToolsOzoneHostingNS = exports.ToolsOzoneCommunicationNS = exports.ToolsOzoneNS = exports.ToolsNS = exports.ComAtprotoTempNS = exports.ComAtprotoSyncNS = exports.ComAtprotoServerNS = exports.ComAtprotoRepoNS = exports.ComAtprotoModerationNS = exports.ComAtprotoLexiconSchemaRecord = exports.ComAtprotoLexiconNS = exports.ComAtprotoLabelNS = exports.ComAtprotoIdentityNS = exports.ComAtprotoAdminNS = exports.ComAtprotoNS = exports.ComNS = exports.ChatBskyModerationNS = exports.ChatBskyConvoNS = exports.ChatBskyActorDeclarationRecord = exports.ChatBskyActorNS = exports.ChatBskyNS = exports.ChatNS = exports.AppBskyVideoNS = exports.AppBskyUnspeccedNS = exports.AppBskyRichtextNS = exports.AppBskyNotificationDeclarationRecord = exports.AppBskyNotificationNS = exports.AppBskyLabelerServiceRecord = exports.AppBskyLabelerNS = exports.AppBskyGraphVerificationRecord = exports.AppBskyGraphStarterpackRecord = exports.AppBskyGraphListitemRecord = exports.AppBskyGraphListblockRecord = exports.AppBskyGraphListRecord = exports.AppBskyGraphFollowRecord = exports.AppBskyGraphBlockRecord = exports.AppBskyGraphNS = exports.AppBskyFeedThreadgateRecord = exports.AppBskyFeedRepostRecord = exports.AppBskyFeedPostgateRecord = exports.AppBskyFeedPostRecord = exports.AppBskyFeedLikeRecord = exports.AppBskyFeedGeneratorRecord = exports.AppBskyFeedNS = exports.AppBskyEmbedNS = exports.AppBskyBookmarkNS = void 0;
    exports.ToolsOzoneVerificationNS = exports.ToolsOzoneTeamNS = exports.ToolsOzoneSignatureNS = exports.ToolsOzoneSettingNS = void 0;
    var xrpc_1 = require_dist10();
    var lexicons_js_1 = require_lexicons2();
    var AppBskyBookmarkCreateBookmark = __importStar2(require_createBookmark());
    var AppBskyBookmarkDeleteBookmark = __importStar2(require_deleteBookmark());
    var AppBskyFeedGetActorLikes = __importStar2(require_getActorLikes());
    var AppBskyFeedGetAuthorFeed = __importStar2(require_getAuthorFeed());
    var AppBskyFeedGetFeed = __importStar2(require_getFeed());
    var AppBskyFeedGetFeedSkeleton = __importStar2(require_getFeedSkeleton());
    var AppBskyFeedGetListFeed = __importStar2(require_getListFeed());
    var AppBskyFeedGetPostThread = __importStar2(require_getPostThread());
    var AppBskyFeedSearchPosts = __importStar2(require_searchPosts());
    var AppBskyGraphGetRelationships = __importStar2(require_getRelationships());
    var AppBskyUnspeccedInitAgeAssurance = __importStar2(require_initAgeAssurance());
    var AppBskyUnspeccedSearchActorsSkeleton = __importStar2(require_searchActorsSkeleton());
    var AppBskyUnspeccedSearchPostsSkeleton = __importStar2(require_searchPostsSkeleton());
    var AppBskyUnspeccedSearchStarterPacksSkeleton = __importStar2(require_searchStarterPacksSkeleton());
    var ChatBskyConvoAddReaction = __importStar2(require_addReaction());
    var ChatBskyConvoRemoveReaction = __importStar2(require_removeReaction());
    var ComAtprotoIdentityRefreshIdentity = __importStar2(require_refreshIdentity());
    var ComAtprotoIdentityResolveDid = __importStar2(require_resolveDid());
    var ComAtprotoIdentityResolveHandle = __importStar2(require_resolveHandle());
    var ComAtprotoIdentityResolveIdentity = __importStar2(require_resolveIdentity());
    var ComAtprotoRepoApplyWrites = __importStar2(require_applyWrites());
    var ComAtprotoRepoCreateRecord = __importStar2(require_createRecord());
    var ComAtprotoRepoDeleteRecord = __importStar2(require_deleteRecord());
    var ComAtprotoRepoGetRecord = __importStar2(require_getRecord());
    var ComAtprotoRepoPutRecord = __importStar2(require_putRecord());
    var ComAtprotoServerConfirmEmail = __importStar2(require_confirmEmail());
    var ComAtprotoServerCreateAccount = __importStar2(require_createAccount());
    var ComAtprotoServerCreateAppPassword = __importStar2(require_createAppPassword());
    var ComAtprotoServerCreateSession = __importStar2(require_createSession());
    var ComAtprotoServerDeleteAccount = __importStar2(require_deleteAccount());
    var ComAtprotoServerGetAccountInviteCodes = __importStar2(require_getAccountInviteCodes());
    var ComAtprotoServerGetServiceAuth = __importStar2(require_getServiceAuth());
    var ComAtprotoServerListAppPasswords = __importStar2(require_listAppPasswords());
    var ComAtprotoServerRefreshSession = __importStar2(require_refreshSession());
    var ComAtprotoServerResetPassword = __importStar2(require_resetPassword());
    var ComAtprotoServerUpdateEmail = __importStar2(require_updateEmail());
    var ComAtprotoSyncGetBlob = __importStar2(require_getBlob());
    var ComAtprotoSyncGetBlocks = __importStar2(require_getBlocks());
    var ComAtprotoSyncGetHead = __importStar2(require_getHead());
    var ComAtprotoSyncGetHostStatus = __importStar2(require_getHostStatus());
    var ComAtprotoSyncGetLatestCommit = __importStar2(require_getLatestCommit());
    var ComAtprotoSyncGetRecord = __importStar2(require_getRecord2());
    var ComAtprotoSyncGetRepo = __importStar2(require_getRepo());
    var ComAtprotoSyncGetRepoStatus = __importStar2(require_getRepoStatus());
    var ComAtprotoSyncListBlobs = __importStar2(require_listBlobs());
    var ComAtprotoSyncRequestCrawl = __importStar2(require_requestCrawl());
    var ComAtprotoTempCheckHandleAvailability = __importStar2(require_checkHandleAvailability());
    var ComAtprotoTempDereferenceScope = __importStar2(require_dereferenceScope());
    var ToolsOzoneCommunicationCreateTemplate = __importStar2(require_createTemplate());
    var ToolsOzoneCommunicationUpdateTemplate = __importStar2(require_updateTemplate());
    var ToolsOzoneModerationEmitEvent = __importStar2(require_emitEvent());
    var ToolsOzoneModerationGetAccountTimeline = __importStar2(require_getAccountTimeline());
    var ToolsOzoneModerationGetRecord = __importStar2(require_getRecord3());
    var ToolsOzoneModerationGetRepo = __importStar2(require_getRepo2());
    var ToolsOzoneSafelinkAddRule = __importStar2(require_addRule());
    var ToolsOzoneSafelinkRemoveRule = __importStar2(require_removeRule());
    var ToolsOzoneSafelinkUpdateRule = __importStar2(require_updateRule());
    var ToolsOzoneSetDeleteSet = __importStar2(require_deleteSet());
    var ToolsOzoneSetDeleteValues = __importStar2(require_deleteValues());
    var ToolsOzoneSetGetValues = __importStar2(require_getValues());
    var ToolsOzoneTeamAddMember = __importStar2(require_addMember());
    var ToolsOzoneTeamDeleteMember = __importStar2(require_deleteMember());
    var ToolsOzoneTeamUpdateMember = __importStar2(require_updateMember());
    exports.AppBskyActorDefs = __importStar2(require_defs());
    exports.AppBskyActorGetPreferences = __importStar2(require_getPreferences());
    exports.AppBskyActorGetProfile = __importStar2(require_getProfile());
    exports.AppBskyActorGetProfiles = __importStar2(require_getProfiles());
    exports.AppBskyActorGetSuggestions = __importStar2(require_getSuggestions());
    exports.AppBskyActorProfile = __importStar2(require_profile());
    exports.AppBskyActorPutPreferences = __importStar2(require_putPreferences());
    exports.AppBskyActorSearchActors = __importStar2(require_searchActors());
    exports.AppBskyActorSearchActorsTypeahead = __importStar2(require_searchActorsTypeahead());
    exports.AppBskyActorStatus = __importStar2(require_status());
    exports.AppBskyBookmarkCreateBookmark = __importStar2(require_createBookmark());
    exports.AppBskyBookmarkDefs = __importStar2(require_defs2());
    exports.AppBskyBookmarkDeleteBookmark = __importStar2(require_deleteBookmark());
    exports.AppBskyBookmarkGetBookmarks = __importStar2(require_getBookmarks());
    exports.AppBskyEmbedDefs = __importStar2(require_defs3());
    exports.AppBskyEmbedExternal = __importStar2(require_external2());
    exports.AppBskyEmbedImages = __importStar2(require_images());
    exports.AppBskyEmbedRecord = __importStar2(require_record());
    exports.AppBskyEmbedRecordWithMedia = __importStar2(require_recordWithMedia());
    exports.AppBskyEmbedVideo = __importStar2(require_video());
    exports.AppBskyFeedDefs = __importStar2(require_defs4());
    exports.AppBskyFeedDescribeFeedGenerator = __importStar2(require_describeFeedGenerator());
    exports.AppBskyFeedGenerator = __importStar2(require_generator());
    exports.AppBskyFeedGetActorFeeds = __importStar2(require_getActorFeeds());
    exports.AppBskyFeedGetActorLikes = __importStar2(require_getActorLikes());
    exports.AppBskyFeedGetAuthorFeed = __importStar2(require_getAuthorFeed());
    exports.AppBskyFeedGetFeed = __importStar2(require_getFeed());
    exports.AppBskyFeedGetFeedGenerator = __importStar2(require_getFeedGenerator());
    exports.AppBskyFeedGetFeedGenerators = __importStar2(require_getFeedGenerators());
    exports.AppBskyFeedGetFeedSkeleton = __importStar2(require_getFeedSkeleton());
    exports.AppBskyFeedGetLikes = __importStar2(require_getLikes());
    exports.AppBskyFeedGetListFeed = __importStar2(require_getListFeed());
    exports.AppBskyFeedGetPostThread = __importStar2(require_getPostThread());
    exports.AppBskyFeedGetPosts = __importStar2(require_getPosts());
    exports.AppBskyFeedGetQuotes = __importStar2(require_getQuotes());
    exports.AppBskyFeedGetRepostedBy = __importStar2(require_getRepostedBy());
    exports.AppBskyFeedGetSuggestedFeeds = __importStar2(require_getSuggestedFeeds());
    exports.AppBskyFeedGetTimeline = __importStar2(require_getTimeline());
    exports.AppBskyFeedLike = __importStar2(require_like());
    exports.AppBskyFeedPost = __importStar2(require_post());
    exports.AppBskyFeedPostgate = __importStar2(require_postgate());
    exports.AppBskyFeedRepost = __importStar2(require_repost());
    exports.AppBskyFeedSearchPosts = __importStar2(require_searchPosts());
    exports.AppBskyFeedSendInteractions = __importStar2(require_sendInteractions());
    exports.AppBskyFeedThreadgate = __importStar2(require_threadgate());
    exports.AppBskyGraphBlock = __importStar2(require_block());
    exports.AppBskyGraphDefs = __importStar2(require_defs5());
    exports.AppBskyGraphFollow = __importStar2(require_follow());
    exports.AppBskyGraphGetActorStarterPacks = __importStar2(require_getActorStarterPacks());
    exports.AppBskyGraphGetBlocks = __importStar2(require_getBlocks2());
    exports.AppBskyGraphGetFollowers = __importStar2(require_getFollowers());
    exports.AppBskyGraphGetFollows = __importStar2(require_getFollows());
    exports.AppBskyGraphGetKnownFollowers = __importStar2(require_getKnownFollowers());
    exports.AppBskyGraphGetList = __importStar2(require_getList());
    exports.AppBskyGraphGetListBlocks = __importStar2(require_getListBlocks());
    exports.AppBskyGraphGetListMutes = __importStar2(require_getListMutes());
    exports.AppBskyGraphGetLists = __importStar2(require_getLists());
    exports.AppBskyGraphGetListsWithMembership = __importStar2(require_getListsWithMembership());
    exports.AppBskyGraphGetMutes = __importStar2(require_getMutes());
    exports.AppBskyGraphGetRelationships = __importStar2(require_getRelationships());
    exports.AppBskyGraphGetStarterPack = __importStar2(require_getStarterPack());
    exports.AppBskyGraphGetStarterPacks = __importStar2(require_getStarterPacks());
    exports.AppBskyGraphGetStarterPacksWithMembership = __importStar2(require_getStarterPacksWithMembership());
    exports.AppBskyGraphGetSuggestedFollowsByActor = __importStar2(require_getSuggestedFollowsByActor());
    exports.AppBskyGraphList = __importStar2(require_list());
    exports.AppBskyGraphListblock = __importStar2(require_listblock());
    exports.AppBskyGraphListitem = __importStar2(require_listitem());
    exports.AppBskyGraphMuteActor = __importStar2(require_muteActor());
    exports.AppBskyGraphMuteActorList = __importStar2(require_muteActorList());
    exports.AppBskyGraphMuteThread = __importStar2(require_muteThread());
    exports.AppBskyGraphSearchStarterPacks = __importStar2(require_searchStarterPacks());
    exports.AppBskyGraphStarterpack = __importStar2(require_starterpack());
    exports.AppBskyGraphUnmuteActor = __importStar2(require_unmuteActor());
    exports.AppBskyGraphUnmuteActorList = __importStar2(require_unmuteActorList());
    exports.AppBskyGraphUnmuteThread = __importStar2(require_unmuteThread());
    exports.AppBskyGraphVerification = __importStar2(require_verification());
    exports.AppBskyLabelerDefs = __importStar2(require_defs6());
    exports.AppBskyLabelerGetServices = __importStar2(require_getServices());
    exports.AppBskyLabelerService = __importStar2(require_service());
    exports.AppBskyNotificationDeclaration = __importStar2(require_declaration());
    exports.AppBskyNotificationDefs = __importStar2(require_defs7());
    exports.AppBskyNotificationGetPreferences = __importStar2(require_getPreferences2());
    exports.AppBskyNotificationGetUnreadCount = __importStar2(require_getUnreadCount());
    exports.AppBskyNotificationListActivitySubscriptions = __importStar2(require_listActivitySubscriptions());
    exports.AppBskyNotificationListNotifications = __importStar2(require_listNotifications());
    exports.AppBskyNotificationPutActivitySubscription = __importStar2(require_putActivitySubscription());
    exports.AppBskyNotificationPutPreferences = __importStar2(require_putPreferences2());
    exports.AppBskyNotificationPutPreferencesV2 = __importStar2(require_putPreferencesV2());
    exports.AppBskyNotificationRegisterPush = __importStar2(require_registerPush());
    exports.AppBskyNotificationUnregisterPush = __importStar2(require_unregisterPush());
    exports.AppBskyNotificationUpdateSeen = __importStar2(require_updateSeen());
    exports.AppBskyRichtextFacet = __importStar2(require_facet());
    exports.AppBskyUnspeccedDefs = __importStar2(require_defs8());
    exports.AppBskyUnspeccedGetAgeAssuranceState = __importStar2(require_getAgeAssuranceState());
    exports.AppBskyUnspeccedGetConfig = __importStar2(require_getConfig());
    exports.AppBskyUnspeccedGetPopularFeedGenerators = __importStar2(require_getPopularFeedGenerators());
    exports.AppBskyUnspeccedGetPostThreadOtherV2 = __importStar2(require_getPostThreadOtherV2());
    exports.AppBskyUnspeccedGetPostThreadV2 = __importStar2(require_getPostThreadV2());
    exports.AppBskyUnspeccedGetSuggestedFeeds = __importStar2(require_getSuggestedFeeds2());
    exports.AppBskyUnspeccedGetSuggestedFeedsSkeleton = __importStar2(require_getSuggestedFeedsSkeleton());
    exports.AppBskyUnspeccedGetSuggestedStarterPacks = __importStar2(require_getSuggestedStarterPacks());
    exports.AppBskyUnspeccedGetSuggestedStarterPacksSkeleton = __importStar2(require_getSuggestedStarterPacksSkeleton());
    exports.AppBskyUnspeccedGetSuggestedUsers = __importStar2(require_getSuggestedUsers());
    exports.AppBskyUnspeccedGetSuggestedUsersSkeleton = __importStar2(require_getSuggestedUsersSkeleton());
    exports.AppBskyUnspeccedGetSuggestionsSkeleton = __importStar2(require_getSuggestionsSkeleton());
    exports.AppBskyUnspeccedGetTaggedSuggestions = __importStar2(require_getTaggedSuggestions());
    exports.AppBskyUnspeccedGetTrendingTopics = __importStar2(require_getTrendingTopics());
    exports.AppBskyUnspeccedGetTrends = __importStar2(require_getTrends());
    exports.AppBskyUnspeccedGetTrendsSkeleton = __importStar2(require_getTrendsSkeleton());
    exports.AppBskyUnspeccedInitAgeAssurance = __importStar2(require_initAgeAssurance());
    exports.AppBskyUnspeccedSearchActorsSkeleton = __importStar2(require_searchActorsSkeleton());
    exports.AppBskyUnspeccedSearchPostsSkeleton = __importStar2(require_searchPostsSkeleton());
    exports.AppBskyUnspeccedSearchStarterPacksSkeleton = __importStar2(require_searchStarterPacksSkeleton());
    exports.AppBskyVideoDefs = __importStar2(require_defs9());
    exports.AppBskyVideoGetJobStatus = __importStar2(require_getJobStatus());
    exports.AppBskyVideoGetUploadLimits = __importStar2(require_getUploadLimits());
    exports.AppBskyVideoUploadVideo = __importStar2(require_uploadVideo());
    exports.ChatBskyActorDeclaration = __importStar2(require_declaration2());
    exports.ChatBskyActorDefs = __importStar2(require_defs10());
    exports.ChatBskyActorDeleteAccount = __importStar2(require_deleteAccount2());
    exports.ChatBskyActorExportAccountData = __importStar2(require_exportAccountData());
    exports.ChatBskyConvoAcceptConvo = __importStar2(require_acceptConvo());
    exports.ChatBskyConvoAddReaction = __importStar2(require_addReaction());
    exports.ChatBskyConvoDefs = __importStar2(require_defs11());
    exports.ChatBskyConvoDeleteMessageForSelf = __importStar2(require_deleteMessageForSelf());
    exports.ChatBskyConvoGetConvo = __importStar2(require_getConvo());
    exports.ChatBskyConvoGetConvoAvailability = __importStar2(require_getConvoAvailability());
    exports.ChatBskyConvoGetConvoForMembers = __importStar2(require_getConvoForMembers());
    exports.ChatBskyConvoGetLog = __importStar2(require_getLog());
    exports.ChatBskyConvoGetMessages = __importStar2(require_getMessages());
    exports.ChatBskyConvoLeaveConvo = __importStar2(require_leaveConvo());
    exports.ChatBskyConvoListConvos = __importStar2(require_listConvos());
    exports.ChatBskyConvoMuteConvo = __importStar2(require_muteConvo());
    exports.ChatBskyConvoRemoveReaction = __importStar2(require_removeReaction());
    exports.ChatBskyConvoSendMessage = __importStar2(require_sendMessage());
    exports.ChatBskyConvoSendMessageBatch = __importStar2(require_sendMessageBatch());
    exports.ChatBskyConvoUnmuteConvo = __importStar2(require_unmuteConvo());
    exports.ChatBskyConvoUpdateAllRead = __importStar2(require_updateAllRead());
    exports.ChatBskyConvoUpdateRead = __importStar2(require_updateRead());
    exports.ChatBskyModerationGetActorMetadata = __importStar2(require_getActorMetadata());
    exports.ChatBskyModerationGetMessageContext = __importStar2(require_getMessageContext());
    exports.ChatBskyModerationUpdateActorAccess = __importStar2(require_updateActorAccess());
    exports.ComAtprotoAdminDefs = __importStar2(require_defs12());
    exports.ComAtprotoAdminDeleteAccount = __importStar2(require_deleteAccount3());
    exports.ComAtprotoAdminDisableAccountInvites = __importStar2(require_disableAccountInvites());
    exports.ComAtprotoAdminDisableInviteCodes = __importStar2(require_disableInviteCodes());
    exports.ComAtprotoAdminEnableAccountInvites = __importStar2(require_enableAccountInvites());
    exports.ComAtprotoAdminGetAccountInfo = __importStar2(require_getAccountInfo());
    exports.ComAtprotoAdminGetAccountInfos = __importStar2(require_getAccountInfos());
    exports.ComAtprotoAdminGetInviteCodes = __importStar2(require_getInviteCodes());
    exports.ComAtprotoAdminGetSubjectStatus = __importStar2(require_getSubjectStatus());
    exports.ComAtprotoAdminSearchAccounts = __importStar2(require_searchAccounts());
    exports.ComAtprotoAdminSendEmail = __importStar2(require_sendEmail());
    exports.ComAtprotoAdminUpdateAccountEmail = __importStar2(require_updateAccountEmail());
    exports.ComAtprotoAdminUpdateAccountHandle = __importStar2(require_updateAccountHandle());
    exports.ComAtprotoAdminUpdateAccountPassword = __importStar2(require_updateAccountPassword());
    exports.ComAtprotoAdminUpdateAccountSigningKey = __importStar2(require_updateAccountSigningKey());
    exports.ComAtprotoAdminUpdateSubjectStatus = __importStar2(require_updateSubjectStatus());
    exports.ComAtprotoIdentityDefs = __importStar2(require_defs13());
    exports.ComAtprotoIdentityGetRecommendedDidCredentials = __importStar2(require_getRecommendedDidCredentials());
    exports.ComAtprotoIdentityRefreshIdentity = __importStar2(require_refreshIdentity());
    exports.ComAtprotoIdentityRequestPlcOperationSignature = __importStar2(require_requestPlcOperationSignature());
    exports.ComAtprotoIdentityResolveDid = __importStar2(require_resolveDid());
    exports.ComAtprotoIdentityResolveHandle = __importStar2(require_resolveHandle());
    exports.ComAtprotoIdentityResolveIdentity = __importStar2(require_resolveIdentity());
    exports.ComAtprotoIdentitySignPlcOperation = __importStar2(require_signPlcOperation());
    exports.ComAtprotoIdentitySubmitPlcOperation = __importStar2(require_submitPlcOperation());
    exports.ComAtprotoIdentityUpdateHandle = __importStar2(require_updateHandle());
    exports.ComAtprotoLabelDefs = __importStar2(require_defs14());
    exports.ComAtprotoLabelQueryLabels = __importStar2(require_queryLabels());
    exports.ComAtprotoLabelSubscribeLabels = __importStar2(require_subscribeLabels());
    exports.ComAtprotoLexiconSchema = __importStar2(require_schema());
    exports.ComAtprotoModerationCreateReport = __importStar2(require_createReport());
    exports.ComAtprotoModerationDefs = __importStar2(require_defs15());
    exports.ComAtprotoRepoApplyWrites = __importStar2(require_applyWrites());
    exports.ComAtprotoRepoCreateRecord = __importStar2(require_createRecord());
    exports.ComAtprotoRepoDefs = __importStar2(require_defs16());
    exports.ComAtprotoRepoDeleteRecord = __importStar2(require_deleteRecord());
    exports.ComAtprotoRepoDescribeRepo = __importStar2(require_describeRepo());
    exports.ComAtprotoRepoGetRecord = __importStar2(require_getRecord());
    exports.ComAtprotoRepoImportRepo = __importStar2(require_importRepo());
    exports.ComAtprotoRepoListMissingBlobs = __importStar2(require_listMissingBlobs());
    exports.ComAtprotoRepoListRecords = __importStar2(require_listRecords());
    exports.ComAtprotoRepoPutRecord = __importStar2(require_putRecord());
    exports.ComAtprotoRepoStrongRef = __importStar2(require_strongRef());
    exports.ComAtprotoRepoUploadBlob = __importStar2(require_uploadBlob());
    exports.ComAtprotoServerActivateAccount = __importStar2(require_activateAccount());
    exports.ComAtprotoServerCheckAccountStatus = __importStar2(require_checkAccountStatus());
    exports.ComAtprotoServerConfirmEmail = __importStar2(require_confirmEmail());
    exports.ComAtprotoServerCreateAccount = __importStar2(require_createAccount());
    exports.ComAtprotoServerCreateAppPassword = __importStar2(require_createAppPassword());
    exports.ComAtprotoServerCreateInviteCode = __importStar2(require_createInviteCode());
    exports.ComAtprotoServerCreateInviteCodes = __importStar2(require_createInviteCodes());
    exports.ComAtprotoServerCreateSession = __importStar2(require_createSession());
    exports.ComAtprotoServerDeactivateAccount = __importStar2(require_deactivateAccount());
    exports.ComAtprotoServerDefs = __importStar2(require_defs17());
    exports.ComAtprotoServerDeleteAccount = __importStar2(require_deleteAccount());
    exports.ComAtprotoServerDeleteSession = __importStar2(require_deleteSession());
    exports.ComAtprotoServerDescribeServer = __importStar2(require_describeServer());
    exports.ComAtprotoServerGetAccountInviteCodes = __importStar2(require_getAccountInviteCodes());
    exports.ComAtprotoServerGetServiceAuth = __importStar2(require_getServiceAuth());
    exports.ComAtprotoServerGetSession = __importStar2(require_getSession());
    exports.ComAtprotoServerListAppPasswords = __importStar2(require_listAppPasswords());
    exports.ComAtprotoServerRefreshSession = __importStar2(require_refreshSession());
    exports.ComAtprotoServerRequestAccountDelete = __importStar2(require_requestAccountDelete());
    exports.ComAtprotoServerRequestEmailConfirmation = __importStar2(require_requestEmailConfirmation());
    exports.ComAtprotoServerRequestEmailUpdate = __importStar2(require_requestEmailUpdate());
    exports.ComAtprotoServerRequestPasswordReset = __importStar2(require_requestPasswordReset());
    exports.ComAtprotoServerReserveSigningKey = __importStar2(require_reserveSigningKey());
    exports.ComAtprotoServerResetPassword = __importStar2(require_resetPassword());
    exports.ComAtprotoServerRevokeAppPassword = __importStar2(require_revokeAppPassword());
    exports.ComAtprotoServerUpdateEmail = __importStar2(require_updateEmail());
    exports.ComAtprotoSyncDefs = __importStar2(require_defs18());
    exports.ComAtprotoSyncGetBlob = __importStar2(require_getBlob());
    exports.ComAtprotoSyncGetBlocks = __importStar2(require_getBlocks());
    exports.ComAtprotoSyncGetCheckout = __importStar2(require_getCheckout());
    exports.ComAtprotoSyncGetHead = __importStar2(require_getHead());
    exports.ComAtprotoSyncGetHostStatus = __importStar2(require_getHostStatus());
    exports.ComAtprotoSyncGetLatestCommit = __importStar2(require_getLatestCommit());
    exports.ComAtprotoSyncGetRecord = __importStar2(require_getRecord2());
    exports.ComAtprotoSyncGetRepo = __importStar2(require_getRepo());
    exports.ComAtprotoSyncGetRepoStatus = __importStar2(require_getRepoStatus());
    exports.ComAtprotoSyncListBlobs = __importStar2(require_listBlobs());
    exports.ComAtprotoSyncListHosts = __importStar2(require_listHosts());
    exports.ComAtprotoSyncListRepos = __importStar2(require_listRepos());
    exports.ComAtprotoSyncListReposByCollection = __importStar2(require_listReposByCollection());
    exports.ComAtprotoSyncNotifyOfUpdate = __importStar2(require_notifyOfUpdate());
    exports.ComAtprotoSyncRequestCrawl = __importStar2(require_requestCrawl());
    exports.ComAtprotoSyncSubscribeRepos = __importStar2(require_subscribeRepos());
    exports.ComAtprotoTempAddReservedHandle = __importStar2(require_addReservedHandle());
    exports.ComAtprotoTempCheckHandleAvailability = __importStar2(require_checkHandleAvailability());
    exports.ComAtprotoTempCheckSignupQueue = __importStar2(require_checkSignupQueue());
    exports.ComAtprotoTempDereferenceScope = __importStar2(require_dereferenceScope());
    exports.ComAtprotoTempFetchLabels = __importStar2(require_fetchLabels());
    exports.ComAtprotoTempRequestPhoneVerification = __importStar2(require_requestPhoneVerification());
    exports.ComAtprotoTempRevokeAccountCredentials = __importStar2(require_revokeAccountCredentials());
    exports.ToolsOzoneCommunicationCreateTemplate = __importStar2(require_createTemplate());
    exports.ToolsOzoneCommunicationDefs = __importStar2(require_defs19());
    exports.ToolsOzoneCommunicationDeleteTemplate = __importStar2(require_deleteTemplate());
    exports.ToolsOzoneCommunicationListTemplates = __importStar2(require_listTemplates());
    exports.ToolsOzoneCommunicationUpdateTemplate = __importStar2(require_updateTemplate());
    exports.ToolsOzoneHostingGetAccountHistory = __importStar2(require_getAccountHistory());
    exports.ToolsOzoneModerationDefs = __importStar2(require_defs20());
    exports.ToolsOzoneModerationEmitEvent = __importStar2(require_emitEvent());
    exports.ToolsOzoneModerationGetAccountTimeline = __importStar2(require_getAccountTimeline());
    exports.ToolsOzoneModerationGetEvent = __importStar2(require_getEvent());
    exports.ToolsOzoneModerationGetRecord = __importStar2(require_getRecord3());
    exports.ToolsOzoneModerationGetRecords = __importStar2(require_getRecords());
    exports.ToolsOzoneModerationGetRepo = __importStar2(require_getRepo2());
    exports.ToolsOzoneModerationGetReporterStats = __importStar2(require_getReporterStats());
    exports.ToolsOzoneModerationGetRepos = __importStar2(require_getRepos());
    exports.ToolsOzoneModerationGetSubjects = __importStar2(require_getSubjects());
    exports.ToolsOzoneModerationQueryEvents = __importStar2(require_queryEvents());
    exports.ToolsOzoneModerationQueryStatuses = __importStar2(require_queryStatuses());
    exports.ToolsOzoneModerationSearchRepos = __importStar2(require_searchRepos());
    exports.ToolsOzoneReportDefs = __importStar2(require_defs21());
    exports.ToolsOzoneSafelinkAddRule = __importStar2(require_addRule());
    exports.ToolsOzoneSafelinkDefs = __importStar2(require_defs22());
    exports.ToolsOzoneSafelinkQueryEvents = __importStar2(require_queryEvents2());
    exports.ToolsOzoneSafelinkQueryRules = __importStar2(require_queryRules());
    exports.ToolsOzoneSafelinkRemoveRule = __importStar2(require_removeRule());
    exports.ToolsOzoneSafelinkUpdateRule = __importStar2(require_updateRule());
    exports.ToolsOzoneServerGetConfig = __importStar2(require_getConfig2());
    exports.ToolsOzoneSetAddValues = __importStar2(require_addValues());
    exports.ToolsOzoneSetDefs = __importStar2(require_defs23());
    exports.ToolsOzoneSetDeleteSet = __importStar2(require_deleteSet());
    exports.ToolsOzoneSetDeleteValues = __importStar2(require_deleteValues());
    exports.ToolsOzoneSetGetValues = __importStar2(require_getValues());
    exports.ToolsOzoneSetQuerySets = __importStar2(require_querySets());
    exports.ToolsOzoneSetUpsertSet = __importStar2(require_upsertSet());
    exports.ToolsOzoneSettingDefs = __importStar2(require_defs24());
    exports.ToolsOzoneSettingListOptions = __importStar2(require_listOptions());
    exports.ToolsOzoneSettingRemoveOptions = __importStar2(require_removeOptions());
    exports.ToolsOzoneSettingUpsertOption = __importStar2(require_upsertOption());
    exports.ToolsOzoneSignatureDefs = __importStar2(require_defs25());
    exports.ToolsOzoneSignatureFindCorrelation = __importStar2(require_findCorrelation());
    exports.ToolsOzoneSignatureFindRelatedAccounts = __importStar2(require_findRelatedAccounts());
    exports.ToolsOzoneSignatureSearchAccounts = __importStar2(require_searchAccounts2());
    exports.ToolsOzoneTeamAddMember = __importStar2(require_addMember());
    exports.ToolsOzoneTeamDefs = __importStar2(require_defs26());
    exports.ToolsOzoneTeamDeleteMember = __importStar2(require_deleteMember());
    exports.ToolsOzoneTeamListMembers = __importStar2(require_listMembers());
    exports.ToolsOzoneTeamUpdateMember = __importStar2(require_updateMember());
    exports.ToolsOzoneVerificationDefs = __importStar2(require_defs27());
    exports.ToolsOzoneVerificationGrantVerifications = __importStar2(require_grantVerifications());
    exports.ToolsOzoneVerificationListVerifications = __importStar2(require_listVerifications());
    exports.ToolsOzoneVerificationRevokeVerifications = __importStar2(require_revokeVerifications());
    exports.APP_BSKY_ACTOR = {
      StatusLive: "app.bsky.actor.status#live"
    };
    exports.APP_BSKY_FEED = {
      DefsRequestLess: "app.bsky.feed.defs#requestLess",
      DefsRequestMore: "app.bsky.feed.defs#requestMore",
      DefsClickthroughItem: "app.bsky.feed.defs#clickthroughItem",
      DefsClickthroughAuthor: "app.bsky.feed.defs#clickthroughAuthor",
      DefsClickthroughReposter: "app.bsky.feed.defs#clickthroughReposter",
      DefsClickthroughEmbed: "app.bsky.feed.defs#clickthroughEmbed",
      DefsContentModeUnspecified: "app.bsky.feed.defs#contentModeUnspecified",
      DefsContentModeVideo: "app.bsky.feed.defs#contentModeVideo",
      DefsInteractionSeen: "app.bsky.feed.defs#interactionSeen",
      DefsInteractionLike: "app.bsky.feed.defs#interactionLike",
      DefsInteractionRepost: "app.bsky.feed.defs#interactionRepost",
      DefsInteractionReply: "app.bsky.feed.defs#interactionReply",
      DefsInteractionQuote: "app.bsky.feed.defs#interactionQuote",
      DefsInteractionShare: "app.bsky.feed.defs#interactionShare"
    };
    exports.APP_BSKY_GRAPH = {
      DefsModlist: "app.bsky.graph.defs#modlist",
      DefsCuratelist: "app.bsky.graph.defs#curatelist",
      DefsReferencelist: "app.bsky.graph.defs#referencelist"
    };
    exports.COM_ATPROTO_MODERATION = {
      DefsReasonSpam: "com.atproto.moderation.defs#reasonSpam",
      DefsReasonViolation: "com.atproto.moderation.defs#reasonViolation",
      DefsReasonMisleading: "com.atproto.moderation.defs#reasonMisleading",
      DefsReasonSexual: "com.atproto.moderation.defs#reasonSexual",
      DefsReasonRude: "com.atproto.moderation.defs#reasonRude",
      DefsReasonOther: "com.atproto.moderation.defs#reasonOther",
      DefsReasonAppeal: "com.atproto.moderation.defs#reasonAppeal"
    };
    exports.TOOLS_OZONE_MODERATION = {
      DefsReviewOpen: "tools.ozone.moderation.defs#reviewOpen",
      DefsReviewEscalated: "tools.ozone.moderation.defs#reviewEscalated",
      DefsReviewClosed: "tools.ozone.moderation.defs#reviewClosed",
      DefsReviewNone: "tools.ozone.moderation.defs#reviewNone",
      DefsTimelineEventPlcCreate: "tools.ozone.moderation.defs#timelineEventPlcCreate",
      DefsTimelineEventPlcOperation: "tools.ozone.moderation.defs#timelineEventPlcOperation",
      DefsTimelineEventPlcTombstone: "tools.ozone.moderation.defs#timelineEventPlcTombstone"
    };
    exports.TOOLS_OZONE_REPORT = {
      DefsReasonAppeal: "tools.ozone.report.defs#reasonAppeal",
      DefsReasonViolenceAnimalWelfare: "tools.ozone.report.defs#reasonViolenceAnimalWelfare",
      DefsReasonViolenceThreats: "tools.ozone.report.defs#reasonViolenceThreats",
      DefsReasonViolenceGraphicContent: "tools.ozone.report.defs#reasonViolenceGraphicContent",
      DefsReasonViolenceSelfHarm: "tools.ozone.report.defs#reasonViolenceSelfHarm",
      DefsReasonViolenceGlorification: "tools.ozone.report.defs#reasonViolenceGlorification",
      DefsReasonViolenceExtremistContent: "tools.ozone.report.defs#reasonViolenceExtremistContent",
      DefsReasonViolenceTrafficking: "tools.ozone.report.defs#reasonViolenceTrafficking",
      DefsReasonViolenceOther: "tools.ozone.report.defs#reasonViolenceOther",
      DefsReasonSexualAbuseContent: "tools.ozone.report.defs#reasonSexualAbuseContent",
      DefsReasonSexualNCII: "tools.ozone.report.defs#reasonSexualNCII",
      DefsReasonSexualSextortion: "tools.ozone.report.defs#reasonSexualSextortion",
      DefsReasonSexualDeepfake: "tools.ozone.report.defs#reasonSexualDeepfake",
      DefsReasonSexualAnimal: "tools.ozone.report.defs#reasonSexualAnimal",
      DefsReasonSexualUnlabeled: "tools.ozone.report.defs#reasonSexualUnlabeled",
      DefsReasonSexualOther: "tools.ozone.report.defs#reasonSexualOther",
      DefsReasonChildSafetyCSAM: "tools.ozone.report.defs#reasonChildSafetyCSAM",
      DefsReasonChildSafetyGroom: "tools.ozone.report.defs#reasonChildSafetyGroom",
      DefsReasonChildSafetyMinorPrivacy: "tools.ozone.report.defs#reasonChildSafetyMinorPrivacy",
      DefsReasonChildSafetyEndangerment: "tools.ozone.report.defs#reasonChildSafetyEndangerment",
      DefsReasonChildSafetyHarassment: "tools.ozone.report.defs#reasonChildSafetyHarassment",
      DefsReasonChildSafetyPromotion: "tools.ozone.report.defs#reasonChildSafetyPromotion",
      DefsReasonChildSafetyOther: "tools.ozone.report.defs#reasonChildSafetyOther",
      DefsReasonHarassmentTroll: "tools.ozone.report.defs#reasonHarassmentTroll",
      DefsReasonHarassmentTargeted: "tools.ozone.report.defs#reasonHarassmentTargeted",
      DefsReasonHarassmentHateSpeech: "tools.ozone.report.defs#reasonHarassmentHateSpeech",
      DefsReasonHarassmentDoxxing: "tools.ozone.report.defs#reasonHarassmentDoxxing",
      DefsReasonHarassmentOther: "tools.ozone.report.defs#reasonHarassmentOther",
      DefsReasonMisleadingBot: "tools.ozone.report.defs#reasonMisleadingBot",
      DefsReasonMisleadingImpersonation: "tools.ozone.report.defs#reasonMisleadingImpersonation",
      DefsReasonMisleadingSpam: "tools.ozone.report.defs#reasonMisleadingSpam",
      DefsReasonMisleadingScam: "tools.ozone.report.defs#reasonMisleadingScam",
      DefsReasonMisleadingSyntheticContent: "tools.ozone.report.defs#reasonMisleadingSyntheticContent",
      DefsReasonMisleadingMisinformation: "tools.ozone.report.defs#reasonMisleadingMisinformation",
      DefsReasonMisleadingOther: "tools.ozone.report.defs#reasonMisleadingOther",
      DefsReasonRuleSiteSecurity: "tools.ozone.report.defs#reasonRuleSiteSecurity",
      DefsReasonRuleStolenContent: "tools.ozone.report.defs#reasonRuleStolenContent",
      DefsReasonRuleProhibitedSales: "tools.ozone.report.defs#reasonRuleProhibitedSales",
      DefsReasonRuleBanEvasion: "tools.ozone.report.defs#reasonRuleBanEvasion",
      DefsReasonRuleOther: "tools.ozone.report.defs#reasonRuleOther",
      DefsReasonCivicElectoralProcess: "tools.ozone.report.defs#reasonCivicElectoralProcess",
      DefsReasonCivicDisclosure: "tools.ozone.report.defs#reasonCivicDisclosure",
      DefsReasonCivicInterference: "tools.ozone.report.defs#reasonCivicInterference",
      DefsReasonCivicMisinformation: "tools.ozone.report.defs#reasonCivicMisinformation",
      DefsReasonCivicImpersonation: "tools.ozone.report.defs#reasonCivicImpersonation"
    };
    exports.TOOLS_OZONE_TEAM = {
      DefsRoleAdmin: "tools.ozone.team.defs#roleAdmin",
      DefsRoleModerator: "tools.ozone.team.defs#roleModerator",
      DefsRoleTriage: "tools.ozone.team.defs#roleTriage",
      DefsRoleVerifier: "tools.ozone.team.defs#roleVerifier"
    };
    var AtpBaseClient = class extends xrpc_1.XrpcClient {
      constructor(options) {
        super(options, lexicons_js_1.schemas);
        Object.defineProperty(this, "app", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "chat", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "com", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "tools", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.app = new AppNS(this);
        this.chat = new ChatNS(this);
        this.com = new ComNS(this);
        this.tools = new ToolsNS(this);
      }
      /** @deprecated use `this` instead */
      get xrpc() {
        return this;
      }
    };
    exports.AtpBaseClient = AtpBaseClient;
    var AppNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "bsky", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.bsky = new AppBskyNS(client);
      }
    };
    exports.AppNS = AppNS;
    var AppBskyNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "actor", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "bookmark", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "embed", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "feed", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "graph", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "labeler", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "notification", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "richtext", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "unspecced", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "video", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.actor = new AppBskyActorNS(client);
        this.bookmark = new AppBskyBookmarkNS(client);
        this.embed = new AppBskyEmbedNS(client);
        this.feed = new AppBskyFeedNS(client);
        this.graph = new AppBskyGraphNS(client);
        this.labeler = new AppBskyLabelerNS(client);
        this.notification = new AppBskyNotificationNS(client);
        this.richtext = new AppBskyRichtextNS(client);
        this.unspecced = new AppBskyUnspeccedNS(client);
        this.video = new AppBskyVideoNS(client);
      }
    };
    exports.AppBskyNS = AppBskyNS;
    var AppBskyActorNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "profile", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "status", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.profile = new AppBskyActorProfileRecord(client);
        this.status = new AppBskyActorStatusRecord(client);
      }
      getPreferences(params, opts) {
        return this._client.call("app.bsky.actor.getPreferences", params, void 0, opts);
      }
      getProfile(params, opts) {
        return this._client.call("app.bsky.actor.getProfile", params, void 0, opts);
      }
      getProfiles(params, opts) {
        return this._client.call("app.bsky.actor.getProfiles", params, void 0, opts);
      }
      getSuggestions(params, opts) {
        return this._client.call("app.bsky.actor.getSuggestions", params, void 0, opts);
      }
      putPreferences(data, opts) {
        return this._client.call("app.bsky.actor.putPreferences", opts?.qp, data, opts);
      }
      searchActors(params, opts) {
        return this._client.call("app.bsky.actor.searchActors", params, void 0, opts);
      }
      searchActorsTypeahead(params, opts) {
        return this._client.call("app.bsky.actor.searchActorsTypeahead", params, void 0, opts);
      }
    };
    exports.AppBskyActorNS = AppBskyActorNS;
    var AppBskyActorProfileRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.actor.profile",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.actor.profile",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.actor.profile";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, {
          collection,
          rkey: "self",
          ...params,
          record: { ...record, $type: collection }
        }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.actor.profile";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.actor.profile", ...params }, { headers });
      }
    };
    exports.AppBskyActorProfileRecord = AppBskyActorProfileRecord;
    var AppBskyActorStatusRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.actor.status",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.actor.status",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.actor.status";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, {
          collection,
          rkey: "self",
          ...params,
          record: { ...record, $type: collection }
        }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.actor.status";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.actor.status", ...params }, { headers });
      }
    };
    exports.AppBskyActorStatusRecord = AppBskyActorStatusRecord;
    var AppBskyBookmarkNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      createBookmark(data, opts) {
        return this._client.call("app.bsky.bookmark.createBookmark", opts?.qp, data, opts).catch((e) => {
          throw AppBskyBookmarkCreateBookmark.toKnownErr(e);
        });
      }
      deleteBookmark(data, opts) {
        return this._client.call("app.bsky.bookmark.deleteBookmark", opts?.qp, data, opts).catch((e) => {
          throw AppBskyBookmarkDeleteBookmark.toKnownErr(e);
        });
      }
      getBookmarks(params, opts) {
        return this._client.call("app.bsky.bookmark.getBookmarks", params, void 0, opts);
      }
    };
    exports.AppBskyBookmarkNS = AppBskyBookmarkNS;
    var AppBskyEmbedNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
    };
    exports.AppBskyEmbedNS = AppBskyEmbedNS;
    var AppBskyFeedNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "generator", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "like", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "post", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "postgate", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "repost", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "threadgate", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.generator = new AppBskyFeedGeneratorRecord(client);
        this.like = new AppBskyFeedLikeRecord(client);
        this.post = new AppBskyFeedPostRecord(client);
        this.postgate = new AppBskyFeedPostgateRecord(client);
        this.repost = new AppBskyFeedRepostRecord(client);
        this.threadgate = new AppBskyFeedThreadgateRecord(client);
      }
      describeFeedGenerator(params, opts) {
        return this._client.call("app.bsky.feed.describeFeedGenerator", params, void 0, opts);
      }
      getActorFeeds(params, opts) {
        return this._client.call("app.bsky.feed.getActorFeeds", params, void 0, opts);
      }
      getActorLikes(params, opts) {
        return this._client.call("app.bsky.feed.getActorLikes", params, void 0, opts).catch((e) => {
          throw AppBskyFeedGetActorLikes.toKnownErr(e);
        });
      }
      getAuthorFeed(params, opts) {
        return this._client.call("app.bsky.feed.getAuthorFeed", params, void 0, opts).catch((e) => {
          throw AppBskyFeedGetAuthorFeed.toKnownErr(e);
        });
      }
      getFeed(params, opts) {
        return this._client.call("app.bsky.feed.getFeed", params, void 0, opts).catch((e) => {
          throw AppBskyFeedGetFeed.toKnownErr(e);
        });
      }
      getFeedGenerator(params, opts) {
        return this._client.call("app.bsky.feed.getFeedGenerator", params, void 0, opts);
      }
      getFeedGenerators(params, opts) {
        return this._client.call("app.bsky.feed.getFeedGenerators", params, void 0, opts);
      }
      getFeedSkeleton(params, opts) {
        return this._client.call("app.bsky.feed.getFeedSkeleton", params, void 0, opts).catch((e) => {
          throw AppBskyFeedGetFeedSkeleton.toKnownErr(e);
        });
      }
      getLikes(params, opts) {
        return this._client.call("app.bsky.feed.getLikes", params, void 0, opts);
      }
      getListFeed(params, opts) {
        return this._client.call("app.bsky.feed.getListFeed", params, void 0, opts).catch((e) => {
          throw AppBskyFeedGetListFeed.toKnownErr(e);
        });
      }
      getPostThread(params, opts) {
        return this._client.call("app.bsky.feed.getPostThread", params, void 0, opts).catch((e) => {
          throw AppBskyFeedGetPostThread.toKnownErr(e);
        });
      }
      getPosts(params, opts) {
        return this._client.call("app.bsky.feed.getPosts", params, void 0, opts);
      }
      getQuotes(params, opts) {
        return this._client.call("app.bsky.feed.getQuotes", params, void 0, opts);
      }
      getRepostedBy(params, opts) {
        return this._client.call("app.bsky.feed.getRepostedBy", params, void 0, opts);
      }
      getSuggestedFeeds(params, opts) {
        return this._client.call("app.bsky.feed.getSuggestedFeeds", params, void 0, opts);
      }
      getTimeline(params, opts) {
        return this._client.call("app.bsky.feed.getTimeline", params, void 0, opts);
      }
      searchPosts(params, opts) {
        return this._client.call("app.bsky.feed.searchPosts", params, void 0, opts).catch((e) => {
          throw AppBskyFeedSearchPosts.toKnownErr(e);
        });
      }
      sendInteractions(data, opts) {
        return this._client.call("app.bsky.feed.sendInteractions", opts?.qp, data, opts);
      }
    };
    exports.AppBskyFeedNS = AppBskyFeedNS;
    var AppBskyFeedGeneratorRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.feed.generator",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.feed.generator",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.feed.generator";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.feed.generator";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.feed.generator", ...params }, { headers });
      }
    };
    exports.AppBskyFeedGeneratorRecord = AppBskyFeedGeneratorRecord;
    var AppBskyFeedLikeRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.feed.like",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.feed.like",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.feed.like";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.feed.like";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.feed.like", ...params }, { headers });
      }
    };
    exports.AppBskyFeedLikeRecord = AppBskyFeedLikeRecord;
    var AppBskyFeedPostRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.feed.post",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.feed.post",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.feed.post";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.feed.post";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.feed.post", ...params }, { headers });
      }
    };
    exports.AppBskyFeedPostRecord = AppBskyFeedPostRecord;
    var AppBskyFeedPostgateRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.feed.postgate",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.feed.postgate",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.feed.postgate";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.feed.postgate";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.feed.postgate", ...params }, { headers });
      }
    };
    exports.AppBskyFeedPostgateRecord = AppBskyFeedPostgateRecord;
    var AppBskyFeedRepostRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.feed.repost",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.feed.repost",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.feed.repost";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.feed.repost";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.feed.repost", ...params }, { headers });
      }
    };
    exports.AppBskyFeedRepostRecord = AppBskyFeedRepostRecord;
    var AppBskyFeedThreadgateRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.feed.threadgate",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.feed.threadgate",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.feed.threadgate";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.feed.threadgate";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.feed.threadgate", ...params }, { headers });
      }
    };
    exports.AppBskyFeedThreadgateRecord = AppBskyFeedThreadgateRecord;
    var AppBskyGraphNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "block", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "follow", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "list", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "listblock", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "listitem", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "starterpack", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "verification", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.block = new AppBskyGraphBlockRecord(client);
        this.follow = new AppBskyGraphFollowRecord(client);
        this.list = new AppBskyGraphListRecord(client);
        this.listblock = new AppBskyGraphListblockRecord(client);
        this.listitem = new AppBskyGraphListitemRecord(client);
        this.starterpack = new AppBskyGraphStarterpackRecord(client);
        this.verification = new AppBskyGraphVerificationRecord(client);
      }
      getActorStarterPacks(params, opts) {
        return this._client.call("app.bsky.graph.getActorStarterPacks", params, void 0, opts);
      }
      getBlocks(params, opts) {
        return this._client.call("app.bsky.graph.getBlocks", params, void 0, opts);
      }
      getFollowers(params, opts) {
        return this._client.call("app.bsky.graph.getFollowers", params, void 0, opts);
      }
      getFollows(params, opts) {
        return this._client.call("app.bsky.graph.getFollows", params, void 0, opts);
      }
      getKnownFollowers(params, opts) {
        return this._client.call("app.bsky.graph.getKnownFollowers", params, void 0, opts);
      }
      getList(params, opts) {
        return this._client.call("app.bsky.graph.getList", params, void 0, opts);
      }
      getListBlocks(params, opts) {
        return this._client.call("app.bsky.graph.getListBlocks", params, void 0, opts);
      }
      getListMutes(params, opts) {
        return this._client.call("app.bsky.graph.getListMutes", params, void 0, opts);
      }
      getLists(params, opts) {
        return this._client.call("app.bsky.graph.getLists", params, void 0, opts);
      }
      getListsWithMembership(params, opts) {
        return this._client.call("app.bsky.graph.getListsWithMembership", params, void 0, opts);
      }
      getMutes(params, opts) {
        return this._client.call("app.bsky.graph.getMutes", params, void 0, opts);
      }
      getRelationships(params, opts) {
        return this._client.call("app.bsky.graph.getRelationships", params, void 0, opts).catch((e) => {
          throw AppBskyGraphGetRelationships.toKnownErr(e);
        });
      }
      getStarterPack(params, opts) {
        return this._client.call("app.bsky.graph.getStarterPack", params, void 0, opts);
      }
      getStarterPacks(params, opts) {
        return this._client.call("app.bsky.graph.getStarterPacks", params, void 0, opts);
      }
      getStarterPacksWithMembership(params, opts) {
        return this._client.call("app.bsky.graph.getStarterPacksWithMembership", params, void 0, opts);
      }
      getSuggestedFollowsByActor(params, opts) {
        return this._client.call("app.bsky.graph.getSuggestedFollowsByActor", params, void 0, opts);
      }
      muteActor(data, opts) {
        return this._client.call("app.bsky.graph.muteActor", opts?.qp, data, opts);
      }
      muteActorList(data, opts) {
        return this._client.call("app.bsky.graph.muteActorList", opts?.qp, data, opts);
      }
      muteThread(data, opts) {
        return this._client.call("app.bsky.graph.muteThread", opts?.qp, data, opts);
      }
      searchStarterPacks(params, opts) {
        return this._client.call("app.bsky.graph.searchStarterPacks", params, void 0, opts);
      }
      unmuteActor(data, opts) {
        return this._client.call("app.bsky.graph.unmuteActor", opts?.qp, data, opts);
      }
      unmuteActorList(data, opts) {
        return this._client.call("app.bsky.graph.unmuteActorList", opts?.qp, data, opts);
      }
      unmuteThread(data, opts) {
        return this._client.call("app.bsky.graph.unmuteThread", opts?.qp, data, opts);
      }
    };
    exports.AppBskyGraphNS = AppBskyGraphNS;
    var AppBskyGraphBlockRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.graph.block",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.graph.block",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.graph.block";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.graph.block";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.graph.block", ...params }, { headers });
      }
    };
    exports.AppBskyGraphBlockRecord = AppBskyGraphBlockRecord;
    var AppBskyGraphFollowRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.graph.follow",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.graph.follow",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.graph.follow";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.graph.follow";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.graph.follow", ...params }, { headers });
      }
    };
    exports.AppBskyGraphFollowRecord = AppBskyGraphFollowRecord;
    var AppBskyGraphListRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.graph.list",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.graph.list",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.graph.list";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.graph.list";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.graph.list", ...params }, { headers });
      }
    };
    exports.AppBskyGraphListRecord = AppBskyGraphListRecord;
    var AppBskyGraphListblockRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.graph.listblock",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.graph.listblock",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.graph.listblock";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.graph.listblock";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.graph.listblock", ...params }, { headers });
      }
    };
    exports.AppBskyGraphListblockRecord = AppBskyGraphListblockRecord;
    var AppBskyGraphListitemRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.graph.listitem",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.graph.listitem",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.graph.listitem";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.graph.listitem";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.graph.listitem", ...params }, { headers });
      }
    };
    exports.AppBskyGraphListitemRecord = AppBskyGraphListitemRecord;
    var AppBskyGraphStarterpackRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.graph.starterpack",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.graph.starterpack",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.graph.starterpack";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.graph.starterpack";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.graph.starterpack", ...params }, { headers });
      }
    };
    exports.AppBskyGraphStarterpackRecord = AppBskyGraphStarterpackRecord;
    var AppBskyGraphVerificationRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.graph.verification",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.graph.verification",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.graph.verification";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.graph.verification";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.graph.verification", ...params }, { headers });
      }
    };
    exports.AppBskyGraphVerificationRecord = AppBskyGraphVerificationRecord;
    var AppBskyLabelerNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "service", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.service = new AppBskyLabelerServiceRecord(client);
      }
      getServices(params, opts) {
        return this._client.call("app.bsky.labeler.getServices", params, void 0, opts);
      }
    };
    exports.AppBskyLabelerNS = AppBskyLabelerNS;
    var AppBskyLabelerServiceRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.labeler.service",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.labeler.service",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.labeler.service";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, {
          collection,
          rkey: "self",
          ...params,
          record: { ...record, $type: collection }
        }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.labeler.service";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.labeler.service", ...params }, { headers });
      }
    };
    exports.AppBskyLabelerServiceRecord = AppBskyLabelerServiceRecord;
    var AppBskyNotificationNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "declaration", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.declaration = new AppBskyNotificationDeclarationRecord(client);
      }
      getPreferences(params, opts) {
        return this._client.call("app.bsky.notification.getPreferences", params, void 0, opts);
      }
      getUnreadCount(params, opts) {
        return this._client.call("app.bsky.notification.getUnreadCount", params, void 0, opts);
      }
      listActivitySubscriptions(params, opts) {
        return this._client.call("app.bsky.notification.listActivitySubscriptions", params, void 0, opts);
      }
      listNotifications(params, opts) {
        return this._client.call("app.bsky.notification.listNotifications", params, void 0, opts);
      }
      putActivitySubscription(data, opts) {
        return this._client.call("app.bsky.notification.putActivitySubscription", opts?.qp, data, opts);
      }
      putPreferences(data, opts) {
        return this._client.call("app.bsky.notification.putPreferences", opts?.qp, data, opts);
      }
      putPreferencesV2(data, opts) {
        return this._client.call("app.bsky.notification.putPreferencesV2", opts?.qp, data, opts);
      }
      registerPush(data, opts) {
        return this._client.call("app.bsky.notification.registerPush", opts?.qp, data, opts);
      }
      unregisterPush(data, opts) {
        return this._client.call("app.bsky.notification.unregisterPush", opts?.qp, data, opts);
      }
      updateSeen(data, opts) {
        return this._client.call("app.bsky.notification.updateSeen", opts?.qp, data, opts);
      }
    };
    exports.AppBskyNotificationNS = AppBskyNotificationNS;
    var AppBskyNotificationDeclarationRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "app.bsky.notification.declaration",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "app.bsky.notification.declaration",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "app.bsky.notification.declaration";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, {
          collection,
          rkey: "self",
          ...params,
          record: { ...record, $type: collection }
        }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "app.bsky.notification.declaration";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "app.bsky.notification.declaration", ...params }, { headers });
      }
    };
    exports.AppBskyNotificationDeclarationRecord = AppBskyNotificationDeclarationRecord;
    var AppBskyRichtextNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
    };
    exports.AppBskyRichtextNS = AppBskyRichtextNS;
    var AppBskyUnspeccedNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      getAgeAssuranceState(params, opts) {
        return this._client.call("app.bsky.unspecced.getAgeAssuranceState", params, void 0, opts);
      }
      getConfig(params, opts) {
        return this._client.call("app.bsky.unspecced.getConfig", params, void 0, opts);
      }
      getPopularFeedGenerators(params, opts) {
        return this._client.call("app.bsky.unspecced.getPopularFeedGenerators", params, void 0, opts);
      }
      getPostThreadOtherV2(params, opts) {
        return this._client.call("app.bsky.unspecced.getPostThreadOtherV2", params, void 0, opts);
      }
      getPostThreadV2(params, opts) {
        return this._client.call("app.bsky.unspecced.getPostThreadV2", params, void 0, opts);
      }
      getSuggestedFeeds(params, opts) {
        return this._client.call("app.bsky.unspecced.getSuggestedFeeds", params, void 0, opts);
      }
      getSuggestedFeedsSkeleton(params, opts) {
        return this._client.call("app.bsky.unspecced.getSuggestedFeedsSkeleton", params, void 0, opts);
      }
      getSuggestedStarterPacks(params, opts) {
        return this._client.call("app.bsky.unspecced.getSuggestedStarterPacks", params, void 0, opts);
      }
      getSuggestedStarterPacksSkeleton(params, opts) {
        return this._client.call("app.bsky.unspecced.getSuggestedStarterPacksSkeleton", params, void 0, opts);
      }
      getSuggestedUsers(params, opts) {
        return this._client.call("app.bsky.unspecced.getSuggestedUsers", params, void 0, opts);
      }
      getSuggestedUsersSkeleton(params, opts) {
        return this._client.call("app.bsky.unspecced.getSuggestedUsersSkeleton", params, void 0, opts);
      }
      getSuggestionsSkeleton(params, opts) {
        return this._client.call("app.bsky.unspecced.getSuggestionsSkeleton", params, void 0, opts);
      }
      getTaggedSuggestions(params, opts) {
        return this._client.call("app.bsky.unspecced.getTaggedSuggestions", params, void 0, opts);
      }
      getTrendingTopics(params, opts) {
        return this._client.call("app.bsky.unspecced.getTrendingTopics", params, void 0, opts);
      }
      getTrends(params, opts) {
        return this._client.call("app.bsky.unspecced.getTrends", params, void 0, opts);
      }
      getTrendsSkeleton(params, opts) {
        return this._client.call("app.bsky.unspecced.getTrendsSkeleton", params, void 0, opts);
      }
      initAgeAssurance(data, opts) {
        return this._client.call("app.bsky.unspecced.initAgeAssurance", opts?.qp, data, opts).catch((e) => {
          throw AppBskyUnspeccedInitAgeAssurance.toKnownErr(e);
        });
      }
      searchActorsSkeleton(params, opts) {
        return this._client.call("app.bsky.unspecced.searchActorsSkeleton", params, void 0, opts).catch((e) => {
          throw AppBskyUnspeccedSearchActorsSkeleton.toKnownErr(e);
        });
      }
      searchPostsSkeleton(params, opts) {
        return this._client.call("app.bsky.unspecced.searchPostsSkeleton", params, void 0, opts).catch((e) => {
          throw AppBskyUnspeccedSearchPostsSkeleton.toKnownErr(e);
        });
      }
      searchStarterPacksSkeleton(params, opts) {
        return this._client.call("app.bsky.unspecced.searchStarterPacksSkeleton", params, void 0, opts).catch((e) => {
          throw AppBskyUnspeccedSearchStarterPacksSkeleton.toKnownErr(e);
        });
      }
    };
    exports.AppBskyUnspeccedNS = AppBskyUnspeccedNS;
    var AppBskyVideoNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      getJobStatus(params, opts) {
        return this._client.call("app.bsky.video.getJobStatus", params, void 0, opts);
      }
      getUploadLimits(params, opts) {
        return this._client.call("app.bsky.video.getUploadLimits", params, void 0, opts);
      }
      uploadVideo(data, opts) {
        return this._client.call("app.bsky.video.uploadVideo", opts?.qp, data, opts);
      }
    };
    exports.AppBskyVideoNS = AppBskyVideoNS;
    var ChatNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "bsky", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.bsky = new ChatBskyNS(client);
      }
    };
    exports.ChatNS = ChatNS;
    var ChatBskyNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "actor", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "convo", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "moderation", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.actor = new ChatBskyActorNS(client);
        this.convo = new ChatBskyConvoNS(client);
        this.moderation = new ChatBskyModerationNS(client);
      }
    };
    exports.ChatBskyNS = ChatBskyNS;
    var ChatBskyActorNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "declaration", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.declaration = new ChatBskyActorDeclarationRecord(client);
      }
      deleteAccount(data, opts) {
        return this._client.call("chat.bsky.actor.deleteAccount", opts?.qp, data, opts);
      }
      exportAccountData(params, opts) {
        return this._client.call("chat.bsky.actor.exportAccountData", params, void 0, opts);
      }
    };
    exports.ChatBskyActorNS = ChatBskyActorNS;
    var ChatBskyActorDeclarationRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "chat.bsky.actor.declaration",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "chat.bsky.actor.declaration",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "chat.bsky.actor.declaration";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, {
          collection,
          rkey: "self",
          ...params,
          record: { ...record, $type: collection }
        }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "chat.bsky.actor.declaration";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "chat.bsky.actor.declaration", ...params }, { headers });
      }
    };
    exports.ChatBskyActorDeclarationRecord = ChatBskyActorDeclarationRecord;
    var ChatBskyConvoNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      acceptConvo(data, opts) {
        return this._client.call("chat.bsky.convo.acceptConvo", opts?.qp, data, opts);
      }
      addReaction(data, opts) {
        return this._client.call("chat.bsky.convo.addReaction", opts?.qp, data, opts).catch((e) => {
          throw ChatBskyConvoAddReaction.toKnownErr(e);
        });
      }
      deleteMessageForSelf(data, opts) {
        return this._client.call("chat.bsky.convo.deleteMessageForSelf", opts?.qp, data, opts);
      }
      getConvo(params, opts) {
        return this._client.call("chat.bsky.convo.getConvo", params, void 0, opts);
      }
      getConvoAvailability(params, opts) {
        return this._client.call("chat.bsky.convo.getConvoAvailability", params, void 0, opts);
      }
      getConvoForMembers(params, opts) {
        return this._client.call("chat.bsky.convo.getConvoForMembers", params, void 0, opts);
      }
      getLog(params, opts) {
        return this._client.call("chat.bsky.convo.getLog", params, void 0, opts);
      }
      getMessages(params, opts) {
        return this._client.call("chat.bsky.convo.getMessages", params, void 0, opts);
      }
      leaveConvo(data, opts) {
        return this._client.call("chat.bsky.convo.leaveConvo", opts?.qp, data, opts);
      }
      listConvos(params, opts) {
        return this._client.call("chat.bsky.convo.listConvos", params, void 0, opts);
      }
      muteConvo(data, opts) {
        return this._client.call("chat.bsky.convo.muteConvo", opts?.qp, data, opts);
      }
      removeReaction(data, opts) {
        return this._client.call("chat.bsky.convo.removeReaction", opts?.qp, data, opts).catch((e) => {
          throw ChatBskyConvoRemoveReaction.toKnownErr(e);
        });
      }
      sendMessage(data, opts) {
        return this._client.call("chat.bsky.convo.sendMessage", opts?.qp, data, opts);
      }
      sendMessageBatch(data, opts) {
        return this._client.call("chat.bsky.convo.sendMessageBatch", opts?.qp, data, opts);
      }
      unmuteConvo(data, opts) {
        return this._client.call("chat.bsky.convo.unmuteConvo", opts?.qp, data, opts);
      }
      updateAllRead(data, opts) {
        return this._client.call("chat.bsky.convo.updateAllRead", opts?.qp, data, opts);
      }
      updateRead(data, opts) {
        return this._client.call("chat.bsky.convo.updateRead", opts?.qp, data, opts);
      }
    };
    exports.ChatBskyConvoNS = ChatBskyConvoNS;
    var ChatBskyModerationNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      getActorMetadata(params, opts) {
        return this._client.call("chat.bsky.moderation.getActorMetadata", params, void 0, opts);
      }
      getMessageContext(params, opts) {
        return this._client.call("chat.bsky.moderation.getMessageContext", params, void 0, opts);
      }
      updateActorAccess(data, opts) {
        return this._client.call("chat.bsky.moderation.updateActorAccess", opts?.qp, data, opts);
      }
    };
    exports.ChatBskyModerationNS = ChatBskyModerationNS;
    var ComNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "atproto", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.atproto = new ComAtprotoNS(client);
      }
    };
    exports.ComNS = ComNS;
    var ComAtprotoNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "admin", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "identity", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "label", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "lexicon", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "moderation", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "repo", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "server", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "sync", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "temp", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.admin = new ComAtprotoAdminNS(client);
        this.identity = new ComAtprotoIdentityNS(client);
        this.label = new ComAtprotoLabelNS(client);
        this.lexicon = new ComAtprotoLexiconNS(client);
        this.moderation = new ComAtprotoModerationNS(client);
        this.repo = new ComAtprotoRepoNS(client);
        this.server = new ComAtprotoServerNS(client);
        this.sync = new ComAtprotoSyncNS(client);
        this.temp = new ComAtprotoTempNS(client);
      }
    };
    exports.ComAtprotoNS = ComAtprotoNS;
    var ComAtprotoAdminNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      deleteAccount(data, opts) {
        return this._client.call("com.atproto.admin.deleteAccount", opts?.qp, data, opts);
      }
      disableAccountInvites(data, opts) {
        return this._client.call("com.atproto.admin.disableAccountInvites", opts?.qp, data, opts);
      }
      disableInviteCodes(data, opts) {
        return this._client.call("com.atproto.admin.disableInviteCodes", opts?.qp, data, opts);
      }
      enableAccountInvites(data, opts) {
        return this._client.call("com.atproto.admin.enableAccountInvites", opts?.qp, data, opts);
      }
      getAccountInfo(params, opts) {
        return this._client.call("com.atproto.admin.getAccountInfo", params, void 0, opts);
      }
      getAccountInfos(params, opts) {
        return this._client.call("com.atproto.admin.getAccountInfos", params, void 0, opts);
      }
      getInviteCodes(params, opts) {
        return this._client.call("com.atproto.admin.getInviteCodes", params, void 0, opts);
      }
      getSubjectStatus(params, opts) {
        return this._client.call("com.atproto.admin.getSubjectStatus", params, void 0, opts);
      }
      searchAccounts(params, opts) {
        return this._client.call("com.atproto.admin.searchAccounts", params, void 0, opts);
      }
      sendEmail(data, opts) {
        return this._client.call("com.atproto.admin.sendEmail", opts?.qp, data, opts);
      }
      updateAccountEmail(data, opts) {
        return this._client.call("com.atproto.admin.updateAccountEmail", opts?.qp, data, opts);
      }
      updateAccountHandle(data, opts) {
        return this._client.call("com.atproto.admin.updateAccountHandle", opts?.qp, data, opts);
      }
      updateAccountPassword(data, opts) {
        return this._client.call("com.atproto.admin.updateAccountPassword", opts?.qp, data, opts);
      }
      updateAccountSigningKey(data, opts) {
        return this._client.call("com.atproto.admin.updateAccountSigningKey", opts?.qp, data, opts);
      }
      updateSubjectStatus(data, opts) {
        return this._client.call("com.atproto.admin.updateSubjectStatus", opts?.qp, data, opts);
      }
    };
    exports.ComAtprotoAdminNS = ComAtprotoAdminNS;
    var ComAtprotoIdentityNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      getRecommendedDidCredentials(params, opts) {
        return this._client.call("com.atproto.identity.getRecommendedDidCredentials", params, void 0, opts);
      }
      refreshIdentity(data, opts) {
        return this._client.call("com.atproto.identity.refreshIdentity", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoIdentityRefreshIdentity.toKnownErr(e);
        });
      }
      requestPlcOperationSignature(data, opts) {
        return this._client.call("com.atproto.identity.requestPlcOperationSignature", opts?.qp, data, opts);
      }
      resolveDid(params, opts) {
        return this._client.call("com.atproto.identity.resolveDid", params, void 0, opts).catch((e) => {
          throw ComAtprotoIdentityResolveDid.toKnownErr(e);
        });
      }
      resolveHandle(params, opts) {
        return this._client.call("com.atproto.identity.resolveHandle", params, void 0, opts).catch((e) => {
          throw ComAtprotoIdentityResolveHandle.toKnownErr(e);
        });
      }
      resolveIdentity(params, opts) {
        return this._client.call("com.atproto.identity.resolveIdentity", params, void 0, opts).catch((e) => {
          throw ComAtprotoIdentityResolveIdentity.toKnownErr(e);
        });
      }
      signPlcOperation(data, opts) {
        return this._client.call("com.atproto.identity.signPlcOperation", opts?.qp, data, opts);
      }
      submitPlcOperation(data, opts) {
        return this._client.call("com.atproto.identity.submitPlcOperation", opts?.qp, data, opts);
      }
      updateHandle(data, opts) {
        return this._client.call("com.atproto.identity.updateHandle", opts?.qp, data, opts);
      }
    };
    exports.ComAtprotoIdentityNS = ComAtprotoIdentityNS;
    var ComAtprotoLabelNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      queryLabels(params, opts) {
        return this._client.call("com.atproto.label.queryLabels", params, void 0, opts);
      }
    };
    exports.ComAtprotoLabelNS = ComAtprotoLabelNS;
    var ComAtprotoLexiconNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "schema", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.schema = new ComAtprotoLexiconSchemaRecord(client);
      }
    };
    exports.ComAtprotoLexiconNS = ComAtprotoLexiconNS;
    var ComAtprotoLexiconSchemaRecord = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      async list(params) {
        const res = await this._client.call("com.atproto.repo.listRecords", {
          collection: "com.atproto.lexicon.schema",
          ...params
        });
        return res.data;
      }
      async get(params) {
        const res = await this._client.call("com.atproto.repo.getRecord", {
          collection: "com.atproto.lexicon.schema",
          ...params
        });
        return res.data;
      }
      async create(params, record, headers) {
        const collection = "com.atproto.lexicon.schema";
        const res = await this._client.call("com.atproto.repo.createRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async put(params, record, headers) {
        const collection = "com.atproto.lexicon.schema";
        const res = await this._client.call("com.atproto.repo.putRecord", void 0, { collection, ...params, record: { ...record, $type: collection } }, { encoding: "application/json", headers });
        return res.data;
      }
      async delete(params, headers) {
        await this._client.call("com.atproto.repo.deleteRecord", void 0, { collection: "com.atproto.lexicon.schema", ...params }, { headers });
      }
    };
    exports.ComAtprotoLexiconSchemaRecord = ComAtprotoLexiconSchemaRecord;
    var ComAtprotoModerationNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      createReport(data, opts) {
        return this._client.call("com.atproto.moderation.createReport", opts?.qp, data, opts);
      }
    };
    exports.ComAtprotoModerationNS = ComAtprotoModerationNS;
    var ComAtprotoRepoNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      applyWrites(data, opts) {
        return this._client.call("com.atproto.repo.applyWrites", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoRepoApplyWrites.toKnownErr(e);
        });
      }
      createRecord(data, opts) {
        return this._client.call("com.atproto.repo.createRecord", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoRepoCreateRecord.toKnownErr(e);
        });
      }
      deleteRecord(data, opts) {
        return this._client.call("com.atproto.repo.deleteRecord", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoRepoDeleteRecord.toKnownErr(e);
        });
      }
      describeRepo(params, opts) {
        return this._client.call("com.atproto.repo.describeRepo", params, void 0, opts);
      }
      getRecord(params, opts) {
        return this._client.call("com.atproto.repo.getRecord", params, void 0, opts).catch((e) => {
          throw ComAtprotoRepoGetRecord.toKnownErr(e);
        });
      }
      importRepo(data, opts) {
        return this._client.call("com.atproto.repo.importRepo", opts?.qp, data, opts);
      }
      listMissingBlobs(params, opts) {
        return this._client.call("com.atproto.repo.listMissingBlobs", params, void 0, opts);
      }
      listRecords(params, opts) {
        return this._client.call("com.atproto.repo.listRecords", params, void 0, opts);
      }
      putRecord(data, opts) {
        return this._client.call("com.atproto.repo.putRecord", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoRepoPutRecord.toKnownErr(e);
        });
      }
      uploadBlob(data, opts) {
        return this._client.call("com.atproto.repo.uploadBlob", opts?.qp, data, opts);
      }
    };
    exports.ComAtprotoRepoNS = ComAtprotoRepoNS;
    var ComAtprotoServerNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      activateAccount(data, opts) {
        return this._client.call("com.atproto.server.activateAccount", opts?.qp, data, opts);
      }
      checkAccountStatus(params, opts) {
        return this._client.call("com.atproto.server.checkAccountStatus", params, void 0, opts);
      }
      confirmEmail(data, opts) {
        return this._client.call("com.atproto.server.confirmEmail", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoServerConfirmEmail.toKnownErr(e);
        });
      }
      createAccount(data, opts) {
        return this._client.call("com.atproto.server.createAccount", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoServerCreateAccount.toKnownErr(e);
        });
      }
      createAppPassword(data, opts) {
        return this._client.call("com.atproto.server.createAppPassword", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoServerCreateAppPassword.toKnownErr(e);
        });
      }
      createInviteCode(data, opts) {
        return this._client.call("com.atproto.server.createInviteCode", opts?.qp, data, opts);
      }
      createInviteCodes(data, opts) {
        return this._client.call("com.atproto.server.createInviteCodes", opts?.qp, data, opts);
      }
      createSession(data, opts) {
        return this._client.call("com.atproto.server.createSession", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoServerCreateSession.toKnownErr(e);
        });
      }
      deactivateAccount(data, opts) {
        return this._client.call("com.atproto.server.deactivateAccount", opts?.qp, data, opts);
      }
      deleteAccount(data, opts) {
        return this._client.call("com.atproto.server.deleteAccount", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoServerDeleteAccount.toKnownErr(e);
        });
      }
      deleteSession(data, opts) {
        return this._client.call("com.atproto.server.deleteSession", opts?.qp, data, opts);
      }
      describeServer(params, opts) {
        return this._client.call("com.atproto.server.describeServer", params, void 0, opts);
      }
      getAccountInviteCodes(params, opts) {
        return this._client.call("com.atproto.server.getAccountInviteCodes", params, void 0, opts).catch((e) => {
          throw ComAtprotoServerGetAccountInviteCodes.toKnownErr(e);
        });
      }
      getServiceAuth(params, opts) {
        return this._client.call("com.atproto.server.getServiceAuth", params, void 0, opts).catch((e) => {
          throw ComAtprotoServerGetServiceAuth.toKnownErr(e);
        });
      }
      getSession(params, opts) {
        return this._client.call("com.atproto.server.getSession", params, void 0, opts);
      }
      listAppPasswords(params, opts) {
        return this._client.call("com.atproto.server.listAppPasswords", params, void 0, opts).catch((e) => {
          throw ComAtprotoServerListAppPasswords.toKnownErr(e);
        });
      }
      refreshSession(data, opts) {
        return this._client.call("com.atproto.server.refreshSession", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoServerRefreshSession.toKnownErr(e);
        });
      }
      requestAccountDelete(data, opts) {
        return this._client.call("com.atproto.server.requestAccountDelete", opts?.qp, data, opts);
      }
      requestEmailConfirmation(data, opts) {
        return this._client.call("com.atproto.server.requestEmailConfirmation", opts?.qp, data, opts);
      }
      requestEmailUpdate(data, opts) {
        return this._client.call("com.atproto.server.requestEmailUpdate", opts?.qp, data, opts);
      }
      requestPasswordReset(data, opts) {
        return this._client.call("com.atproto.server.requestPasswordReset", opts?.qp, data, opts);
      }
      reserveSigningKey(data, opts) {
        return this._client.call("com.atproto.server.reserveSigningKey", opts?.qp, data, opts);
      }
      resetPassword(data, opts) {
        return this._client.call("com.atproto.server.resetPassword", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoServerResetPassword.toKnownErr(e);
        });
      }
      revokeAppPassword(data, opts) {
        return this._client.call("com.atproto.server.revokeAppPassword", opts?.qp, data, opts);
      }
      updateEmail(data, opts) {
        return this._client.call("com.atproto.server.updateEmail", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoServerUpdateEmail.toKnownErr(e);
        });
      }
    };
    exports.ComAtprotoServerNS = ComAtprotoServerNS;
    var ComAtprotoSyncNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      getBlob(params, opts) {
        return this._client.call("com.atproto.sync.getBlob", params, void 0, opts).catch((e) => {
          throw ComAtprotoSyncGetBlob.toKnownErr(e);
        });
      }
      getBlocks(params, opts) {
        return this._client.call("com.atproto.sync.getBlocks", params, void 0, opts).catch((e) => {
          throw ComAtprotoSyncGetBlocks.toKnownErr(e);
        });
      }
      getCheckout(params, opts) {
        return this._client.call("com.atproto.sync.getCheckout", params, void 0, opts);
      }
      getHead(params, opts) {
        return this._client.call("com.atproto.sync.getHead", params, void 0, opts).catch((e) => {
          throw ComAtprotoSyncGetHead.toKnownErr(e);
        });
      }
      getHostStatus(params, opts) {
        return this._client.call("com.atproto.sync.getHostStatus", params, void 0, opts).catch((e) => {
          throw ComAtprotoSyncGetHostStatus.toKnownErr(e);
        });
      }
      getLatestCommit(params, opts) {
        return this._client.call("com.atproto.sync.getLatestCommit", params, void 0, opts).catch((e) => {
          throw ComAtprotoSyncGetLatestCommit.toKnownErr(e);
        });
      }
      getRecord(params, opts) {
        return this._client.call("com.atproto.sync.getRecord", params, void 0, opts).catch((e) => {
          throw ComAtprotoSyncGetRecord.toKnownErr(e);
        });
      }
      getRepo(params, opts) {
        return this._client.call("com.atproto.sync.getRepo", params, void 0, opts).catch((e) => {
          throw ComAtprotoSyncGetRepo.toKnownErr(e);
        });
      }
      getRepoStatus(params, opts) {
        return this._client.call("com.atproto.sync.getRepoStatus", params, void 0, opts).catch((e) => {
          throw ComAtprotoSyncGetRepoStatus.toKnownErr(e);
        });
      }
      listBlobs(params, opts) {
        return this._client.call("com.atproto.sync.listBlobs", params, void 0, opts).catch((e) => {
          throw ComAtprotoSyncListBlobs.toKnownErr(e);
        });
      }
      listHosts(params, opts) {
        return this._client.call("com.atproto.sync.listHosts", params, void 0, opts);
      }
      listRepos(params, opts) {
        return this._client.call("com.atproto.sync.listRepos", params, void 0, opts);
      }
      listReposByCollection(params, opts) {
        return this._client.call("com.atproto.sync.listReposByCollection", params, void 0, opts);
      }
      notifyOfUpdate(data, opts) {
        return this._client.call("com.atproto.sync.notifyOfUpdate", opts?.qp, data, opts);
      }
      requestCrawl(data, opts) {
        return this._client.call("com.atproto.sync.requestCrawl", opts?.qp, data, opts).catch((e) => {
          throw ComAtprotoSyncRequestCrawl.toKnownErr(e);
        });
      }
    };
    exports.ComAtprotoSyncNS = ComAtprotoSyncNS;
    var ComAtprotoTempNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      addReservedHandle(data, opts) {
        return this._client.call("com.atproto.temp.addReservedHandle", opts?.qp, data, opts);
      }
      checkHandleAvailability(params, opts) {
        return this._client.call("com.atproto.temp.checkHandleAvailability", params, void 0, opts).catch((e) => {
          throw ComAtprotoTempCheckHandleAvailability.toKnownErr(e);
        });
      }
      checkSignupQueue(params, opts) {
        return this._client.call("com.atproto.temp.checkSignupQueue", params, void 0, opts);
      }
      dereferenceScope(params, opts) {
        return this._client.call("com.atproto.temp.dereferenceScope", params, void 0, opts).catch((e) => {
          throw ComAtprotoTempDereferenceScope.toKnownErr(e);
        });
      }
      fetchLabels(params, opts) {
        return this._client.call("com.atproto.temp.fetchLabels", params, void 0, opts);
      }
      requestPhoneVerification(data, opts) {
        return this._client.call("com.atproto.temp.requestPhoneVerification", opts?.qp, data, opts);
      }
      revokeAccountCredentials(data, opts) {
        return this._client.call("com.atproto.temp.revokeAccountCredentials", opts?.qp, data, opts);
      }
    };
    exports.ComAtprotoTempNS = ComAtprotoTempNS;
    var ToolsNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "ozone", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.ozone = new ToolsOzoneNS(client);
      }
    };
    exports.ToolsNS = ToolsNS;
    var ToolsOzoneNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "communication", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "hosting", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "moderation", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "safelink", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "server", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "set", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "setting", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "signature", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "team", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "verification", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
        this.communication = new ToolsOzoneCommunicationNS(client);
        this.hosting = new ToolsOzoneHostingNS(client);
        this.moderation = new ToolsOzoneModerationNS(client);
        this.safelink = new ToolsOzoneSafelinkNS(client);
        this.server = new ToolsOzoneServerNS(client);
        this.set = new ToolsOzoneSetNS(client);
        this.setting = new ToolsOzoneSettingNS(client);
        this.signature = new ToolsOzoneSignatureNS(client);
        this.team = new ToolsOzoneTeamNS(client);
        this.verification = new ToolsOzoneVerificationNS(client);
      }
    };
    exports.ToolsOzoneNS = ToolsOzoneNS;
    var ToolsOzoneCommunicationNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      createTemplate(data, opts) {
        return this._client.call("tools.ozone.communication.createTemplate", opts?.qp, data, opts).catch((e) => {
          throw ToolsOzoneCommunicationCreateTemplate.toKnownErr(e);
        });
      }
      deleteTemplate(data, opts) {
        return this._client.call("tools.ozone.communication.deleteTemplate", opts?.qp, data, opts);
      }
      listTemplates(params, opts) {
        return this._client.call("tools.ozone.communication.listTemplates", params, void 0, opts);
      }
      updateTemplate(data, opts) {
        return this._client.call("tools.ozone.communication.updateTemplate", opts?.qp, data, opts).catch((e) => {
          throw ToolsOzoneCommunicationUpdateTemplate.toKnownErr(e);
        });
      }
    };
    exports.ToolsOzoneCommunicationNS = ToolsOzoneCommunicationNS;
    var ToolsOzoneHostingNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      getAccountHistory(params, opts) {
        return this._client.call("tools.ozone.hosting.getAccountHistory", params, void 0, opts);
      }
    };
    exports.ToolsOzoneHostingNS = ToolsOzoneHostingNS;
    var ToolsOzoneModerationNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      emitEvent(data, opts) {
        return this._client.call("tools.ozone.moderation.emitEvent", opts?.qp, data, opts).catch((e) => {
          throw ToolsOzoneModerationEmitEvent.toKnownErr(e);
        });
      }
      getAccountTimeline(params, opts) {
        return this._client.call("tools.ozone.moderation.getAccountTimeline", params, void 0, opts).catch((e) => {
          throw ToolsOzoneModerationGetAccountTimeline.toKnownErr(e);
        });
      }
      getEvent(params, opts) {
        return this._client.call("tools.ozone.moderation.getEvent", params, void 0, opts);
      }
      getRecord(params, opts) {
        return this._client.call("tools.ozone.moderation.getRecord", params, void 0, opts).catch((e) => {
          throw ToolsOzoneModerationGetRecord.toKnownErr(e);
        });
      }
      getRecords(params, opts) {
        return this._client.call("tools.ozone.moderation.getRecords", params, void 0, opts);
      }
      getRepo(params, opts) {
        return this._client.call("tools.ozone.moderation.getRepo", params, void 0, opts).catch((e) => {
          throw ToolsOzoneModerationGetRepo.toKnownErr(e);
        });
      }
      getReporterStats(params, opts) {
        return this._client.call("tools.ozone.moderation.getReporterStats", params, void 0, opts);
      }
      getRepos(params, opts) {
        return this._client.call("tools.ozone.moderation.getRepos", params, void 0, opts);
      }
      getSubjects(params, opts) {
        return this._client.call("tools.ozone.moderation.getSubjects", params, void 0, opts);
      }
      queryEvents(params, opts) {
        return this._client.call("tools.ozone.moderation.queryEvents", params, void 0, opts);
      }
      queryStatuses(params, opts) {
        return this._client.call("tools.ozone.moderation.queryStatuses", params, void 0, opts);
      }
      searchRepos(params, opts) {
        return this._client.call("tools.ozone.moderation.searchRepos", params, void 0, opts);
      }
    };
    exports.ToolsOzoneModerationNS = ToolsOzoneModerationNS;
    var ToolsOzoneSafelinkNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      addRule(data, opts) {
        return this._client.call("tools.ozone.safelink.addRule", opts?.qp, data, opts).catch((e) => {
          throw ToolsOzoneSafelinkAddRule.toKnownErr(e);
        });
      }
      queryEvents(data, opts) {
        return this._client.call("tools.ozone.safelink.queryEvents", opts?.qp, data, opts);
      }
      queryRules(data, opts) {
        return this._client.call("tools.ozone.safelink.queryRules", opts?.qp, data, opts);
      }
      removeRule(data, opts) {
        return this._client.call("tools.ozone.safelink.removeRule", opts?.qp, data, opts).catch((e) => {
          throw ToolsOzoneSafelinkRemoveRule.toKnownErr(e);
        });
      }
      updateRule(data, opts) {
        return this._client.call("tools.ozone.safelink.updateRule", opts?.qp, data, opts).catch((e) => {
          throw ToolsOzoneSafelinkUpdateRule.toKnownErr(e);
        });
      }
    };
    exports.ToolsOzoneSafelinkNS = ToolsOzoneSafelinkNS;
    var ToolsOzoneServerNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      getConfig(params, opts) {
        return this._client.call("tools.ozone.server.getConfig", params, void 0, opts);
      }
    };
    exports.ToolsOzoneServerNS = ToolsOzoneServerNS;
    var ToolsOzoneSetNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      addValues(data, opts) {
        return this._client.call("tools.ozone.set.addValues", opts?.qp, data, opts);
      }
      deleteSet(data, opts) {
        return this._client.call("tools.ozone.set.deleteSet", opts?.qp, data, opts).catch((e) => {
          throw ToolsOzoneSetDeleteSet.toKnownErr(e);
        });
      }
      deleteValues(data, opts) {
        return this._client.call("tools.ozone.set.deleteValues", opts?.qp, data, opts).catch((e) => {
          throw ToolsOzoneSetDeleteValues.toKnownErr(e);
        });
      }
      getValues(params, opts) {
        return this._client.call("tools.ozone.set.getValues", params, void 0, opts).catch((e) => {
          throw ToolsOzoneSetGetValues.toKnownErr(e);
        });
      }
      querySets(params, opts) {
        return this._client.call("tools.ozone.set.querySets", params, void 0, opts);
      }
      upsertSet(data, opts) {
        return this._client.call("tools.ozone.set.upsertSet", opts?.qp, data, opts);
      }
    };
    exports.ToolsOzoneSetNS = ToolsOzoneSetNS;
    var ToolsOzoneSettingNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      listOptions(params, opts) {
        return this._client.call("tools.ozone.setting.listOptions", params, void 0, opts);
      }
      removeOptions(data, opts) {
        return this._client.call("tools.ozone.setting.removeOptions", opts?.qp, data, opts);
      }
      upsertOption(data, opts) {
        return this._client.call("tools.ozone.setting.upsertOption", opts?.qp, data, opts);
      }
    };
    exports.ToolsOzoneSettingNS = ToolsOzoneSettingNS;
    var ToolsOzoneSignatureNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      findCorrelation(params, opts) {
        return this._client.call("tools.ozone.signature.findCorrelation", params, void 0, opts);
      }
      findRelatedAccounts(params, opts) {
        return this._client.call("tools.ozone.signature.findRelatedAccounts", params, void 0, opts);
      }
      searchAccounts(params, opts) {
        return this._client.call("tools.ozone.signature.searchAccounts", params, void 0, opts);
      }
    };
    exports.ToolsOzoneSignatureNS = ToolsOzoneSignatureNS;
    var ToolsOzoneTeamNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      addMember(data, opts) {
        return this._client.call("tools.ozone.team.addMember", opts?.qp, data, opts).catch((e) => {
          throw ToolsOzoneTeamAddMember.toKnownErr(e);
        });
      }
      deleteMember(data, opts) {
        return this._client.call("tools.ozone.team.deleteMember", opts?.qp, data, opts).catch((e) => {
          throw ToolsOzoneTeamDeleteMember.toKnownErr(e);
        });
      }
      listMembers(params, opts) {
        return this._client.call("tools.ozone.team.listMembers", params, void 0, opts);
      }
      updateMember(data, opts) {
        return this._client.call("tools.ozone.team.updateMember", opts?.qp, data, opts).catch((e) => {
          throw ToolsOzoneTeamUpdateMember.toKnownErr(e);
        });
      }
    };
    exports.ToolsOzoneTeamNS = ToolsOzoneTeamNS;
    var ToolsOzoneVerificationNS = class {
      constructor(client) {
        Object.defineProperty(this, "_client", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this._client = client;
      }
      grantVerifications(data, opts) {
        return this._client.call("tools.ozone.verification.grantVerifications", opts?.qp, data, opts);
      }
      listVerifications(params, opts) {
        return this._client.call("tools.ozone.verification.listVerifications", params, void 0, opts);
      }
      revokeVerifications(data, opts) {
        return this._client.call("tools.ozone.verification.revokeVerifications", opts?.qp, data, opts);
      }
    };
    exports.ToolsOzoneVerificationNS = ToolsOzoneVerificationNS;
  }
});

// node_modules/tlds/index.json
var require_tlds = __commonJS({
  "node_modules/tlds/index.json"(exports, module) {
    module.exports = [
      "aaa",
      "aarp",
      "abb",
      "abbott",
      "abbvie",
      "abc",
      "able",
      "abogado",
      "abudhabi",
      "ac",
      "academy",
      "accenture",
      "accountant",
      "accountants",
      "aco",
      "actor",
      "ad",
      "ads",
      "adult",
      "ae",
      "aeg",
      "aero",
      "aetna",
      "af",
      "afl",
      "africa",
      "ag",
      "agakhan",
      "agency",
      "ai",
      "aig",
      "airbus",
      "airforce",
      "airtel",
      "akdn",
      "al",
      "alibaba",
      "alipay",
      "allfinanz",
      "allstate",
      "ally",
      "alsace",
      "alstom",
      "am",
      "amazon",
      "americanexpress",
      "americanfamily",
      "amex",
      "amfam",
      "amica",
      "amsterdam",
      "analytics",
      "android",
      "anquan",
      "anz",
      "ao",
      "aol",
      "apartments",
      "app",
      "apple",
      "aq",
      "aquarelle",
      "ar",
      "arab",
      "aramco",
      "archi",
      "army",
      "arpa",
      "art",
      "arte",
      "as",
      "asda",
      "asia",
      "associates",
      "at",
      "athleta",
      "attorney",
      "au",
      "auction",
      "audi",
      "audible",
      "audio",
      "auspost",
      "author",
      "auto",
      "autos",
      "aw",
      "aws",
      "ax",
      "axa",
      "az",
      "azure",
      "ba",
      "baby",
      "baidu",
      "banamex",
      "band",
      "bank",
      "bar",
      "barcelona",
      "barclaycard",
      "barclays",
      "barefoot",
      "bargains",
      "baseball",
      "basketball",
      "bauhaus",
      "bayern",
      "bb",
      "bbc",
      "bbt",
      "bbva",
      "bcg",
      "bcn",
      "bd",
      "be",
      "beats",
      "beauty",
      "beer",
      "berlin",
      "best",
      "bestbuy",
      "bet",
      "bf",
      "bg",
      "bh",
      "bharti",
      "bi",
      "bible",
      "bid",
      "bike",
      "bing",
      "bingo",
      "bio",
      "biz",
      "bj",
      "black",
      "blackfriday",
      "blockbuster",
      "blog",
      "bloomberg",
      "blue",
      "bm",
      "bms",
      "bmw",
      "bn",
      "bnpparibas",
      "bo",
      "boats",
      "boehringer",
      "bofa",
      "bom",
      "bond",
      "boo",
      "book",
      "booking",
      "bosch",
      "bostik",
      "boston",
      "bot",
      "boutique",
      "box",
      "br",
      "bradesco",
      "bridgestone",
      "broadway",
      "broker",
      "brother",
      "brussels",
      "bs",
      "bt",
      "build",
      "builders",
      "business",
      "buy",
      "buzz",
      "bv",
      "bw",
      "by",
      "bz",
      "bzh",
      "ca",
      "cab",
      "cafe",
      "cal",
      "call",
      "calvinklein",
      "cam",
      "camera",
      "camp",
      "canon",
      "capetown",
      "capital",
      "capitalone",
      "car",
      "caravan",
      "cards",
      "care",
      "career",
      "careers",
      "cars",
      "casa",
      "case",
      "cash",
      "casino",
      "cat",
      "catering",
      "catholic",
      "cba",
      "cbn",
      "cbre",
      "cc",
      "cd",
      "center",
      "ceo",
      "cern",
      "cf",
      "cfa",
      "cfd",
      "cg",
      "ch",
      "chanel",
      "channel",
      "charity",
      "chase",
      "chat",
      "cheap",
      "chintai",
      "christmas",
      "chrome",
      "church",
      "ci",
      "cipriani",
      "circle",
      "cisco",
      "citadel",
      "citi",
      "citic",
      "city",
      "ck",
      "cl",
      "claims",
      "cleaning",
      "click",
      "clinic",
      "clinique",
      "clothing",
      "cloud",
      "club",
      "clubmed",
      "cm",
      "cn",
      "co",
      "coach",
      "codes",
      "coffee",
      "college",
      "cologne",
      "com",
      "commbank",
      "community",
      "company",
      "compare",
      "computer",
      "comsec",
      "condos",
      "construction",
      "consulting",
      "contact",
      "contractors",
      "cooking",
      "cool",
      "coop",
      "corsica",
      "country",
      "coupon",
      "coupons",
      "courses",
      "cpa",
      "cr",
      "credit",
      "creditcard",
      "creditunion",
      "cricket",
      "crown",
      "crs",
      "cruise",
      "cruises",
      "cu",
      "cuisinella",
      "cv",
      "cw",
      "cx",
      "cy",
      "cymru",
      "cyou",
      "cz",
      "dad",
      "dance",
      "data",
      "date",
      "dating",
      "datsun",
      "day",
      "dclk",
      "dds",
      "de",
      "deal",
      "dealer",
      "deals",
      "degree",
      "delivery",
      "dell",
      "deloitte",
      "delta",
      "democrat",
      "dental",
      "dentist",
      "desi",
      "design",
      "dev",
      "dhl",
      "diamonds",
      "diet",
      "digital",
      "direct",
      "directory",
      "discount",
      "discover",
      "dish",
      "diy",
      "dj",
      "dk",
      "dm",
      "dnp",
      "do",
      "docs",
      "doctor",
      "dog",
      "domains",
      "dot",
      "download",
      "drive",
      "dtv",
      "dubai",
      "dupont",
      "durban",
      "dvag",
      "dvr",
      "dz",
      "earth",
      "eat",
      "ec",
      "eco",
      "edeka",
      "edu",
      "education",
      "ee",
      "eg",
      "email",
      "emerck",
      "energy",
      "engineer",
      "engineering",
      "enterprises",
      "epson",
      "equipment",
      "er",
      "ericsson",
      "erni",
      "es",
      "esq",
      "estate",
      "et",
      "eu",
      "eurovision",
      "eus",
      "events",
      "exchange",
      "expert",
      "exposed",
      "express",
      "extraspace",
      "fage",
      "fail",
      "fairwinds",
      "faith",
      "family",
      "fan",
      "fans",
      "farm",
      "farmers",
      "fashion",
      "fast",
      "fedex",
      "feedback",
      "ferrari",
      "ferrero",
      "fi",
      "fidelity",
      "fido",
      "film",
      "final",
      "finance",
      "financial",
      "fire",
      "firestone",
      "firmdale",
      "fish",
      "fishing",
      "fit",
      "fitness",
      "fj",
      "fk",
      "flickr",
      "flights",
      "flir",
      "florist",
      "flowers",
      "fly",
      "fm",
      "fo",
      "foo",
      "food",
      "football",
      "ford",
      "forex",
      "forsale",
      "forum",
      "foundation",
      "fox",
      "fr",
      "free",
      "fresenius",
      "frl",
      "frogans",
      "frontier",
      "ftr",
      "fujitsu",
      "fun",
      "fund",
      "furniture",
      "futbol",
      "fyi",
      "ga",
      "gal",
      "gallery",
      "gallo",
      "gallup",
      "game",
      "games",
      "gap",
      "garden",
      "gay",
      "gb",
      "gbiz",
      "gd",
      "gdn",
      "ge",
      "gea",
      "gent",
      "genting",
      "george",
      "gf",
      "gg",
      "ggee",
      "gh",
      "gi",
      "gift",
      "gifts",
      "gives",
      "giving",
      "gl",
      "glass",
      "gle",
      "global",
      "globo",
      "gm",
      "gmail",
      "gmbh",
      "gmo",
      "gmx",
      "gn",
      "godaddy",
      "gold",
      "goldpoint",
      "golf",
      "goo",
      "goodyear",
      "goog",
      "google",
      "gop",
      "got",
      "gov",
      "gp",
      "gq",
      "gr",
      "grainger",
      "graphics",
      "gratis",
      "green",
      "gripe",
      "grocery",
      "group",
      "gs",
      "gt",
      "gu",
      "gucci",
      "guge",
      "guide",
      "guitars",
      "guru",
      "gw",
      "gy",
      "hair",
      "hamburg",
      "hangout",
      "haus",
      "hbo",
      "hdfc",
      "hdfcbank",
      "health",
      "healthcare",
      "help",
      "helsinki",
      "here",
      "hermes",
      "hiphop",
      "hisamitsu",
      "hitachi",
      "hiv",
      "hk",
      "hkt",
      "hm",
      "hn",
      "hockey",
      "holdings",
      "holiday",
      "homedepot",
      "homegoods",
      "homes",
      "homesense",
      "honda",
      "horse",
      "hospital",
      "host",
      "hosting",
      "hot",
      "hotels",
      "hotmail",
      "house",
      "how",
      "hr",
      "hsbc",
      "ht",
      "hu",
      "hughes",
      "hyatt",
      "hyundai",
      "ibm",
      "icbc",
      "ice",
      "icu",
      "id",
      "ie",
      "ieee",
      "ifm",
      "ikano",
      "il",
      "im",
      "imamat",
      "imdb",
      "immo",
      "immobilien",
      "in",
      "inc",
      "industries",
      "infiniti",
      "info",
      "ing",
      "ink",
      "institute",
      "insurance",
      "insure",
      "int",
      "international",
      "intuit",
      "investments",
      "io",
      "ipiranga",
      "iq",
      "ir",
      "irish",
      "is",
      "ismaili",
      "ist",
      "istanbul",
      "it",
      "itau",
      "itv",
      "jaguar",
      "java",
      "jcb",
      "je",
      "jeep",
      "jetzt",
      "jewelry",
      "jio",
      "jll",
      "jm",
      "jmp",
      "jnj",
      "jo",
      "jobs",
      "joburg",
      "jot",
      "joy",
      "jp",
      "jpmorgan",
      "jprs",
      "juegos",
      "juniper",
      "kaufen",
      "kddi",
      "ke",
      "kerryhotels",
      "kerryproperties",
      "kfh",
      "kg",
      "kh",
      "ki",
      "kia",
      "kids",
      "kim",
      "kindle",
      "kitchen",
      "kiwi",
      "km",
      "kn",
      "koeln",
      "komatsu",
      "kosher",
      "kp",
      "kpmg",
      "kpn",
      "kr",
      "krd",
      "kred",
      "kuokgroup",
      "kw",
      "ky",
      "kyoto",
      "kz",
      "la",
      "lacaixa",
      "lamborghini",
      "lamer",
      "land",
      "landrover",
      "lanxess",
      "lasalle",
      "lat",
      "latino",
      "latrobe",
      "law",
      "lawyer",
      "lb",
      "lc",
      "lds",
      "lease",
      "leclerc",
      "lefrak",
      "legal",
      "lego",
      "lexus",
      "lgbt",
      "li",
      "lidl",
      "life",
      "lifeinsurance",
      "lifestyle",
      "lighting",
      "like",
      "lilly",
      "limited",
      "limo",
      "lincoln",
      "link",
      "live",
      "living",
      "lk",
      "llc",
      "llp",
      "loan",
      "loans",
      "locker",
      "locus",
      "lol",
      "london",
      "lotte",
      "lotto",
      "love",
      "lpl",
      "lplfinancial",
      "lr",
      "ls",
      "lt",
      "ltd",
      "ltda",
      "lu",
      "lundbeck",
      "luxe",
      "luxury",
      "lv",
      "ly",
      "ma",
      "madrid",
      "maif",
      "maison",
      "makeup",
      "man",
      "management",
      "mango",
      "map",
      "market",
      "marketing",
      "markets",
      "marriott",
      "marshalls",
      "mattel",
      "mba",
      "mc",
      "mckinsey",
      "md",
      "me",
      "med",
      "media",
      "meet",
      "melbourne",
      "meme",
      "memorial",
      "men",
      "menu",
      "merckmsd",
      "mg",
      "mh",
      "miami",
      "microsoft",
      "mil",
      "mini",
      "mint",
      "mit",
      "mitsubishi",
      "mk",
      "ml",
      "mlb",
      "mls",
      "mm",
      "mma",
      "mn",
      "mo",
      "mobi",
      "mobile",
      "moda",
      "moe",
      "moi",
      "mom",
      "monash",
      "money",
      "monster",
      "mormon",
      "mortgage",
      "moscow",
      "moto",
      "motorcycles",
      "mov",
      "movie",
      "mp",
      "mq",
      "mr",
      "ms",
      "msd",
      "mt",
      "mtn",
      "mtr",
      "mu",
      "museum",
      "music",
      "mv",
      "mw",
      "mx",
      "my",
      "mz",
      "na",
      "nab",
      "nagoya",
      "name",
      "navy",
      "nba",
      "nc",
      "ne",
      "nec",
      "net",
      "netbank",
      "netflix",
      "network",
      "neustar",
      "new",
      "news",
      "next",
      "nextdirect",
      "nexus",
      "nf",
      "nfl",
      "ng",
      "ngo",
      "nhk",
      "ni",
      "nico",
      "nike",
      "nikon",
      "ninja",
      "nissan",
      "nissay",
      "nl",
      "no",
      "nokia",
      "norton",
      "now",
      "nowruz",
      "nowtv",
      "np",
      "nr",
      "nra",
      "nrw",
      "ntt",
      "nu",
      "nyc",
      "nz",
      "obi",
      "observer",
      "office",
      "okinawa",
      "olayan",
      "olayangroup",
      "ollo",
      "om",
      "omega",
      "one",
      "ong",
      "onl",
      "online",
      "ooo",
      "open",
      "oracle",
      "orange",
      "org",
      "organic",
      "origins",
      "osaka",
      "otsuka",
      "ott",
      "ovh",
      "pa",
      "page",
      "panasonic",
      "paris",
      "pars",
      "partners",
      "parts",
      "party",
      "pay",
      "pccw",
      "pe",
      "pet",
      "pf",
      "pfizer",
      "pg",
      "ph",
      "pharmacy",
      "phd",
      "philips",
      "phone",
      "photo",
      "photography",
      "photos",
      "physio",
      "pics",
      "pictet",
      "pictures",
      "pid",
      "pin",
      "ping",
      "pink",
      "pioneer",
      "pizza",
      "pk",
      "pl",
      "place",
      "play",
      "playstation",
      "plumbing",
      "plus",
      "pm",
      "pn",
      "pnc",
      "pohl",
      "poker",
      "politie",
      "porn",
      "post",
      "pr",
      "praxi",
      "press",
      "prime",
      "pro",
      "prod",
      "productions",
      "prof",
      "progressive",
      "promo",
      "properties",
      "property",
      "protection",
      "pru",
      "prudential",
      "ps",
      "pt",
      "pub",
      "pw",
      "pwc",
      "py",
      "qa",
      "qpon",
      "quebec",
      "quest",
      "racing",
      "radio",
      "re",
      "read",
      "realestate",
      "realtor",
      "realty",
      "recipes",
      "red",
      "redumbrella",
      "rehab",
      "reise",
      "reisen",
      "reit",
      "reliance",
      "ren",
      "rent",
      "rentals",
      "repair",
      "report",
      "republican",
      "rest",
      "restaurant",
      "review",
      "reviews",
      "rexroth",
      "rich",
      "richardli",
      "ricoh",
      "ril",
      "rio",
      "rip",
      "ro",
      "rocks",
      "rodeo",
      "rogers",
      "room",
      "rs",
      "rsvp",
      "ru",
      "rugby",
      "ruhr",
      "run",
      "rw",
      "rwe",
      "ryukyu",
      "sa",
      "saarland",
      "safe",
      "safety",
      "sakura",
      "sale",
      "salon",
      "samsclub",
      "samsung",
      "sandvik",
      "sandvikcoromant",
      "sanofi",
      "sap",
      "sarl",
      "sas",
      "save",
      "saxo",
      "sb",
      "sbi",
      "sbs",
      "sc",
      "scb",
      "schaeffler",
      "schmidt",
      "scholarships",
      "school",
      "schule",
      "schwarz",
      "science",
      "scot",
      "sd",
      "se",
      "search",
      "seat",
      "secure",
      "security",
      "seek",
      "select",
      "sener",
      "services",
      "seven",
      "sew",
      "sex",
      "sexy",
      "sfr",
      "sg",
      "sh",
      "shangrila",
      "sharp",
      "shell",
      "shia",
      "shiksha",
      "shoes",
      "shop",
      "shopping",
      "shouji",
      "show",
      "si",
      "silk",
      "sina",
      "singles",
      "site",
      "sj",
      "sk",
      "ski",
      "skin",
      "sky",
      "skype",
      "sl",
      "sling",
      "sm",
      "smart",
      "smile",
      "sn",
      "sncf",
      "so",
      "soccer",
      "social",
      "softbank",
      "software",
      "sohu",
      "solar",
      "solutions",
      "song",
      "sony",
      "soy",
      "spa",
      "space",
      "sport",
      "spot",
      "sr",
      "srl",
      "ss",
      "st",
      "stada",
      "staples",
      "star",
      "statebank",
      "statefarm",
      "stc",
      "stcgroup",
      "stockholm",
      "storage",
      "store",
      "stream",
      "studio",
      "study",
      "style",
      "su",
      "sucks",
      "supplies",
      "supply",
      "support",
      "surf",
      "surgery",
      "suzuki",
      "sv",
      "swatch",
      "swiss",
      "sx",
      "sy",
      "sydney",
      "systems",
      "sz",
      "tab",
      "taipei",
      "talk",
      "taobao",
      "target",
      "tatamotors",
      "tatar",
      "tattoo",
      "tax",
      "taxi",
      "tc",
      "tci",
      "td",
      "tdk",
      "team",
      "tech",
      "technology",
      "tel",
      "temasek",
      "tennis",
      "teva",
      "tf",
      "tg",
      "th",
      "thd",
      "theater",
      "theatre",
      "tiaa",
      "tickets",
      "tienda",
      "tips",
      "tires",
      "tirol",
      "tj",
      "tjmaxx",
      "tjx",
      "tk",
      "tkmaxx",
      "tl",
      "tm",
      "tmall",
      "tn",
      "to",
      "today",
      "tokyo",
      "tools",
      "top",
      "toray",
      "toshiba",
      "total",
      "tours",
      "town",
      "toyota",
      "toys",
      "tr",
      "trade",
      "trading",
      "training",
      "travel",
      "travelers",
      "travelersinsurance",
      "trust",
      "trv",
      "tt",
      "tube",
      "tui",
      "tunes",
      "tushu",
      "tv",
      "tvs",
      "tw",
      "tz",
      "ua",
      "ubank",
      "ubs",
      "ug",
      "uk",
      "unicom",
      "university",
      "uno",
      "uol",
      "ups",
      "us",
      "uy",
      "uz",
      "va",
      "vacations",
      "vana",
      "vanguard",
      "vc",
      "ve",
      "vegas",
      "ventures",
      "verisign",
      "verm\xF6gensberater",
      "verm\xF6gensberatung",
      "versicherung",
      "vet",
      "vg",
      "vi",
      "viajes",
      "video",
      "vig",
      "viking",
      "villas",
      "vin",
      "vip",
      "virgin",
      "visa",
      "vision",
      "viva",
      "vivo",
      "vlaanderen",
      "vn",
      "vodka",
      "volvo",
      "vote",
      "voting",
      "voto",
      "voyage",
      "vu",
      "wales",
      "walmart",
      "walter",
      "wang",
      "wanggou",
      "watch",
      "watches",
      "weather",
      "weatherchannel",
      "webcam",
      "weber",
      "website",
      "wed",
      "wedding",
      "weibo",
      "weir",
      "wf",
      "whoswho",
      "wien",
      "wiki",
      "williamhill",
      "win",
      "windows",
      "wine",
      "winners",
      "wme",
      "wolterskluwer",
      "woodside",
      "work",
      "works",
      "world",
      "wow",
      "ws",
      "wtc",
      "wtf",
      "xbox",
      "xerox",
      "xihuan",
      "xin",
      "xxx",
      "xyz",
      "yachts",
      "yahoo",
      "yamaxun",
      "yandex",
      "ye",
      "yodobashi",
      "yoga",
      "yokohama",
      "you",
      "youtube",
      "yt",
      "yun",
      "za",
      "zappos",
      "zara",
      "zero",
      "zip",
      "zm",
      "zone",
      "zuerich",
      "zw",
      "\u03B5\u03BB",
      "\u03B5\u03C5",
      "\u0431\u0433",
      "\u0431\u0435\u043B",
      "\u0434\u0435\u0442\u0438",
      "\u0435\u044E",
      "\u043A\u0430\u0442\u043E\u043B\u0438\u043A",
      "\u043A\u043E\u043C",
      "\u043C\u043A\u0434",
      "\u043C\u043E\u043D",
      "\u043C\u043E\u0441\u043A\u0432\u0430",
      "\u043E\u043D\u043B\u0430\u0439\u043D",
      "\u043E\u0440\u0433",
      "\u0440\u0443\u0441",
      "\u0440\u0444",
      "\u0441\u0430\u0439\u0442",
      "\u0441\u0440\u0431",
      "\u0443\u043A\u0440",
      "\u049B\u0430\u0437",
      "\u0570\u0561\u0575",
      "\u05D9\u05E9\u05E8\u05D0\u05DC",
      "\u05E7\u05D5\u05DD",
      "\u0627\u0628\u0648\u0638\u0628\u064A",
      "\u0627\u0631\u0627\u0645\u0643\u0648",
      "\u0627\u0644\u0627\u0631\u062F\u0646",
      "\u0627\u0644\u0628\u062D\u0631\u064A\u0646",
      "\u0627\u0644\u062C\u0632\u0627\u0626\u0631",
      "\u0627\u0644\u0633\u0639\u0648\u062F\u064A\u0629",
      "\u0627\u0644\u0639\u0644\u064A\u0627\u0646",
      "\u0627\u0644\u0645\u063A\u0631\u0628",
      "\u0627\u0645\u0627\u0631\u0627\u062A",
      "\u0627\u06CC\u0631\u0627\u0646",
      "\u0628\u0627\u0631\u062A",
      "\u0628\u0627\u0632\u0627\u0631",
      "\u0628\u064A\u062A\u0643",
      "\u0628\u06BE\u0627\u0631\u062A",
      "\u062A\u0648\u0646\u0633",
      "\u0633\u0648\u062F\u0627\u0646",
      "\u0633\u0648\u0631\u064A\u0629",
      "\u0634\u0628\u0643\u0629",
      "\u0639\u0631\u0627\u0642",
      "\u0639\u0631\u0628",
      "\u0639\u0645\u0627\u0646",
      "\u0641\u0644\u0633\u0637\u064A\u0646",
      "\u0642\u0637\u0631",
      "\u0643\u0627\u062B\u0648\u0644\u064A\u0643",
      "\u0643\u0648\u0645",
      "\u0645\u0635\u0631",
      "\u0645\u0644\u064A\u0633\u064A\u0627",
      "\u0645\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u0627",
      "\u0645\u0648\u0642\u0639",
      "\u0647\u0645\u0631\u0627\u0647",
      "\u067E\u0627\u06A9\u0633\u062A\u0627\u0646",
      "\u0680\u0627\u0631\u062A",
      "\u0915\u0949\u092E",
      "\u0928\u0947\u091F",
      "\u092D\u093E\u0930\u0924",
      "\u092D\u093E\u0930\u0924\u092E\u094D",
      "\u092D\u093E\u0930\u094B\u0924",
      "\u0938\u0902\u0917\u0920\u0928",
      "\u09AC\u09BE\u0982\u09B2\u09BE",
      "\u09AD\u09BE\u09B0\u09A4",
      "\u09AD\u09BE\u09F0\u09A4",
      "\u0A2D\u0A3E\u0A30\u0A24",
      "\u0AAD\u0ABE\u0AB0\u0AA4",
      "\u0B2D\u0B3E\u0B30\u0B24",
      "\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE",
      "\u0B87\u0BB2\u0B99\u0BCD\u0B95\u0BC8",
      "\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD",
      "\u0C2D\u0C3E\u0C30\u0C24\u0C4D",
      "\u0CAD\u0CBE\u0CB0\u0CA4",
      "\u0D2D\u0D3E\u0D30\u0D24\u0D02",
      "\u0DBD\u0D82\u0D9A\u0DCF",
      "\u0E04\u0E2D\u0E21",
      "\u0E44\u0E17\u0E22",
      "\u0EA5\u0EB2\u0EA7",
      "\u10D2\u10D4",
      "\u307F\u3093\u306A",
      "\u30A2\u30DE\u30BE\u30F3",
      "\u30AF\u30E9\u30A6\u30C9",
      "\u30B0\u30FC\u30B0\u30EB",
      "\u30B3\u30E0",
      "\u30B9\u30C8\u30A2",
      "\u30BB\u30FC\u30EB",
      "\u30D5\u30A1\u30C3\u30B7\u30E7\u30F3",
      "\u30DD\u30A4\u30F3\u30C8",
      "\u4E16\u754C",
      "\u4E2D\u4FE1",
      "\u4E2D\u56FD",
      "\u4E2D\u570B",
      "\u4E2D\u6587\u7F51",
      "\u4E9A\u9A6C\u900A",
      "\u4F01\u4E1A",
      "\u4F5B\u5C71",
      "\u4FE1\u606F",
      "\u5065\u5EB7",
      "\u516B\u5366",
      "\u516C\u53F8",
      "\u516C\u76CA",
      "\u53F0\u6E7E",
      "\u53F0\u7063",
      "\u5546\u57CE",
      "\u5546\u5E97",
      "\u5546\u6807",
      "\u5609\u91CC",
      "\u5609\u91CC\u5927\u9152\u5E97",
      "\u5728\u7EBF",
      "\u5927\u62FF",
      "\u5929\u4E3B\u6559",
      "\u5A31\u4E50",
      "\u5BB6\u96FB",
      "\u5E7F\u4E1C",
      "\u5FAE\u535A",
      "\u6148\u5584",
      "\u6211\u7231\u4F60",
      "\u624B\u673A",
      "\u62DB\u8058",
      "\u653F\u52A1",
      "\u653F\u5E9C",
      "\u65B0\u52A0\u5761",
      "\u65B0\u95FB",
      "\u65F6\u5C1A",
      "\u66F8\u7C4D",
      "\u673A\u6784",
      "\u6DE1\u9A6C\u9521",
      "\u6E38\u620F",
      "\u6FB3\u9580",
      "\u70B9\u770B",
      "\u79FB\u52A8",
      "\u7EC4\u7EC7\u673A\u6784",
      "\u7F51\u5740",
      "\u7F51\u5E97",
      "\u7F51\u7AD9",
      "\u7F51\u7EDC",
      "\u8054\u901A",
      "\u8C37\u6B4C",
      "\u8D2D\u7269",
      "\u901A\u8CA9",
      "\u96C6\u56E2",
      "\u96FB\u8A0A\u76C8\u79D1",
      "\u98DE\u5229\u6D66",
      "\u98DF\u54C1",
      "\u9910\u5385",
      "\u9999\u683C\u91CC\u62C9",
      "\u9999\u6E2F",
      "\uB2F7\uB137",
      "\uB2F7\uCEF4",
      "\uC0BC\uC131",
      "\uD55C\uAD6D"
    ];
  }
});

// node_modules/@atproto/api/dist/rich-text/util.js
var require_util9 = __commonJS({
  "node_modules/@atproto/api/dist/rich-text/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.TAG_REGEX = exports.TRAILING_PUNCTUATION_REGEX = exports.URL_REGEX = exports.MENTION_REGEX = void 0;
    exports.MENTION_REGEX = /(^|\s|\()(@)([a-zA-Z0-9.-]+)(\b)/g;
    exports.URL_REGEX = /(^|\s|\()((https?:\/\/[\S]+)|((?<domain>[a-z][a-z0-9]*(\.[a-z0-9]+)+)[\S]*))/gim;
    exports.TRAILING_PUNCTUATION_REGEX = /\p{P}+$/gu;
    exports.TAG_REGEX = // eslint-disable-next-line no-misleading-character-class
    /(^|\s)[##]((?!\ufe0f)[^\s\u00AD\u2060\u200A\u200B\u200C\u200D\u20e2]*[^\d\s\p{P}\u00AD\u2060\u200A\u200B\u200C\u200D\u20e2]+[^\s\u00AD\u2060\u200A\u200B\u200C\u200D\u20e2]*)?/gu;
  }
});

// node_modules/@atproto/api/dist/rich-text/detection.js
var require_detection = __commonJS({
  "node_modules/@atproto/api/dist/rich-text/detection.js"(exports) {
    "use strict";
    var __importDefault2 = exports && exports.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.detectFacets = detectFacets;
    var tlds_1 = __importDefault2(require_tlds());
    var util_1 = require_util9();
    function detectFacets(text) {
      let match;
      const facets = [];
      {
        const re = util_1.MENTION_REGEX;
        while (match = re.exec(text.utf16)) {
          if (!isValidDomain(match[3]) && !match[3].endsWith(".test")) {
            continue;
          }
          const start = text.utf16.indexOf(match[3], match.index) - 1;
          facets.push({
            $type: "app.bsky.richtext.facet",
            index: {
              byteStart: text.utf16IndexToUtf8Index(start),
              byteEnd: text.utf16IndexToUtf8Index(start + match[3].length + 1)
            },
            features: [
              {
                $type: "app.bsky.richtext.facet#mention",
                did: match[3]
                // must be resolved afterwards
              }
            ]
          });
        }
      }
      {
        const re = util_1.URL_REGEX;
        while (match = re.exec(text.utf16)) {
          let uri = match[2];
          if (!uri.startsWith("http")) {
            const domain = match.groups?.domain;
            if (!domain || !isValidDomain(domain)) {
              continue;
            }
            uri = `https://${uri}`;
          }
          const start = text.utf16.indexOf(match[2], match.index);
          const index = { start, end: start + match[2].length };
          if (/[.,;:!?]$/.test(uri)) {
            uri = uri.slice(0, -1);
            index.end--;
          }
          if (/[)]$/.test(uri) && !uri.includes("(")) {
            uri = uri.slice(0, -1);
            index.end--;
          }
          facets.push({
            index: {
              byteStart: text.utf16IndexToUtf8Index(index.start),
              byteEnd: text.utf16IndexToUtf8Index(index.end)
            },
            features: [
              {
                $type: "app.bsky.richtext.facet#link",
                uri
              }
            ]
          });
        }
      }
      {
        const re = util_1.TAG_REGEX;
        while (match = re.exec(text.utf16)) {
          const leading = match[1];
          let tag2 = match[2];
          if (!tag2)
            continue;
          tag2 = tag2.trim().replace(util_1.TRAILING_PUNCTUATION_REGEX, "");
          if (tag2.length === 0 || tag2.length > 64)
            continue;
          const index = match.index + leading.length;
          facets.push({
            index: {
              byteStart: text.utf16IndexToUtf8Index(index),
              byteEnd: text.utf16IndexToUtf8Index(index + 1 + tag2.length)
            },
            features: [
              {
                $type: "app.bsky.richtext.facet#tag",
                tag: tag2
              }
            ]
          });
        }
      }
      return facets.length > 0 ? facets : void 0;
    }
    function isValidDomain(str) {
      return !!tlds_1.default.find((tld) => {
        const i = str.lastIndexOf(tld);
        if (i === -1) {
          return false;
        }
        return str.charAt(i - 1) === "." && i === str.length - tld.length;
      });
    }
  }
});

// node_modules/@atproto/api/dist/rich-text/unicode.js
var require_unicode = __commonJS({
  "node_modules/@atproto/api/dist/rich-text/unicode.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.UnicodeString = void 0;
    var common_web_1 = require_dist4();
    var encoder2 = new TextEncoder();
    var decoder2 = new TextDecoder();
    var UnicodeString = class {
      constructor(utf16) {
        Object.defineProperty(this, "utf16", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "utf8", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "_graphemeLen", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.utf16 = utf16;
        this.utf8 = encoder2.encode(utf16);
      }
      get length() {
        return this.utf8.byteLength;
      }
      get graphemeLength() {
        if (!this._graphemeLen) {
          this._graphemeLen = (0, common_web_1.graphemeLen)(this.utf16);
        }
        return this._graphemeLen;
      }
      slice(start, end) {
        return decoder2.decode(this.utf8.slice(start, end));
      }
      utf16IndexToUtf8Index(i) {
        return encoder2.encode(this.utf16.slice(0, i)).byteLength;
      }
      toString() {
        return this.utf16;
      }
    };
    exports.UnicodeString = UnicodeString;
  }
});

// node_modules/@atproto/api/dist/rich-text/sanitization.js
var require_sanitization = __commonJS({
  "node_modules/@atproto/api/dist/rich-text/sanitization.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.sanitizeRichText = sanitizeRichText;
    var unicode_1 = require_unicode();
    var EXCESS_SPACE_RE = /[\r\n]([\u00AD\u2060\u200D\u200C\u200B\s]*[\r\n]){2,}/;
    var REPLACEMENT_STR = "\n\n";
    function sanitizeRichText(richText, opts) {
      if (opts.cleanNewlines) {
        richText = clean(richText, EXCESS_SPACE_RE, REPLACEMENT_STR);
      }
      return richText;
    }
    function clean(richText, targetRegexp, replacementString) {
      richText = richText.clone();
      let match = richText.unicodeText.utf16.match(targetRegexp);
      while (match && typeof match.index !== "undefined") {
        const oldText = richText.unicodeText;
        const removeStartIndex = richText.unicodeText.utf16IndexToUtf8Index(match.index);
        const removeEndIndex = removeStartIndex + new unicode_1.UnicodeString(match[0]).length;
        richText.delete(removeStartIndex, removeEndIndex);
        if (richText.unicodeText.utf16 === oldText.utf16) {
          break;
        }
        richText.insert(removeStartIndex, replacementString);
        match = richText.unicodeText.utf16.match(targetRegexp);
      }
      return richText;
    }
  }
});

// node_modules/@atproto/api/dist/rich-text/rich-text.js
var require_rich_text = __commonJS({
  "node_modules/@atproto/api/dist/rich-text/rich-text.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.RichText = exports.RichTextSegment = void 0;
    var client_1 = require_client2();
    var detection_1 = require_detection();
    var sanitization_1 = require_sanitization();
    var unicode_1 = require_unicode();
    var RichTextSegment = class {
      constructor(text, facet) {
        Object.defineProperty(this, "text", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: text
        });
        Object.defineProperty(this, "facet", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: facet
        });
      }
      get link() {
        return this.facet?.features.find(client_1.AppBskyRichtextFacet.isLink);
      }
      isLink() {
        return !!this.link;
      }
      get mention() {
        return this.facet?.features.find(client_1.AppBskyRichtextFacet.isMention);
      }
      isMention() {
        return !!this.mention;
      }
      get tag() {
        return this.facet?.features.find(client_1.AppBskyRichtextFacet.isTag);
      }
      isTag() {
        return !!this.tag;
      }
    };
    exports.RichTextSegment = RichTextSegment;
    var RichText = class _RichText {
      constructor(props, opts) {
        Object.defineProperty(this, "unicodeText", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "facets", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.unicodeText = new unicode_1.UnicodeString(props.text);
        this.facets = props.facets;
        if (!this.facets?.length && props.entities?.length) {
          this.facets = entitiesToFacets(this.unicodeText, props.entities);
        }
        if (this.facets) {
          this.facets = this.facets.filter(facetFilter).sort(facetSort);
        }
        if (opts?.cleanNewlines) {
          (0, sanitization_1.sanitizeRichText)(this, { cleanNewlines: true }).copyInto(this);
        }
      }
      get text() {
        return this.unicodeText.toString();
      }
      get length() {
        return this.unicodeText.length;
      }
      get graphemeLength() {
        return this.unicodeText.graphemeLength;
      }
      clone() {
        return new _RichText({
          text: this.unicodeText.utf16,
          facets: cloneDeep(this.facets)
        });
      }
      copyInto(target) {
        target.unicodeText = this.unicodeText;
        target.facets = cloneDeep(this.facets);
      }
      *segments() {
        const facets = this.facets || [];
        if (!facets.length) {
          yield new RichTextSegment(this.unicodeText.utf16);
          return;
        }
        let textCursor = 0;
        let facetCursor = 0;
        do {
          const currFacet = facets[facetCursor];
          if (textCursor < currFacet.index.byteStart) {
            yield new RichTextSegment(this.unicodeText.slice(textCursor, currFacet.index.byteStart));
          } else if (textCursor > currFacet.index.byteStart) {
            facetCursor++;
            continue;
          }
          if (currFacet.index.byteStart < currFacet.index.byteEnd) {
            const subtext = this.unicodeText.slice(currFacet.index.byteStart, currFacet.index.byteEnd);
            if (!subtext.trim()) {
              yield new RichTextSegment(subtext);
            } else {
              yield new RichTextSegment(subtext, currFacet);
            }
          }
          textCursor = currFacet.index.byteEnd;
          facetCursor++;
        } while (facetCursor < facets.length);
        if (textCursor < this.unicodeText.length) {
          yield new RichTextSegment(this.unicodeText.slice(textCursor, this.unicodeText.length));
        }
      }
      insert(insertIndex, insertText) {
        this.unicodeText = new unicode_1.UnicodeString(this.unicodeText.slice(0, insertIndex) + insertText + this.unicodeText.slice(insertIndex));
        if (!this.facets?.length) {
          return this;
        }
        const numCharsAdded = insertText.length;
        for (const ent of this.facets) {
          if (insertIndex <= ent.index.byteStart) {
            ent.index.byteStart += numCharsAdded;
            ent.index.byteEnd += numCharsAdded;
          } else if (insertIndex >= ent.index.byteStart && insertIndex < ent.index.byteEnd) {
            ent.index.byteEnd += numCharsAdded;
          }
        }
        return this;
      }
      delete(removeStartIndex, removeEndIndex) {
        this.unicodeText = new unicode_1.UnicodeString(this.unicodeText.slice(0, removeStartIndex) + this.unicodeText.slice(removeEndIndex));
        if (!this.facets?.length) {
          return this;
        }
        const numCharsRemoved = removeEndIndex - removeStartIndex;
        for (const ent of this.facets) {
          if (removeStartIndex <= ent.index.byteStart && removeEndIndex >= ent.index.byteEnd) {
            ent.index.byteStart = 0;
            ent.index.byteEnd = 0;
          } else if (removeStartIndex > ent.index.byteEnd) {
          } else if (removeStartIndex > ent.index.byteStart && removeStartIndex <= ent.index.byteEnd && removeEndIndex > ent.index.byteEnd) {
            ent.index.byteEnd = removeStartIndex;
          } else if (removeStartIndex >= ent.index.byteStart && removeEndIndex <= ent.index.byteEnd) {
            ent.index.byteEnd -= numCharsRemoved;
          } else if (removeStartIndex < ent.index.byteStart && removeEndIndex >= ent.index.byteStart && removeEndIndex <= ent.index.byteEnd) {
            ent.index.byteStart = removeStartIndex;
            ent.index.byteEnd -= numCharsRemoved;
          } else if (removeEndIndex < ent.index.byteStart) {
            ent.index.byteStart -= numCharsRemoved;
            ent.index.byteEnd -= numCharsRemoved;
          }
        }
        this.facets = this.facets.filter((ent) => ent.index.byteStart < ent.index.byteEnd);
        return this;
      }
      /**
       * Detects facets such as links and mentions
       * Note: Overwrites the existing facets with auto-detected facets
       */
      async detectFacets(agent) {
        this.facets = (0, detection_1.detectFacets)(this.unicodeText);
        if (this.facets) {
          const promises = [];
          for (const facet of this.facets) {
            for (const feature of facet.features) {
              if (client_1.AppBskyRichtextFacet.isMention(feature)) {
                promises.push(agent.com.atproto.identity.resolveHandle({ handle: feature.did }).then((res) => res?.data.did).catch((_) => void 0).then((did) => {
                  feature.did = did || "";
                }));
              }
            }
          }
          await Promise.allSettled(promises);
          this.facets.sort(facetSort);
        }
      }
      /**
       * Detects facets such as links and mentions but does not resolve them
       * Will produce invalid facets! For instance, mentions will not have their DIDs set.
       * Note: Overwrites the existing facets with auto-detected facets
       */
      detectFacetsWithoutResolution() {
        this.facets = (0, detection_1.detectFacets)(this.unicodeText);
        if (this.facets) {
          this.facets.sort(facetSort);
        }
      }
    };
    exports.RichText = RichText;
    var facetSort = (a, b) => a.index.byteStart - b.index.byteStart;
    var facetFilter = (facet) => (
      // discard negative-length facets. zero-length facets are valid
      facet.index.byteStart <= facet.index.byteEnd
    );
    function entitiesToFacets(text, entities) {
      const facets = [];
      for (const ent of entities) {
        if (ent.type === "link") {
          facets.push({
            $type: "app.bsky.richtext.facet",
            index: {
              byteStart: text.utf16IndexToUtf8Index(ent.index.start),
              byteEnd: text.utf16IndexToUtf8Index(ent.index.end)
            },
            features: [{ $type: "app.bsky.richtext.facet#link", uri: ent.value }]
          });
        } else if (ent.type === "mention") {
          facets.push({
            $type: "app.bsky.richtext.facet",
            index: {
              byteStart: text.utf16IndexToUtf8Index(ent.index.start),
              byteEnd: text.utf16IndexToUtf8Index(ent.index.end)
            },
            features: [
              { $type: "app.bsky.richtext.facet#mention", did: ent.value }
            ]
          });
        }
      }
      return facets;
    }
    function cloneDeep(v) {
      if (typeof v === "undefined") {
        return v;
      }
      return JSON.parse(JSON.stringify(v));
    }
  }
});

// node_modules/@atproto/api/dist/moderation/const/labels.js
var require_labels = __commonJS({
  "node_modules/@atproto/api/dist/moderation/const/labels.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.LABELS = exports.DEFAULT_LABEL_SETTINGS = void 0;
    exports.DEFAULT_LABEL_SETTINGS = {
      porn: "hide",
      sexual: "warn",
      nudity: "ignore",
      "graphic-media": "warn"
    };
    exports.LABELS = {
      "!hide": {
        identifier: "!hide",
        configurable: false,
        defaultSetting: "hide",
        flags: ["no-override", "no-self"],
        severity: "alert",
        blurs: "content",
        behaviors: {
          account: {
            profileList: "blur",
            profileView: "blur",
            avatar: "blur",
            banner: "blur",
            displayName: "blur",
            contentList: "blur",
            contentView: "blur"
          },
          profile: {
            avatar: "blur",
            banner: "blur",
            displayName: "blur"
          },
          content: {
            contentList: "blur",
            contentView: "blur"
          }
        },
        locales: []
      },
      "!warn": {
        identifier: "!warn",
        configurable: false,
        defaultSetting: "warn",
        flags: ["no-self"],
        severity: "none",
        blurs: "content",
        behaviors: {
          account: {
            profileList: "blur",
            profileView: "blur",
            avatar: "blur",
            banner: "blur",
            contentList: "blur",
            contentView: "blur"
          },
          profile: {
            avatar: "blur",
            banner: "blur",
            displayName: "blur"
          },
          content: {
            contentList: "blur",
            contentView: "blur"
          }
        },
        locales: []
      },
      "!no-unauthenticated": {
        identifier: "!no-unauthenticated",
        configurable: false,
        defaultSetting: "hide",
        flags: ["no-override", "unauthed"],
        severity: "none",
        blurs: "content",
        behaviors: {
          account: {
            profileList: "blur",
            profileView: "blur",
            avatar: "blur",
            banner: "blur",
            displayName: "blur",
            contentList: "blur",
            contentView: "blur"
          },
          profile: {
            avatar: "blur",
            banner: "blur",
            displayName: "blur"
          },
          content: {
            contentList: "blur",
            contentView: "blur"
          }
        },
        locales: []
      },
      porn: {
        identifier: "porn",
        configurable: true,
        defaultSetting: "hide",
        flags: ["adult"],
        severity: "none",
        blurs: "media",
        behaviors: {
          account: {
            avatar: "blur",
            banner: "blur"
          },
          profile: {
            avatar: "blur",
            banner: "blur"
          },
          content: {
            contentMedia: "blur"
          }
        },
        locales: []
      },
      sexual: {
        identifier: "sexual",
        configurable: true,
        defaultSetting: "warn",
        flags: ["adult"],
        severity: "none",
        blurs: "media",
        behaviors: {
          account: {
            avatar: "blur",
            banner: "blur"
          },
          profile: {
            avatar: "blur",
            banner: "blur"
          },
          content: {
            contentMedia: "blur"
          }
        },
        locales: []
      },
      nudity: {
        identifier: "nudity",
        configurable: true,
        defaultSetting: "ignore",
        flags: [],
        severity: "none",
        blurs: "media",
        behaviors: {
          account: {
            avatar: "blur",
            banner: "blur"
          },
          profile: {
            avatar: "blur",
            banner: "blur"
          },
          content: {
            contentMedia: "blur"
          }
        },
        locales: []
      },
      "graphic-media": {
        identifier: "graphic-media",
        flags: ["adult"],
        configurable: true,
        defaultSetting: "warn",
        severity: "none",
        blurs: "media",
        behaviors: {
          account: {
            avatar: "blur",
            banner: "blur"
          },
          profile: {
            avatar: "blur",
            banner: "blur"
          },
          content: {
            contentMedia: "blur"
          }
        },
        locales: []
      },
      /** @deprecated alias for `graphic-media` */
      gore: {
        identifier: "gore",
        flags: ["adult"],
        configurable: true,
        defaultSetting: "warn",
        severity: "none",
        blurs: "media",
        behaviors: {
          account: {
            avatar: "blur",
            banner: "blur"
          },
          profile: {
            avatar: "blur",
            banner: "blur"
          },
          content: {
            contentMedia: "blur"
          }
        },
        locales: []
      }
    };
  }
});

// node_modules/@atproto/api/dist/moderation/types.js
var require_types7 = __commonJS({
  "node_modules/@atproto/api/dist/moderation/types.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.NOOP_BEHAVIOR = exports.HIDE_BEHAVIOR = exports.MUTEWORD_BEHAVIOR = exports.MUTE_BEHAVIOR = exports.BLOCK_BEHAVIOR = exports.CUSTOM_LABEL_VALUE_RE = void 0;
    exports.CUSTOM_LABEL_VALUE_RE = /^[a-z-]+$/;
    exports.BLOCK_BEHAVIOR = {
      profileList: "blur",
      profileView: "alert",
      avatar: "blur",
      banner: "blur",
      contentList: "blur",
      contentView: "blur"
    };
    exports.MUTE_BEHAVIOR = {
      profileList: "inform",
      profileView: "alert",
      contentList: "blur",
      contentView: "inform"
    };
    exports.MUTEWORD_BEHAVIOR = {
      contentList: "blur",
      contentView: "blur"
    };
    exports.HIDE_BEHAVIOR = {
      contentList: "blur",
      contentView: "blur"
    };
    exports.NOOP_BEHAVIOR = {};
  }
});

// node_modules/@atproto/api/dist/moderation/ui.js
var require_ui = __commonJS({
  "node_modules/@atproto/api/dist/moderation/ui.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ModerationUI = void 0;
    var ModerationUI = class {
      constructor() {
        Object.defineProperty(this, "noOverride", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: false
        });
        Object.defineProperty(this, "filters", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: []
        });
        Object.defineProperty(this, "blurs", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: []
        });
        Object.defineProperty(this, "alerts", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: []
        });
        Object.defineProperty(this, "informs", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: []
        });
      }
      get filter() {
        return this.filters.length !== 0;
      }
      get blur() {
        return this.blurs.length !== 0;
      }
      get alert() {
        return this.alerts.length !== 0;
      }
      get inform() {
        return this.informs.length !== 0;
      }
    };
    exports.ModerationUI = ModerationUI;
  }
});

// node_modules/@atproto/api/dist/moderation/decision.js
var require_decision = __commonJS({
  "node_modules/@atproto/api/dist/moderation/decision.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ModerationDecision = void 0;
    var labels_1 = require_labels();
    var types_1 = require_types7();
    var ui_1 = require_ui();
    var ModerationBehaviorSeverity;
    (function(ModerationBehaviorSeverity2) {
      ModerationBehaviorSeverity2[ModerationBehaviorSeverity2["High"] = 0] = "High";
      ModerationBehaviorSeverity2[ModerationBehaviorSeverity2["Medium"] = 1] = "Medium";
      ModerationBehaviorSeverity2[ModerationBehaviorSeverity2["Low"] = 2] = "Low";
    })(ModerationBehaviorSeverity || (ModerationBehaviorSeverity = {}));
    var ModerationDecision = class _ModerationDecision {
      constructor() {
        Object.defineProperty(this, "did", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: ""
        });
        Object.defineProperty(this, "isMe", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: false
        });
        Object.defineProperty(this, "causes", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: []
        });
      }
      static merge(...decisions) {
        const decisionsFiltered = decisions.filter((v) => v != null);
        const decision = new _ModerationDecision();
        if (decisionsFiltered[0]) {
          decision.did = decisionsFiltered[0].did;
          decision.isMe = decisionsFiltered[0].isMe;
        }
        decision.causes = decisionsFiltered.flatMap((d) => d.causes);
        return decision;
      }
      downgrade() {
        for (const cause of this.causes) {
          cause.downgraded = true;
        }
        return this;
      }
      get blocked() {
        return !!this.blockCause;
      }
      get muted() {
        return !!this.muteCause;
      }
      get blockCause() {
        return this.causes.find((cause) => cause.type === "blocking" || cause.type === "blocked-by" || cause.type === "block-other");
      }
      get muteCause() {
        return this.causes.find((cause) => cause.type === "muted");
      }
      get labelCauses() {
        return this.causes.filter((cause) => cause.type === "label");
      }
      ui(context) {
        const ui = new ui_1.ModerationUI();
        for (const cause of this.causes) {
          if (cause.type === "blocking" || cause.type === "blocked-by" || cause.type === "block-other") {
            if (this.isMe) {
              continue;
            }
            if (context === "profileList" || context === "contentList") {
              ui.filters.push(cause);
            }
            if (!cause.downgraded) {
              if (types_1.BLOCK_BEHAVIOR[context] === "blur") {
                ui.noOverride = true;
                ui.blurs.push(cause);
              } else if (types_1.BLOCK_BEHAVIOR[context] === "alert") {
                ui.alerts.push(cause);
              } else if (types_1.BLOCK_BEHAVIOR[context] === "inform") {
                ui.informs.push(cause);
              }
            }
          } else if (cause.type === "muted") {
            if (this.isMe) {
              continue;
            }
            if (context === "profileList" || context === "contentList") {
              ui.filters.push(cause);
            }
            if (!cause.downgraded) {
              if (types_1.MUTE_BEHAVIOR[context] === "blur") {
                ui.blurs.push(cause);
              } else if (types_1.MUTE_BEHAVIOR[context] === "alert") {
                ui.alerts.push(cause);
              } else if (types_1.MUTE_BEHAVIOR[context] === "inform") {
                ui.informs.push(cause);
              }
            }
          } else if (cause.type === "mute-word") {
            if (this.isMe) {
              continue;
            }
            if (context === "contentList") {
              ui.filters.push(cause);
            }
            if (!cause.downgraded) {
              if (types_1.MUTEWORD_BEHAVIOR[context] === "blur") {
                ui.blurs.push(cause);
              } else if (types_1.MUTEWORD_BEHAVIOR[context] === "alert") {
                ui.alerts.push(cause);
              } else if (types_1.MUTEWORD_BEHAVIOR[context] === "inform") {
                ui.informs.push(cause);
              }
            }
          } else if (cause.type === "hidden") {
            if (context === "profileList" || context === "contentList") {
              ui.filters.push(cause);
            }
            if (!cause.downgraded) {
              if (types_1.HIDE_BEHAVIOR[context] === "blur") {
                ui.blurs.push(cause);
              } else if (types_1.HIDE_BEHAVIOR[context] === "alert") {
                ui.alerts.push(cause);
              } else if (types_1.HIDE_BEHAVIOR[context] === "inform") {
                ui.informs.push(cause);
              }
            }
          } else if (cause.type === "label") {
            if (context === "profileList" && cause.target === "account") {
              if (cause.setting === "hide" && !this.isMe) {
                ui.filters.push(cause);
              }
            } else if (context === "contentList" && (cause.target === "account" || cause.target === "content")) {
              if (cause.setting === "hide" && !this.isMe) {
                ui.filters.push(cause);
              }
            }
            if (!cause.downgraded) {
              if (cause.behavior[context] === "blur") {
                ui.blurs.push(cause);
                if (cause.noOverride && !this.isMe) {
                  ui.noOverride = true;
                }
              } else if (cause.behavior[context] === "alert") {
                ui.alerts.push(cause);
              } else if (cause.behavior[context] === "inform") {
                ui.informs.push(cause);
              }
            }
          }
        }
        ui.filters.sort(sortByPriority);
        ui.blurs.sort(sortByPriority);
        return ui;
      }
      setDid(did) {
        this.did = did;
      }
      setIsMe(isMe) {
        this.isMe = isMe;
      }
      addHidden(hidden2) {
        if (hidden2) {
          this.causes.push({
            type: "hidden",
            source: { type: "user" },
            priority: 6
          });
        }
      }
      addMutedWord(matches) {
        if (matches?.length) {
          this.causes.push({
            type: "mute-word",
            source: { type: "user" },
            priority: 6,
            matches
          });
        }
      }
      addBlocking(blocking) {
        if (blocking) {
          this.causes.push({
            type: "blocking",
            source: { type: "user" },
            priority: 3
          });
        }
      }
      addBlockingByList(blockingByList) {
        if (blockingByList) {
          this.causes.push({
            type: "blocking",
            source: { type: "list", list: blockingByList },
            priority: 3
          });
        }
      }
      addBlockedBy(blockedBy) {
        if (blockedBy) {
          this.causes.push({
            type: "blocked-by",
            source: { type: "user" },
            priority: 4
          });
        }
      }
      addBlockOther(blockOther) {
        if (blockOther) {
          this.causes.push({
            type: "block-other",
            source: { type: "user" },
            priority: 4
          });
        }
      }
      addLabel(target, label, opts) {
        const labelDef = types_1.CUSTOM_LABEL_VALUE_RE.test(label.val) ? opts.labelDefs?.[label.src]?.find((def) => def.identifier === label.val) || labels_1.LABELS[label.val] : labels_1.LABELS[label.val];
        if (!labelDef) {
          return;
        }
        const isSelf = label.src === this.did;
        const labeler = isSelf ? void 0 : opts.prefs.labelers.find((s) => s.did === label.src);
        if (!isSelf && !labeler) {
          return;
        }
        if (isSelf && labelDef.flags.includes("no-self")) {
          return;
        }
        let labelPref = labelDef.defaultSetting || "ignore";
        if (!labelDef.configurable) {
          labelPref = labelDef.defaultSetting || "hide";
        } else if (labelDef.flags.includes("adult") && !opts.prefs.adultContentEnabled) {
          labelPref = "hide";
        } else if (labeler?.labels[labelDef.identifier]) {
          labelPref = labeler?.labels[labelDef.identifier];
        } else if (opts.prefs.labels[labelDef.identifier]) {
          labelPref = opts.prefs.labels[labelDef.identifier];
        }
        if (labelPref === "ignore") {
          return;
        }
        if (labelDef.flags.includes("unauthed") && !!opts.userDid) {
          return;
        }
        let priority;
        const severity = measureModerationBehaviorSeverity(labelDef.behaviors[target]);
        if (labelDef.flags.includes("no-override") || labelDef.flags.includes("adult") && !opts.prefs.adultContentEnabled) {
          priority = 1;
        } else if (labelPref === "hide") {
          priority = 2;
        } else if (severity === ModerationBehaviorSeverity.High) {
          priority = 5;
        } else if (severity === ModerationBehaviorSeverity.Medium) {
          priority = 7;
        } else {
          priority = 8;
        }
        let noOverride = false;
        if (labelDef.flags.includes("no-override")) {
          noOverride = true;
        } else if (labelDef.flags.includes("adult") && !opts.prefs.adultContentEnabled) {
          noOverride = true;
        }
        this.causes.push({
          type: "label",
          source: isSelf || !labeler ? { type: "user" } : { type: "labeler", did: labeler.did },
          label,
          labelDef,
          target,
          setting: labelPref,
          behavior: labelDef.behaviors[target] || types_1.NOOP_BEHAVIOR,
          noOverride,
          priority
        });
      }
      addMuted(muted) {
        if (muted) {
          this.causes.push({
            type: "muted",
            source: { type: "user" },
            priority: 6
          });
        }
      }
      addMutedByList(mutedByList) {
        if (mutedByList) {
          this.causes.push({
            type: "muted",
            source: { type: "list", list: mutedByList },
            priority: 6
          });
        }
      }
    };
    exports.ModerationDecision = ModerationDecision;
    function measureModerationBehaviorSeverity(beh) {
      if (!beh) {
        return ModerationBehaviorSeverity.Low;
      }
      if (beh.profileView === "blur" || beh.contentView === "blur") {
        return ModerationBehaviorSeverity.High;
      }
      if (beh.contentList === "blur" || beh.contentMedia === "blur") {
        return ModerationBehaviorSeverity.Medium;
      }
      return ModerationBehaviorSeverity.Low;
    }
    function sortByPriority(a, b) {
      return a.priority - b.priority;
    }
  }
});

// node_modules/@atproto/api/dist/moderation/subjects/account.js
var require_account = __commonJS({
  "node_modules/@atproto/api/dist/moderation/subjects/account.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.decideAccount = decideAccount;
    exports.filterAccountLabels = filterAccountLabels;
    var decision_1 = require_decision();
    function decideAccount(subject, opts) {
      const acc = new decision_1.ModerationDecision();
      acc.setDid(subject.did);
      acc.setIsMe(subject.did === opts.userDid);
      if (subject.viewer?.muted) {
        if (subject.viewer?.mutedByList) {
          acc.addMutedByList(subject.viewer?.mutedByList);
        } else {
          acc.addMuted(subject.viewer?.muted);
        }
      }
      if (subject.viewer?.blocking) {
        if (subject.viewer?.blockingByList) {
          acc.addBlockingByList(subject.viewer?.blockingByList);
        } else {
          acc.addBlocking(subject.viewer?.blocking);
        }
      }
      acc.addBlockedBy(subject.viewer?.blockedBy);
      for (const label of filterAccountLabels(subject.labels)) {
        acc.addLabel("account", label, opts);
      }
      return acc;
    }
    function filterAccountLabels(labels) {
      if (!labels) {
        return [];
      }
      return labels.filter((label) => !label.uri.endsWith("/app.bsky.actor.profile/self") || label.val === "!no-unauthenticated");
    }
  }
});

// node_modules/@atproto/api/dist/moderation/subjects/profile.js
var require_profile2 = __commonJS({
  "node_modules/@atproto/api/dist/moderation/subjects/profile.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.decideProfile = decideProfile;
    exports.filterProfileLabels = filterProfileLabels;
    var decision_1 = require_decision();
    function decideProfile(subject, opts) {
      const acc = new decision_1.ModerationDecision();
      acc.setDid(subject.did);
      acc.setIsMe(subject.did === opts.userDid);
      for (const label of filterProfileLabels(subject.labels)) {
        acc.addLabel("profile", label, opts);
      }
      return acc;
    }
    function filterProfileLabels(labels) {
      if (!labels) {
        return [];
      }
      return labels.filter((label) => label.uri.endsWith("/app.bsky.actor.profile/self"));
    }
  }
});

// node_modules/@atproto/api/dist/moderation/subjects/feed-generator.js
var require_feed_generator = __commonJS({
  "node_modules/@atproto/api/dist/moderation/subjects/feed-generator.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.decideFeedGenerator = decideFeedGenerator;
    var decision_1 = require_decision();
    var account_1 = require_account();
    var profile_1 = require_profile2();
    function decideFeedGenerator(subject, opts) {
      const acc = new decision_1.ModerationDecision();
      acc.setDid(subject.creator.did);
      acc.setIsMe(subject.creator.did === opts.userDid);
      if (subject.labels?.length) {
        for (const label of subject.labels) {
          acc.addLabel("content", label, opts);
        }
      }
      return decision_1.ModerationDecision.merge(acc, (0, account_1.decideAccount)(subject.creator, opts), (0, profile_1.decideProfile)(subject.creator, opts));
    }
  }
});

// node_modules/@atproto/api/dist/moderation/subjects/notification.js
var require_notification = __commonJS({
  "node_modules/@atproto/api/dist/moderation/subjects/notification.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.decideNotification = decideNotification;
    var decision_1 = require_decision();
    var account_1 = require_account();
    var profile_1 = require_profile2();
    function decideNotification(subject, opts) {
      const acc = new decision_1.ModerationDecision();
      acc.setDid(subject.author.did);
      acc.setIsMe(subject.author.did === opts.userDid);
      if (subject.labels?.length) {
        for (const label of subject.labels) {
          acc.addLabel("content", label, opts);
        }
      }
      return decision_1.ModerationDecision.merge(acc, (0, account_1.decideAccount)(subject.author, opts), (0, profile_1.decideProfile)(subject.author, opts));
    }
  }
});

// node_modules/@atproto/api/dist/moderation/mutewords.js
var require_mutewords = __commonJS({
  "node_modules/@atproto/api/dist/moderation/mutewords.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.matchMuteWords = matchMuteWords;
    exports.hasMutedWord = hasMutedWord;
    var client_1 = require_client2();
    var REGEX2 = {
      LEADING_TRAILING_PUNCTUATION: /(?:^\p{P}+|\p{P}+$)/gu,
      ESCAPE: /[[\]{}()*+?.\\^$|\s]/g,
      SEPARATORS: /[/\-–—()[\]_]+/g,
      WORD_BOUNDARY: /[\s\n\t\r\f\v]+?/g
    };
    var LANGUAGE_EXCEPTIONS = [
      "ja",
      // Japanese
      "zh",
      // Chinese
      "ko",
      // Korean
      "th",
      // Thai
      "vi"
      // Vietnamese
    ];
    function matchMuteWords({ mutedWords, text, facets, outlineTags, languages, actor }) {
      const exception = LANGUAGE_EXCEPTIONS.includes(languages?.[0] || "");
      const tags = [].concat(outlineTags || []).concat((facets || []).flatMap((facet) => facet.features.filter(client_1.AppBskyRichtextFacet.isTag).map((tag2) => tag2.tag))).map((t) => t.toLowerCase());
      const matches = [];
      outer: for (const muteWord of mutedWords) {
        const mutedWord = muteWord.value.toLowerCase();
        const postText = text.toLowerCase();
        if (muteWord.expiresAt && muteWord.expiresAt < (/* @__PURE__ */ new Date()).toISOString())
          continue;
        if (muteWord.actorTarget === "exclude-following" && Boolean(actor?.viewer?.following))
          continue;
        if (tags.includes(mutedWord)) {
          matches.push({ word: muteWord, predicate: muteWord.value });
          continue;
        }
        if (!muteWord.targets.includes("content"))
          continue;
        if ((mutedWord.length === 1 || exception) && postText.includes(mutedWord)) {
          matches.push({ word: muteWord, predicate: muteWord.value });
          continue;
        }
        if (mutedWord.length > postText.length)
          continue;
        if (mutedWord === postText) {
          matches.push({ word: muteWord, predicate: muteWord.value });
          continue;
        }
        if (/(?:\s|\p{P})+?/u.test(mutedWord) && postText.includes(mutedWord)) {
          matches.push({ word: muteWord, predicate: muteWord.value });
          continue;
        }
        const words = postText.split(REGEX2.WORD_BOUNDARY);
        for (const word of words) {
          if (word === mutedWord) {
            matches.push({ word: muteWord, predicate: word });
            continue outer;
          }
          const wordTrimmedPunctuation = word.replace(REGEX2.LEADING_TRAILING_PUNCTUATION, "");
          if (mutedWord === wordTrimmedPunctuation) {
            matches.push({ word: muteWord, predicate: word });
            continue outer;
          }
          if (mutedWord.length > wordTrimmedPunctuation.length)
            continue;
          if (/\p{P}+/u.test(wordTrimmedPunctuation)) {
            if (/[/]+/.test(wordTrimmedPunctuation)) {
              continue outer;
            }
            const spacedWord = wordTrimmedPunctuation.replace(/\p{P}+/gu, " ");
            if (spacedWord === mutedWord) {
              matches.push({ word: muteWord, predicate: word });
              continue outer;
            }
            const contiguousWord = spacedWord.replace(/\s/gu, "");
            if (contiguousWord === mutedWord) {
              matches.push({ word: muteWord, predicate: word });
              continue outer;
            }
            const wordParts = wordTrimmedPunctuation.split(/\p{P}+/u);
            for (const wordPart of wordParts) {
              if (wordPart === mutedWord) {
                matches.push({ word: muteWord, predicate: word });
                continue outer;
              }
            }
          }
        }
      }
      return matches.length ? matches : void 0;
    }
    function hasMutedWord(params) {
      return !!matchMuteWords(params);
    }
  }
});

// node_modules/@atproto/api/dist/moderation/subjects/post.js
var require_post2 = __commonJS({
  "node_modules/@atproto/api/dist/moderation/subjects/post.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.decidePost = decidePost;
    var client_1 = require_client2();
    var decision_1 = require_decision();
    var mutewords_1 = require_mutewords();
    var account_1 = require_account();
    var profile_1 = require_profile2();
    function decidePost(subject, opts) {
      return decision_1.ModerationDecision.merge(decideSubject(subject, opts), decideEmbed(subject.embed, opts)?.downgrade(), (0, account_1.decideAccount)(subject.author, opts), (0, profile_1.decideProfile)(subject.author, opts));
    }
    function decideSubject(subject, opts) {
      const acc = new decision_1.ModerationDecision();
      acc.setDid(subject.author.did);
      acc.setIsMe(subject.author.did === opts.userDid);
      if (subject.labels?.length) {
        for (const label of subject.labels) {
          acc.addLabel("content", label, opts);
        }
      }
      acc.addHidden(checkHiddenPost(subject, opts.prefs.hiddenPosts));
      if (!acc.isMe) {
        acc.addMutedWord(matchAllMuteWords(subject, opts.prefs.mutedWords));
      }
      return acc;
    }
    function decideEmbed(embed, opts) {
      if (embed) {
        if ((client_1.AppBskyEmbedRecord.isView(embed) || client_1.AppBskyEmbedRecordWithMedia.isView(embed)) && client_1.AppBskyEmbedRecord.isViewRecord(embed.record)) {
          return decideQuotedPost(embed.record, opts);
        } else if (client_1.AppBskyEmbedRecordWithMedia.isView(embed) && client_1.AppBskyEmbedRecord.isViewRecord(embed.record.record)) {
          return decideQuotedPost(embed.record.record, opts);
        } else if ((client_1.AppBskyEmbedRecord.isView(embed) || client_1.AppBskyEmbedRecordWithMedia.isView(embed)) && client_1.AppBskyEmbedRecord.isViewBlocked(embed.record)) {
          return decideBlockedQuotedPost(embed.record, opts);
        } else if (client_1.AppBskyEmbedRecordWithMedia.isView(embed) && client_1.AppBskyEmbedRecord.isViewBlocked(embed.record.record)) {
          return decideBlockedQuotedPost(embed.record.record, opts);
        }
      }
      return void 0;
    }
    function decideQuotedPost(subject, opts) {
      const acc = new decision_1.ModerationDecision();
      acc.setDid(subject.author.did);
      acc.setIsMe(subject.author.did === opts.userDid);
      if (subject.labels?.length) {
        for (const label of subject.labels) {
          acc.addLabel("content", label, opts);
        }
      }
      return decision_1.ModerationDecision.merge(acc, (0, account_1.decideAccount)(subject.author, opts), (0, profile_1.decideProfile)(subject.author, opts));
    }
    function decideBlockedQuotedPost(subject, opts) {
      const acc = new decision_1.ModerationDecision();
      acc.setDid(subject.author.did);
      acc.setIsMe(subject.author.did === opts.userDid);
      if (subject.author.viewer?.muted) {
        if (subject.author.viewer?.mutedByList) {
          acc.addMutedByList(subject.author.viewer?.mutedByList);
        } else {
          acc.addMuted(subject.author.viewer?.muted);
        }
      }
      if (subject.author.viewer?.blocking) {
        if (subject.author.viewer?.blockingByList) {
          acc.addBlockingByList(subject.author.viewer?.blockingByList);
        } else {
          acc.addBlocking(subject.author.viewer?.blocking);
        }
      }
      acc.addBlockedBy(subject.author.viewer?.blockedBy);
      return acc;
    }
    function checkHiddenPost(subject, hiddenPosts) {
      if (!hiddenPosts?.length) {
        return false;
      }
      if (hiddenPosts.includes(subject.uri)) {
        return true;
      }
      if (subject.embed) {
        if (client_1.AppBskyEmbedRecord.isView(subject.embed) && client_1.AppBskyEmbedRecord.isViewRecord(subject.embed.record) && hiddenPosts.includes(subject.embed.record.uri)) {
          return true;
        }
        if (client_1.AppBskyEmbedRecordWithMedia.isView(subject.embed) && client_1.AppBskyEmbedRecord.isViewRecord(subject.embed.record.record) && hiddenPosts.includes(subject.embed.record.record.uri)) {
          return true;
        }
      }
      return false;
    }
    function matchAllMuteWords(subject, mutedWords) {
      if (!mutedWords?.length) {
        return;
      }
      const postAuthor = subject.author;
      if (client_1.AppBskyFeedPost.isRecord(subject.record)) {
        const post = subject.record;
        const matches = (0, mutewords_1.matchMuteWords)({
          mutedWords,
          text: post.text,
          facets: post.facets,
          outlineTags: post.tags,
          languages: post.langs,
          actor: postAuthor
        });
        if (matches) {
          return matches;
        }
        if (post.embed && client_1.AppBskyEmbedImages.isMain(post.embed)) {
          for (const image of post.embed.images) {
            const matches2 = (0, mutewords_1.matchMuteWords)({
              mutedWords,
              text: image.alt,
              languages: post.langs,
              actor: postAuthor
            });
            if (matches2) {
              return matches2;
            }
          }
        }
      }
      const { embed } = subject;
      if (embed) {
        if ((client_1.AppBskyEmbedRecord.isView(embed) || client_1.AppBskyEmbedRecordWithMedia.isView(embed)) && client_1.AppBskyEmbedRecord.isViewRecord(embed.record)) {
          if (client_1.AppBskyFeedPost.isRecord(embed.record.value)) {
            const embeddedPost = embed.record.value;
            const embedAuthor = embed.record.author;
            const matches = (0, mutewords_1.matchMuteWords)({
              mutedWords,
              text: embeddedPost.text,
              facets: embeddedPost.facets,
              outlineTags: embeddedPost.tags,
              languages: embeddedPost.langs,
              actor: embedAuthor
            });
            if (matches) {
              return matches;
            }
            if (client_1.AppBskyEmbedImages.isMain(embeddedPost.embed)) {
              for (const image of embeddedPost.embed.images) {
                const matches2 = (0, mutewords_1.matchMuteWords)({
                  mutedWords,
                  text: image.alt,
                  languages: embeddedPost.langs,
                  actor: embedAuthor
                });
                if (matches2) {
                  return matches2;
                }
              }
            }
            if (client_1.AppBskyEmbedExternal.isMain(embeddedPost.embed)) {
              const { external } = embeddedPost.embed;
              const matches2 = (0, mutewords_1.matchMuteWords)({
                mutedWords,
                text: external.title + " " + external.description,
                languages: [],
                actor: embedAuthor
              });
              if (matches2) {
                return matches2;
              }
            }
            if (client_1.AppBskyEmbedRecordWithMedia.isMain(embeddedPost.embed)) {
              if (client_1.AppBskyEmbedExternal.isMain(embeddedPost.embed.media)) {
                const { external } = embeddedPost.embed.media;
                const matches2 = (0, mutewords_1.matchMuteWords)({
                  mutedWords,
                  text: external.title + " " + external.description,
                  languages: [],
                  actor: embedAuthor
                });
                if (matches2) {
                  return matches2;
                }
              }
              if (client_1.AppBskyEmbedImages.isMain(embeddedPost.embed.media)) {
                for (const image of embeddedPost.embed.media.images) {
                  const matches2 = (0, mutewords_1.matchMuteWords)({
                    mutedWords,
                    text: image.alt,
                    languages: client_1.AppBskyFeedPost.isRecord(embeddedPost.record) ? embeddedPost.langs : [],
                    actor: embedAuthor
                  });
                  if (matches2) {
                    return matches2;
                  }
                }
              }
            }
          }
        } else if (client_1.AppBskyEmbedExternal.isView(embed)) {
          const { external } = embed;
          const matches = (0, mutewords_1.matchMuteWords)({
            mutedWords,
            text: external.title + " " + external.description,
            languages: [],
            actor: postAuthor
          });
          if (matches) {
            return matches;
          }
        } else if (client_1.AppBskyEmbedRecordWithMedia.isView(embed) && client_1.AppBskyEmbedRecord.isViewRecord(embed.record.record)) {
          const embedAuthor = embed.record.record.author;
          if (client_1.AppBskyFeedPost.isRecord(embed.record.record.value)) {
            const post = embed.record.record.value;
            const matches = (0, mutewords_1.matchMuteWords)({
              mutedWords,
              text: post.text,
              facets: post.facets,
              outlineTags: post.tags,
              languages: post.langs,
              actor: embedAuthor
            });
            if (matches) {
              return matches;
            }
          }
          if (client_1.AppBskyEmbedImages.isView(embed.media)) {
            for (const image of embed.media.images) {
              const matches = (0, mutewords_1.matchMuteWords)({
                mutedWords,
                text: image.alt,
                languages: client_1.AppBskyFeedPost.isRecord(subject.record) ? subject.record.langs : [],
                actor: embedAuthor
              });
              if (matches) {
                return matches;
              }
            }
          }
          if (client_1.AppBskyEmbedExternal.isView(embed.media)) {
            const { external } = embed.media;
            const matches = (0, mutewords_1.matchMuteWords)({
              mutedWords,
              text: external.title + " " + external.description,
              languages: [],
              actor: embedAuthor
            });
            if (matches) {
              return matches;
            }
          }
        }
      }
    }
  }
});

// node_modules/@atproto/api/dist/moderation/subjects/user-list.js
var require_user_list = __commonJS({
  "node_modules/@atproto/api/dist/moderation/subjects/user-list.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.decideUserList = decideUserList;
    var syntax_1 = require_dist5();
    var decision_1 = require_decision();
    var account_1 = require_account();
    var profile_1 = require_profile2();
    function decideUserList(subject, opts) {
      const acc = new decision_1.ModerationDecision();
      const creator = (
        // Note: ListViewBasic should not contain a creator field, but let's support it anyway
        "creator" in subject && isProfile(subject.creator) ? subject.creator : void 0
      );
      if (creator) {
        acc.setDid(creator.did);
        acc.setIsMe(creator.did === opts.userDid);
        if (subject.labels?.length) {
          for (const label of subject.labels) {
            acc.addLabel("content", label, opts);
          }
        }
        return decision_1.ModerationDecision.merge(acc, (0, account_1.decideAccount)(creator, opts), (0, profile_1.decideProfile)(creator, opts));
      }
      const creatorDid = new syntax_1.AtUri(subject.uri).hostname;
      acc.setDid(creatorDid);
      acc.setIsMe(creatorDid === opts.userDid);
      if (subject.labels?.length) {
        for (const label of subject.labels) {
          acc.addLabel("content", label, opts);
        }
      }
      return acc;
    }
    function isProfile(v) {
      return v && typeof v === "object" && "did" in v;
    }
  }
});

// node_modules/@atproto/api/dist/moderation/util.js
var require_util10 = __commonJS({
  "node_modules/@atproto/api/dist/moderation/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isQuotedPost = isQuotedPost;
    exports.isQuotedPostWithMedia = isQuotedPostWithMedia;
    exports.interpretLabelValueDefinition = interpretLabelValueDefinition;
    exports.interpretLabelValueDefinitions = interpretLabelValueDefinitions;
    var client_1 = require_client2();
    var util_1 = require_util5();
    function isQuotedPost(embed) {
      return Boolean(embed && client_1.AppBskyEmbedRecord.isView(embed));
    }
    function isQuotedPostWithMedia(embed) {
      return Boolean(embed && client_1.AppBskyEmbedRecordWithMedia.isView(embed));
    }
    function interpretLabelValueDefinition(def, definedBy) {
      const behaviors = {
        account: {},
        profile: {},
        content: {}
      };
      const alertOrInform = def.severity === "alert" ? "alert" : def.severity === "inform" ? "inform" : void 0;
      if (def.blurs === "content") {
        behaviors.account.profileList = alertOrInform;
        behaviors.account.profileView = alertOrInform;
        behaviors.account.contentList = "blur";
        behaviors.account.contentView = def.adultOnly ? "blur" : alertOrInform;
        behaviors.profile.profileList = alertOrInform;
        behaviors.profile.profileView = alertOrInform;
        behaviors.content.contentList = "blur";
        behaviors.content.contentView = def.adultOnly ? "blur" : alertOrInform;
      } else if (def.blurs === "media") {
        behaviors.account.profileList = alertOrInform;
        behaviors.account.profileView = alertOrInform;
        behaviors.account.avatar = "blur";
        behaviors.account.banner = "blur";
        behaviors.profile.profileList = alertOrInform;
        behaviors.profile.profileView = alertOrInform;
        behaviors.profile.avatar = "blur";
        behaviors.profile.banner = "blur";
        behaviors.content.contentMedia = "blur";
      } else if (def.blurs === "none") {
        behaviors.account.profileList = alertOrInform;
        behaviors.account.profileView = alertOrInform;
        behaviors.account.contentList = alertOrInform;
        behaviors.account.contentView = alertOrInform;
        behaviors.profile.profileList = alertOrInform;
        behaviors.profile.profileView = alertOrInform;
        behaviors.content.contentList = alertOrInform;
        behaviors.content.contentView = alertOrInform;
      }
      let defaultSetting = "warn";
      if (def.defaultSetting === "hide" || def.defaultSetting === "ignore") {
        defaultSetting = def.defaultSetting;
      }
      const flags = ["no-self"];
      if (def.adultOnly) {
        flags.push("adult");
      }
      return {
        ...def,
        definedBy,
        configurable: true,
        defaultSetting,
        flags,
        behaviors
      };
    }
    function interpretLabelValueDefinitions(labelerView) {
      return (labelerView.policies?.labelValueDefinitions || []).filter((0, util_1.asPredicate)(client_1.ComAtprotoLabelDefs.validateLabelValueDefinition)).map((labelValDef) => interpretLabelValueDefinition(labelValDef, labelerView.creator.did));
    }
  }
});

// node_modules/@atproto/api/dist/moderation/index.js
var require_moderation = __commonJS({
  "node_modules/@atproto/api/dist/moderation/index.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.interpretLabelValueDefinitions = exports.interpretLabelValueDefinition = exports.matchMuteWords = exports.hasMutedWord = exports.ModerationDecision = exports.ModerationUI = void 0;
    exports.moderateProfile = moderateProfile;
    exports.moderatePost = moderatePost;
    exports.moderateNotification = moderateNotification;
    exports.moderateFeedGenerator = moderateFeedGenerator;
    exports.moderateUserList = moderateUserList;
    var decision_1 = require_decision();
    var account_1 = require_account();
    var feed_generator_1 = require_feed_generator();
    var notification_1 = require_notification();
    var post_1 = require_post2();
    var profile_1 = require_profile2();
    var user_list_1 = require_user_list();
    var ui_1 = require_ui();
    Object.defineProperty(exports, "ModerationUI", { enumerable: true, get: function() {
      return ui_1.ModerationUI;
    } });
    var decision_2 = require_decision();
    Object.defineProperty(exports, "ModerationDecision", { enumerable: true, get: function() {
      return decision_2.ModerationDecision;
    } });
    var mutewords_1 = require_mutewords();
    Object.defineProperty(exports, "hasMutedWord", { enumerable: true, get: function() {
      return mutewords_1.hasMutedWord;
    } });
    Object.defineProperty(exports, "matchMuteWords", { enumerable: true, get: function() {
      return mutewords_1.matchMuteWords;
    } });
    var util_1 = require_util10();
    Object.defineProperty(exports, "interpretLabelValueDefinition", { enumerable: true, get: function() {
      return util_1.interpretLabelValueDefinition;
    } });
    Object.defineProperty(exports, "interpretLabelValueDefinitions", { enumerable: true, get: function() {
      return util_1.interpretLabelValueDefinitions;
    } });
    function moderateProfile(subject, opts) {
      return decision_1.ModerationDecision.merge((0, account_1.decideAccount)(subject, opts), (0, profile_1.decideProfile)(subject, opts));
    }
    function moderatePost(subject, opts) {
      return (0, post_1.decidePost)(subject, opts);
    }
    function moderateNotification(subject, opts) {
      return (0, notification_1.decideNotification)(subject, opts);
    }
    function moderateFeedGenerator(subject, opts) {
      return (0, feed_generator_1.decideFeedGenerator)(subject, opts);
    }
    function moderateUserList(subject, opts) {
      return (0, user_list_1.decideUserList)(subject, opts);
    }
  }
});

// node_modules/@atproto/api/dist/mocker.js
var require_mocker = __commonJS({
  "node_modules/@atproto/api/dist/mocker.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.mock = void 0;
    var FAKE_CID = "bafyreiclp443lavogvhj3d2ob2cxbfuscni2k5jk7bebjzg7khl3esabwq";
    exports.mock = {
      post({ text, facets, reply, embed }) {
        return {
          $type: "app.bsky.feed.post",
          text,
          facets,
          reply,
          embed,
          langs: ["en"],
          createdAt: (/* @__PURE__ */ new Date()).toISOString()
        };
      },
      postView({ record, author, embed, replyCount, repostCount, likeCount, viewer, labels }) {
        return {
          $type: "app.bsky.feed.defs#postView",
          uri: `at://${author.did}/app.bsky.feed.post/fake`,
          cid: FAKE_CID,
          author,
          record,
          embed,
          replyCount,
          repostCount,
          likeCount,
          indexedAt: (/* @__PURE__ */ new Date()).toISOString(),
          viewer,
          labels
        };
      },
      embedRecordView({ record, author, labels }) {
        return {
          $type: "app.bsky.embed.record#view",
          record: {
            $type: "app.bsky.embed.record#viewRecord",
            uri: `at://${author.did}/app.bsky.feed.post/fake`,
            cid: FAKE_CID,
            author,
            value: record,
            labels,
            indexedAt: (/* @__PURE__ */ new Date()).toISOString()
          }
        };
      },
      profileViewBasic({ handle, displayName, description, viewer, labels }) {
        return {
          did: `did:web:${handle}`,
          handle,
          displayName,
          // @ts-expect-error technically not in ProfileViewBasic but useful in some cases
          description,
          viewer,
          labels
        };
      },
      actorViewerState({ muted, mutedByList, blockedBy, blocking, blockingByList, following, followedBy }) {
        return {
          muted,
          mutedByList,
          blockedBy,
          blocking,
          blockingByList,
          following,
          followedBy
        };
      },
      listViewBasic({ name: name2 }) {
        return {
          uri: "at://did:plc:fake/app.bsky.graph.list/fake",
          cid: FAKE_CID,
          name: name2,
          purpose: "app.bsky.graph.defs#modlist",
          indexedAt: (/* @__PURE__ */ new Date()).toISOString()
        };
      },
      replyNotification({ author, record, labels }) {
        return {
          uri: `at://${author.did}/app.bsky.feed.post/fake`,
          cid: FAKE_CID,
          author,
          reason: "reply",
          reasonSubject: `at://${author.did}/app.bsky.feed.post/fake-parent`,
          record,
          isRead: false,
          indexedAt: (/* @__PURE__ */ new Date()).toISOString(),
          labels
        };
      },
      followNotification({ author, subjectDid, labels }) {
        return {
          uri: `at://${author.did}/app.bsky.graph.follow/fake`,
          cid: FAKE_CID,
          author,
          reason: "follow",
          record: {
            $type: "app.bsky.graph.follow",
            createdAt: (/* @__PURE__ */ new Date()).toISOString(),
            subject: subjectDid
          },
          isRead: false,
          indexedAt: (/* @__PURE__ */ new Date()).toISOString(),
          labels
        };
      },
      label({ val, uri, src: src2 }) {
        return {
          src: src2 || "did:plc:fake-labeler",
          uri,
          val,
          cts: (/* @__PURE__ */ new Date()).toISOString()
        };
      }
    };
  }
});

// node_modules/await-lock/build/AwaitLock.js
var require_AwaitLock = __commonJS({
  "node_modules/await-lock/build/AwaitLock.js"(exports) {
    "use strict";
    var __classPrivateFieldGet2 = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
      return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
    };
    var __classPrivateFieldSet2 = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
      if (kind === "m") throw new TypeError("Private method is not writable");
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
      return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
    };
    var _AwaitLock_acquired;
    var _AwaitLock_waitingResolvers;
    Object.defineProperty(exports, "__esModule", { value: true });
    var AwaitLock = class {
      constructor() {
        _AwaitLock_acquired.set(this, false);
        _AwaitLock_waitingResolvers.set(this, /* @__PURE__ */ new Set());
      }
      /**
       * Whether the lock is currently acquired or not. Accessing this property does not affect the
       * status of the lock.
       */
      get acquired() {
        return __classPrivateFieldGet2(this, _AwaitLock_acquired, "f");
      }
      /**
       * Acquires the lock, waiting if necessary for it to become free if it is already locked. The
       * returned promise is fulfilled once the lock is acquired.
       *
       * A timeout (in milliseconds) may be optionally provided. If the lock cannot be acquired before
       * the timeout elapses, the returned promise is rejected with an error. The behavior of invalid
       * timeout values depends on how `setTimeout` handles those values.
       *
       * After acquiring the lock, you **must** call `release` when you are done with it.
       */
      acquireAsync({ timeout } = {}) {
        if (!__classPrivateFieldGet2(this, _AwaitLock_acquired, "f")) {
          __classPrivateFieldSet2(this, _AwaitLock_acquired, true, "f");
          return Promise.resolve();
        }
        if (timeout == null) {
          return new Promise((resolve) => {
            __classPrivateFieldGet2(this, _AwaitLock_waitingResolvers, "f").add(resolve);
          });
        }
        let resolver;
        let timer;
        return Promise.race([
          new Promise((resolve) => {
            resolver = () => {
              clearTimeout(timer);
              resolve();
            };
            __classPrivateFieldGet2(this, _AwaitLock_waitingResolvers, "f").add(resolver);
          }),
          new Promise((_, reject) => {
            timer = setTimeout(() => {
              __classPrivateFieldGet2(this, _AwaitLock_waitingResolvers, "f").delete(resolver);
              reject(new Error(`Timed out waiting for lock`));
            }, timeout);
          })
        ]);
      }
      /**
       * Acquires the lock if it is free and otherwise returns immediately without waiting. Returns
       * `true` if the lock was free and is now acquired, and `false` otherwise.
       *
       * This method differs from calling `acquireAsync` with a zero-millisecond timeout in that it runs
       * synchronously without waiting for the JavaScript task queue.
       */
      tryAcquire() {
        if (!__classPrivateFieldGet2(this, _AwaitLock_acquired, "f")) {
          __classPrivateFieldSet2(this, _AwaitLock_acquired, true, "f");
          return true;
        }
        return false;
      }
      /**
       * Releases the lock and gives it to the next waiting acquirer, if there is one. Each acquirer
       * must release the lock exactly once.
       */
      release() {
        if (!__classPrivateFieldGet2(this, _AwaitLock_acquired, "f")) {
          throw new Error(`Cannot release an unacquired lock`);
        }
        if (__classPrivateFieldGet2(this, _AwaitLock_waitingResolvers, "f").size > 0) {
          const [resolve] = __classPrivateFieldGet2(this, _AwaitLock_waitingResolvers, "f");
          __classPrivateFieldGet2(this, _AwaitLock_waitingResolvers, "f").delete(resolve);
          resolve();
        } else {
          __classPrivateFieldSet2(this, _AwaitLock_acquired, false, "f");
        }
      }
    };
    exports.default = AwaitLock;
    _AwaitLock_acquired = /* @__PURE__ */ new WeakMap(), _AwaitLock_waitingResolvers = /* @__PURE__ */ new WeakMap();
  }
});

// node_modules/@atproto/api/dist/predicate.js
var require_predicate = __commonJS({
  "node_modules/@atproto/api/dist/predicate.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isValidVerificationPrefs = exports.isValidThreadViewPref = exports.isValidSavedFeedsPrefV2 = exports.isValidSavedFeedsPref = exports.isValidPostInteractionSettingsPref = exports.isValidPersonalDetailsPref = exports.isValidMutedWordsPref = exports.isValidLabelersPref = exports.isValidInterestsPref = exports.isValidHiddenPostsPref = exports.isValidFeedViewPref = exports.isValidContentLabelPref = exports.isValidBskyAppStatePref = exports.isValidAdultContentPref = exports.isValidProfile = void 0;
    var index_1 = require_client2();
    var util_1 = require_util5();
    exports.isValidProfile = (0, util_1.asPredicate)(index_1.AppBskyActorProfile.validateRecord);
    exports.isValidAdultContentPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateAdultContentPref);
    exports.isValidBskyAppStatePref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateBskyAppStatePref);
    exports.isValidContentLabelPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateContentLabelPref);
    exports.isValidFeedViewPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateFeedViewPref);
    exports.isValidHiddenPostsPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateHiddenPostsPref);
    exports.isValidInterestsPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateInterestsPref);
    exports.isValidLabelersPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateLabelersPref);
    exports.isValidMutedWordsPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateMutedWordsPref);
    exports.isValidPersonalDetailsPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validatePersonalDetailsPref);
    exports.isValidPostInteractionSettingsPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validatePostInteractionSettingsPref);
    exports.isValidSavedFeedsPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateSavedFeedsPref);
    exports.isValidSavedFeedsPrefV2 = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateSavedFeedsPrefV2);
    exports.isValidThreadViewPref = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateThreadViewPref);
    exports.isValidVerificationPrefs = (0, util_1.asPredicate)(index_1.AppBskyActorDefs.validateVerificationPrefs);
  }
});

// node_modules/@atproto/api/dist/agent.js
var require_agent = __commonJS({
  "node_modules/@atproto/api/dist/agent.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __setModuleDefault2 = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
      Object.defineProperty(o, "default", { enumerable: true, value: v });
    } : function(o, v) {
      o["default"] = v;
    });
    var __importStar2 = exports && exports.__importStar || /* @__PURE__ */ function() {
      var ownKeys2 = function(o) {
        ownKeys2 = 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 ownKeys2(o);
      };
      return function(mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) {
          for (var k = ownKeys2(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding2(result, mod, k[i]);
        }
        __setModuleDefault2(result, mod);
        return result;
      };
    }();
    var __classPrivateFieldGet2 = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
      return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
    };
    var __importDefault2 = exports && exports.__importDefault || function(mod) {
      return mod && mod.__esModule ? mod : { "default": mod };
    };
    var _Agent_prefsLock;
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Agent = void 0;
    var await_lock_1 = __importDefault2(require_AwaitLock());
    var common_web_1 = require_dist4();
    var syntax_1 = require_dist5();
    var xrpc_1 = require_dist10();
    var index_1 = require_client2();
    var lexicons_1 = require_lexicons2();
    var const_1 = require_const();
    var moderation_1 = require_moderation();
    var labels_1 = require_labels();
    var predicate = __importStar2(require_predicate());
    var util_1 = require_util6();
    var FEED_VIEW_PREF_DEFAULTS = {
      hideReplies: false,
      hideRepliesByUnfollowed: true,
      hideRepliesByLikeCount: 0,
      hideReposts: false,
      hideQuotePosts: false
    };
    var THREAD_VIEW_PREF_DEFAULTS = {
      sort: "hotness",
      prioritizeFollowedUsers: true
    };
    var Agent2 = class _Agent extends xrpc_1.XrpcClient {
      /**
       * Configures the Agent (or its sub classes) globally.
       */
      static configure(opts) {
        if (opts.appLabelers) {
          this.appLabelers = opts.appLabelers.map(util_1.asDid);
        }
      }
      /** @deprecated use `this` instead */
      get xrpc() {
        return this;
      }
      constructor(options) {
        const sessionManager = typeof options === "object" && "fetchHandler" in options ? options : {
          did: void 0,
          fetchHandler: (0, xrpc_1.buildFetchHandler)(options)
        };
        super((url, init) => {
          const headers = new Headers(init?.headers);
          if (this.proxy && !headers.has("atproto-proxy")) {
            headers.set("atproto-proxy", this.proxy);
          }
          headers.set("atproto-accept-labelers", [
            ...this.appLabelers.map((l) => `${l};redact`),
            ...this.labelers,
            headers.get("atproto-accept-labelers")?.trim()
          ].filter(Boolean).join(", "));
          return this.sessionManager.fetchHandler(url, { ...init, headers });
        }, lexicons_1.schemas);
        Object.defineProperty(this, "com", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: new index_1.ComNS(this)
        });
        Object.defineProperty(this, "app", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: new index_1.AppNS(this)
        });
        Object.defineProperty(this, "chat", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: new index_1.ChatNS(this)
        });
        Object.defineProperty(this, "tools", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: new index_1.ToolsNS(this)
        });
        Object.defineProperty(this, "sessionManager", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "labelers", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: []
        });
        Object.defineProperty(this, "proxy", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "uploadBlob", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (data, opts) => this.com.atproto.repo.uploadBlob(data, opts)
        });
        Object.defineProperty(this, "resolveHandle", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.com.atproto.identity.resolveHandle(params, opts)
        });
        Object.defineProperty(this, "updateHandle", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (data, opts) => this.com.atproto.identity.updateHandle(data, opts)
        });
        Object.defineProperty(this, "createModerationReport", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (data, opts) => this.com.atproto.moderation.createReport(data, opts)
        });
        Object.defineProperty(this, "getTimeline", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.feed.getTimeline(params, opts)
        });
        Object.defineProperty(this, "getAuthorFeed", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.feed.getAuthorFeed(params, opts)
        });
        Object.defineProperty(this, "getActorLikes", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.feed.getActorLikes(params, opts)
        });
        Object.defineProperty(this, "getPostThread", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.feed.getPostThread(params, opts)
        });
        Object.defineProperty(this, "getPost", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params) => this.app.bsky.feed.post.get(params)
        });
        Object.defineProperty(this, "getPosts", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.feed.getPosts(params, opts)
        });
        Object.defineProperty(this, "getLikes", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.feed.getLikes(params, opts)
        });
        Object.defineProperty(this, "getRepostedBy", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.feed.getRepostedBy(params, opts)
        });
        Object.defineProperty(this, "getFollows", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.graph.getFollows(params, opts)
        });
        Object.defineProperty(this, "getFollowers", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.graph.getFollowers(params, opts)
        });
        Object.defineProperty(this, "getProfile", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.actor.getProfile(params, opts)
        });
        Object.defineProperty(this, "getProfiles", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.actor.getProfiles(params, opts)
        });
        Object.defineProperty(this, "getSuggestions", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.actor.getSuggestions(params, opts)
        });
        Object.defineProperty(this, "searchActors", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.actor.searchActors(params, opts)
        });
        Object.defineProperty(this, "searchActorsTypeahead", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.actor.searchActorsTypeahead(params, opts)
        });
        Object.defineProperty(this, "listNotifications", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.notification.listNotifications(params, opts)
        });
        Object.defineProperty(this, "countUnreadNotifications", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.notification.getUnreadCount(params, opts)
        });
        Object.defineProperty(this, "getLabelers", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: (params, opts) => this.app.bsky.labeler.getServices(params, opts)
        });
        _Agent_prefsLock.set(
          this,
          new await_lock_1.default()
          /**
           * This function updates the preferences of a user and allows for a callback function to be executed
           * before the update.
           * @param cb - cb is a callback function that takes in a single parameter of type
           * AppBskyActorDefs.Preferences and returns either a boolean or void. This callback function is used to
           * update the preferences of the user. The function is called with the current preferences as an
           * argument and if the callback returns false, the preferences are not updated.
           */
        );
        this.sessionManager = sessionManager;
      }
      //#region Cloning utilities
      clone() {
        return this.copyInto(new _Agent(this.sessionManager));
      }
      copyInto(inst) {
        inst.configureLabelers(this.labelers);
        inst.configureProxy(this.proxy ?? null);
        inst.clearHeaders();
        for (const [key, value] of this.headers)
          inst.setHeader(key, value);
        return inst;
      }
      withProxy(serviceType, did) {
        const inst = this.clone();
        inst.configureProxy(`${(0, util_1.asDid)(did)}#${serviceType}`);
        return inst;
      }
      //#endregion
      //#region ATPROTO labelers configuration utilities
      /**
       * The labelers statically configured on the class of the current instance.
       */
      get appLabelers() {
        return this.constructor.appLabelers;
      }
      configureLabelers(labelerDids) {
        this.labelers = labelerDids.map(util_1.asDid);
      }
      /** @deprecated use {@link configureLabelers} instead */
      configureLabelersHeader(labelerDids) {
        this.configureLabelers(labelerDids.filter(util_1.isDid));
      }
      configureProxy(value) {
        if (value === null)
          this.proxy = void 0;
        else if ((0, util_1.isDid)(value))
          this.proxy = value;
        else
          throw new TypeError("Invalid proxy DID");
      }
      /** @deprecated use {@link configureProxy} instead */
      configureProxyHeader(serviceType, did) {
        if ((0, util_1.isDid)(did))
          this.configureProxy(`${did}#${serviceType}`);
      }
      //#endregion
      //#region Session management
      /**
       * Get the authenticated user's DID, if any.
       */
      get did() {
        return this.sessionManager.did;
      }
      /** @deprecated Use {@link Agent.assertDid} instead */
      get accountDid() {
        return this.assertDid;
      }
      /**
       * Get the authenticated user's DID, or throw an error if not authenticated.
       */
      get assertDid() {
        this.assertAuthenticated();
        return this.did;
      }
      /**
       * Assert that the user is authenticated.
       */
      assertAuthenticated() {
        if (!this.did)
          throw new Error("Not logged in");
      }
      //#endregion
      /** @deprecated use "this" instead */
      get api() {
        return this;
      }
      async getLabelDefinitions(prefs) {
        const dids = [...this.appLabelers];
        if (isBskyPrefs(prefs)) {
          dids.push(...prefs.moderationPrefs.labelers.map((l) => l.did));
        } else if (isModPrefs(prefs)) {
          dids.push(...prefs.labelers.map((l) => l.did));
        } else {
          dids.push(...prefs);
        }
        const labelers = await this.getLabelers({
          dids,
          detailed: true
        });
        const labelDefs = {};
        if (labelers.data) {
          for (const labeler of labelers.data.views) {
            labelDefs[labeler.creator.did] = (0, moderation_1.interpretLabelValueDefinitions)(labeler);
          }
        }
        return labelDefs;
      }
      async post(record) {
        record.createdAt || (record.createdAt = (/* @__PURE__ */ new Date()).toISOString());
        return this.app.bsky.feed.post.create({ repo: this.accountDid }, record);
      }
      async deletePost(postUri) {
        this.assertAuthenticated();
        const postUrip = new syntax_1.AtUri(postUri);
        return this.app.bsky.feed.post.delete({
          repo: postUrip.hostname,
          rkey: postUrip.rkey
        });
      }
      async like(uri, cid, via) {
        return this.app.bsky.feed.like.create({ repo: this.accountDid }, {
          subject: { uri, cid },
          createdAt: (/* @__PURE__ */ new Date()).toISOString(),
          via
        });
      }
      async deleteLike(likeUri) {
        this.assertAuthenticated();
        const likeUrip = new syntax_1.AtUri(likeUri);
        return this.app.bsky.feed.like.delete({
          repo: likeUrip.hostname,
          rkey: likeUrip.rkey
        });
      }
      async repost(uri, cid, via) {
        return this.app.bsky.feed.repost.create({ repo: this.accountDid }, {
          subject: { uri, cid },
          createdAt: (/* @__PURE__ */ new Date()).toISOString(),
          via
        });
      }
      async deleteRepost(repostUri) {
        this.assertAuthenticated();
        const repostUrip = new syntax_1.AtUri(repostUri);
        return this.app.bsky.feed.repost.delete({
          repo: repostUrip.hostname,
          rkey: repostUrip.rkey
        });
      }
      async follow(subjectDid) {
        return this.app.bsky.graph.follow.create({ repo: this.accountDid }, {
          subject: subjectDid,
          createdAt: (/* @__PURE__ */ new Date()).toISOString()
        });
      }
      async deleteFollow(followUri) {
        this.assertAuthenticated();
        const followUrip = new syntax_1.AtUri(followUri);
        return this.app.bsky.graph.follow.delete({
          repo: followUrip.hostname,
          rkey: followUrip.rkey
        });
      }
      /**
       * @note: Using this method will reset the whole profile record if it
       * previously contained invalid values (wrt to the profile lexicon).
       */
      async upsertProfile(updateFn) {
        const upsert = async () => {
          const repo = this.assertDid;
          const collection = "app.bsky.actor.profile";
          const existing = await this.com.atproto.repo.getRecord({ repo, collection, rkey: "self" }).catch((_) => void 0);
          const existingRecord = existing && predicate.isValidProfile(existing.data.value) ? existing.data.value : void 0;
          const updated = await updateFn(existingRecord);
          const validation = index_1.AppBskyActorProfile.validateRecord({
            $type: collection,
            ...updated
          });
          if (!validation.success) {
            throw validation.error;
          }
          await this.com.atproto.repo.putRecord({
            repo,
            collection,
            rkey: "self",
            record: validation.value,
            swapRecord: existing?.data.cid || null
          });
        };
        return (0, common_web_1.retry)(upsert, {
          maxRetries: 5,
          retryable: (e) => e instanceof index_1.ComAtprotoRepoPutRecord.InvalidSwapError
        });
      }
      async mute(actor) {
        return this.app.bsky.graph.muteActor({ actor });
      }
      async unmute(actor) {
        return this.app.bsky.graph.unmuteActor({ actor });
      }
      async muteModList(uri) {
        return this.app.bsky.graph.muteActorList({ list: uri });
      }
      async unmuteModList(uri) {
        return this.app.bsky.graph.unmuteActorList({ list: uri });
      }
      async blockModList(uri) {
        return this.app.bsky.graph.listblock.create({ repo: this.accountDid }, {
          subject: uri,
          createdAt: (/* @__PURE__ */ new Date()).toISOString()
        });
      }
      async unblockModList(uri) {
        const repo = this.accountDid;
        const listInfo = await this.app.bsky.graph.getList({
          list: uri,
          limit: 1
        });
        const blocked = listInfo.data.list.viewer?.blocked;
        if (blocked) {
          const { rkey } = new syntax_1.AtUri(blocked);
          return this.app.bsky.graph.listblock.delete({
            repo,
            rkey
          });
        }
      }
      async updateSeenNotifications(seenAt = (/* @__PURE__ */ new Date()).toISOString()) {
        return this.app.bsky.notification.updateSeen({ seenAt });
      }
      async getPreferences() {
        const prefs = {
          feeds: {
            saved: void 0,
            pinned: void 0
          },
          // @ts-ignore populating below
          savedFeeds: void 0,
          feedViewPrefs: {
            home: {
              ...FEED_VIEW_PREF_DEFAULTS
            }
          },
          threadViewPrefs: { ...THREAD_VIEW_PREF_DEFAULTS },
          moderationPrefs: {
            adultContentEnabled: false,
            labels: { ...labels_1.DEFAULT_LABEL_SETTINGS },
            labelers: this.appLabelers.map((did) => ({
              did,
              labels: {}
            })),
            mutedWords: [],
            hiddenPosts: []
          },
          birthDate: void 0,
          interests: {
            tags: []
          },
          bskyAppState: {
            queuedNudges: [],
            activeProgressGuide: void 0,
            nuxs: []
          },
          postInteractionSettings: {
            threadgateAllowRules: void 0,
            postgateEmbeddingRules: void 0
          },
          verificationPrefs: {
            hideBadges: false
          }
        };
        const res = await this.app.bsky.actor.getPreferences({});
        const labelPrefs = [];
        for (const pref of res.data.preferences) {
          if (predicate.isValidAdultContentPref(pref)) {
            prefs.moderationPrefs.adultContentEnabled = pref.enabled;
          } else if (predicate.isValidContentLabelPref(pref)) {
            const adjustedPref = adjustLegacyContentLabelPref(pref);
            labelPrefs.push(adjustedPref);
          } else if (predicate.isValidLabelersPref(pref)) {
            prefs.moderationPrefs.labelers = this.appLabelers.map((did) => ({ did, labels: {} })).concat(pref.labelers.map((labeler) => ({
              ...labeler,
              labels: {}
            })));
          } else if (predicate.isValidSavedFeedsPrefV2(pref)) {
            prefs.savedFeeds = pref.items;
          } else if (predicate.isValidSavedFeedsPref(pref)) {
            prefs.feeds.saved = pref.saved;
            prefs.feeds.pinned = pref.pinned;
          } else if (predicate.isValidPersonalDetailsPref(pref)) {
            if (pref.birthDate) {
              prefs.birthDate = new Date(pref.birthDate);
            }
          } else if (predicate.isValidFeedViewPref(pref)) {
            const { $type: _, feed, ...v } = pref;
            prefs.feedViewPrefs[feed] = { ...FEED_VIEW_PREF_DEFAULTS, ...v };
          } else if (predicate.isValidThreadViewPref(pref)) {
            const { $type: _, ...v } = pref;
            prefs.threadViewPrefs = { ...prefs.threadViewPrefs, ...v };
          } else if (predicate.isValidInterestsPref(pref)) {
            const { $type: _, ...v } = pref;
            prefs.interests = { ...prefs.interests, ...v };
          } else if (predicate.isValidMutedWordsPref(pref)) {
            prefs.moderationPrefs.mutedWords = pref.items;
            if (prefs.moderationPrefs.mutedWords.length) {
              prefs.moderationPrefs.mutedWords = prefs.moderationPrefs.mutedWords.map((word) => {
                word.actorTarget = word.actorTarget || "all";
                return word;
              });
            }
          } else if (predicate.isValidHiddenPostsPref(pref)) {
            prefs.moderationPrefs.hiddenPosts = pref.items;
          } else if (predicate.isValidBskyAppStatePref(pref)) {
            prefs.bskyAppState.queuedNudges = pref.queuedNudges || [];
            prefs.bskyAppState.activeProgressGuide = pref.activeProgressGuide;
            prefs.bskyAppState.nuxs = pref.nuxs || [];
          } else if (predicate.isValidPostInteractionSettingsPref(pref)) {
            prefs.postInteractionSettings.threadgateAllowRules = pref.threadgateAllowRules;
            prefs.postInteractionSettings.postgateEmbeddingRules = pref.postgateEmbeddingRules;
          } else if (predicate.isValidVerificationPrefs(pref)) {
            prefs.verificationPrefs = {
              hideBadges: pref.hideBadges
            };
          }
        }
        if (prefs.savedFeeds == null) {
          const { saved, pinned } = prefs.feeds;
          if (saved && pinned) {
            const uniqueMigratedSavedFeeds = /* @__PURE__ */ new Map();
            uniqueMigratedSavedFeeds.set("timeline", {
              id: common_web_1.TID.nextStr(),
              type: "timeline",
              value: "following",
              pinned: true
            });
            for (const uri of pinned) {
              const type = (0, util_1.getSavedFeedType)(uri);
              if (type === "unknown")
                continue;
              uniqueMigratedSavedFeeds.set(uri, {
                id: common_web_1.TID.nextStr(),
                type,
                value: uri,
                pinned: true
              });
            }
            for (const uri of saved) {
              if (!uniqueMigratedSavedFeeds.has(uri)) {
                const type = (0, util_1.getSavedFeedType)(uri);
                if (type === "unknown")
                  continue;
                uniqueMigratedSavedFeeds.set(uri, {
                  id: common_web_1.TID.nextStr(),
                  type,
                  value: uri,
                  pinned: false
                });
              }
            }
            prefs.savedFeeds = Array.from(uniqueMigratedSavedFeeds.values());
          } else {
            prefs.savedFeeds = [
              {
                id: common_web_1.TID.nextStr(),
                type: "timeline",
                value: "following",
                pinned: true
              }
            ];
          }
          await this.overwriteSavedFeeds(prefs.savedFeeds);
        }
        for (const pref of labelPrefs) {
          if (pref.labelerDid) {
            const labeler = prefs.moderationPrefs.labelers.find((labeler2) => labeler2.did === pref.labelerDid);
            if (!labeler)
              continue;
            labeler.labels[pref.label] = pref.visibility;
          } else {
            prefs.moderationPrefs.labels[pref.label] = pref.visibility;
          }
        }
        prefs.moderationPrefs.labels = remapLegacyLabels(prefs.moderationPrefs.labels);
        this.configureLabelers(prefsArrayToLabelerDids(res.data.preferences));
        return prefs;
      }
      async overwriteSavedFeeds(savedFeeds) {
        savedFeeds.forEach(util_1.validateSavedFeed);
        const uniqueSavedFeeds = /* @__PURE__ */ new Map();
        savedFeeds.forEach((feed) => {
          if (uniqueSavedFeeds.has(feed.id)) {
            uniqueSavedFeeds.delete(feed.id);
          }
          uniqueSavedFeeds.set(feed.id, feed);
        });
        return this.updateSavedFeedsV2Preferences(() => Array.from(uniqueSavedFeeds.values()));
      }
      async updateSavedFeeds(savedFeedsToUpdate) {
        savedFeedsToUpdate.map(util_1.validateSavedFeed);
        return this.updateSavedFeedsV2Preferences((savedFeeds) => {
          return savedFeeds.map((savedFeed) => {
            const updatedVersion = savedFeedsToUpdate.find((updated) => savedFeed.id === updated.id);
            if (updatedVersion) {
              return {
                ...savedFeed,
                // only update pinned
                pinned: updatedVersion.pinned
              };
            }
            return savedFeed;
          });
        });
      }
      async addSavedFeeds(savedFeeds) {
        const toSave = savedFeeds.map((f) => ({
          ...f,
          id: common_web_1.TID.nextStr()
        }));
        toSave.forEach(util_1.validateSavedFeed);
        return this.updateSavedFeedsV2Preferences((savedFeeds2) => [
          ...savedFeeds2,
          ...toSave
        ]);
      }
      async removeSavedFeeds(ids) {
        return this.updateSavedFeedsV2Preferences((savedFeeds) => [
          ...savedFeeds.filter((feed) => !ids.find((id) => feed.id === id))
        ]);
      }
      /**
       * @deprecated use `overwriteSavedFeeds`
       */
      async setSavedFeeds(saved, pinned) {
        return this.updateFeedPreferences(() => ({
          saved,
          pinned
        }));
      }
      /**
       * @deprecated use `addSavedFeeds`
       */
      async addSavedFeed(v) {
        return this.updateFeedPreferences((saved, pinned) => ({
          saved: [...saved.filter((uri) => uri !== v), v],
          pinned
        }));
      }
      /**
       * @deprecated use `removeSavedFeeds`
       */
      async removeSavedFeed(v) {
        return this.updateFeedPreferences((saved, pinned) => ({
          saved: saved.filter((uri) => uri !== v),
          pinned: pinned.filter((uri) => uri !== v)
        }));
      }
      /**
       * @deprecated use `addSavedFeeds` or `updateSavedFeeds`
       */
      async addPinnedFeed(v) {
        return this.updateFeedPreferences((saved, pinned) => ({
          saved: [...saved.filter((uri) => uri !== v), v],
          pinned: [...pinned.filter((uri) => uri !== v), v]
        }));
      }
      /**
       * @deprecated use `updateSavedFeeds` or `removeSavedFeeds`
       */
      async removePinnedFeed(v) {
        return this.updateFeedPreferences((saved, pinned) => ({
          saved,
          pinned: pinned.filter((uri) => uri !== v)
        }));
      }
      async setAdultContentEnabled(v) {
        await this.updatePreferences((prefs) => {
          const adultContentPref = prefs.findLast(predicate.isValidAdultContentPref) || {
            $type: "app.bsky.actor.defs#adultContentPref",
            enabled: v
          };
          adultContentPref.enabled = v;
          return prefs.filter((pref) => !index_1.AppBskyActorDefs.isAdultContentPref(pref)).concat(adultContentPref);
        });
      }
      async setContentLabelPref(key, value, labelerDid) {
        if (labelerDid) {
          (0, syntax_1.ensureValidDid)(labelerDid);
        }
        await this.updatePreferences((prefs) => {
          const labelPref = prefs.filter(predicate.isValidContentLabelPref).findLast((pref) => pref.label === key && pref.labelerDid === labelerDid) || {
            $type: "app.bsky.actor.defs#contentLabelPref",
            label: key,
            labelerDid,
            visibility: value
          };
          labelPref.visibility = value;
          let legacyLabelPref;
          if (index_1.AppBskyActorDefs.isContentLabelPref(labelPref)) {
            if (!labelPref.labelerDid) {
              const legacyLabelValue = {
                "graphic-media": "gore",
                porn: "nsfw",
                sexual: "suggestive",
                // Protect against using toString, hasOwnProperty, etc. as a label:
                __proto__: null
              }[labelPref.label];
              if (legacyLabelValue) {
                legacyLabelPref = prefs.filter(predicate.isValidContentLabelPref).findLast((pref) => pref.label === legacyLabelValue && pref.labelerDid === void 0) || {
                  $type: "app.bsky.actor.defs#contentLabelPref",
                  label: legacyLabelValue,
                  labelerDid: void 0,
                  visibility: value
                };
                legacyLabelPref.visibility = value;
              }
            }
          }
          return prefs.filter((pref) => !index_1.AppBskyActorDefs.isContentLabelPref(pref) || !(pref.label === key && pref.labelerDid === labelerDid)).concat(labelPref).filter((pref) => {
            if (!legacyLabelPref)
              return true;
            return !index_1.AppBskyActorDefs.isContentLabelPref(pref) || !(pref.label === legacyLabelPref.label && pref.labelerDid === void 0);
          }).concat(legacyLabelPref ? [legacyLabelPref] : []);
        });
      }
      async addLabeler(did) {
        const prefs = await this.updatePreferences((prefs2) => {
          const labelersPref = prefs2.findLast(predicate.isValidLabelersPref) || {
            $type: "app.bsky.actor.defs#labelersPref",
            labelers: []
          };
          if (!labelersPref.labelers.some((labeler) => labeler.did === did)) {
            labelersPref.labelers.push({ did });
          }
          return prefs2.filter((pref) => !index_1.AppBskyActorDefs.isLabelersPref(pref)).concat(labelersPref);
        });
        this.configureLabelers(prefsArrayToLabelerDids(prefs));
      }
      async removeLabeler(did) {
        const prefs = await this.updatePreferences((prefs2) => {
          const labelersPref = prefs2.findLast(predicate.isValidLabelersPref) || {
            $type: "app.bsky.actor.defs#labelersPref",
            labelers: []
          };
          labelersPref.labelers = labelersPref.labelers.filter((l) => l.did !== did);
          return prefs2.filter((pref) => !index_1.AppBskyActorDefs.isLabelersPref(pref)).concat(labelersPref);
        });
        this.configureLabelers(prefsArrayToLabelerDids(prefs));
      }
      async setPersonalDetails({ birthDate }) {
        await this.updatePreferences((prefs) => {
          const personalDetailsPref = prefs.findLast(predicate.isValidPersonalDetailsPref) || {
            $type: "app.bsky.actor.defs#personalDetailsPref"
          };
          personalDetailsPref.birthDate = birthDate instanceof Date ? birthDate.toISOString() : birthDate;
          return prefs.filter((pref) => !index_1.AppBskyActorDefs.isPersonalDetailsPref(pref)).concat(personalDetailsPref);
        });
      }
      async setFeedViewPrefs(feed, pref) {
        await this.updatePreferences((prefs) => {
          const existing = prefs.filter(predicate.isValidFeedViewPref).findLast((pref2) => pref2.feed === feed);
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isFeedViewPref(p) || p.feed !== feed).concat({
            ...existing,
            ...pref,
            $type: "app.bsky.actor.defs#feedViewPref",
            feed
          });
        });
      }
      async setThreadViewPrefs(pref) {
        await this.updatePreferences((prefs) => {
          const existing = prefs.findLast(predicate.isValidThreadViewPref);
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isThreadViewPref(p)).concat({
            ...existing,
            ...pref,
            $type: "app.bsky.actor.defs#threadViewPref"
          });
        });
      }
      async setInterestsPref(pref) {
        await this.updatePreferences((prefs) => {
          const existing = prefs.findLast(predicate.isValidInterestsPref);
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isInterestsPref(p)).concat({
            ...existing,
            ...pref,
            $type: "app.bsky.actor.defs#interestsPref"
          });
        });
      }
      /**
       * Add a muted word to user preferences.
       */
      async addMutedWord(mutedWord) {
        const sanitizedValue = (0, util_1.sanitizeMutedWordValue)(mutedWord.value);
        if (!sanitizedValue)
          return;
        await this.updatePreferences((prefs) => {
          let mutedWordsPref = prefs.findLast(predicate.isValidMutedWordsPref);
          const newMutedWord = {
            id: common_web_1.TID.nextStr(),
            value: sanitizedValue,
            targets: mutedWord.targets || [],
            actorTarget: mutedWord.actorTarget || "all",
            expiresAt: mutedWord.expiresAt || void 0
          };
          if (mutedWordsPref) {
            mutedWordsPref.items.push(newMutedWord);
            mutedWordsPref.items = migrateLegacyMutedWordsItems(mutedWordsPref.items);
          } else {
            mutedWordsPref = {
              $type: "app.bsky.actor.defs#mutedWordsPref",
              items: [newMutedWord]
            };
          }
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isMutedWordsPref(p)).concat(mutedWordsPref);
        });
      }
      /**
       * Convenience method to add muted words to user preferences
       */
      async addMutedWords(newMutedWords) {
        await Promise.all(newMutedWords.map((word) => this.addMutedWord(word)));
      }
      /**
       * @deprecated use `addMutedWords` or `addMutedWord` instead
       */
      async upsertMutedWords(mutedWords) {
        await this.addMutedWords(mutedWords);
      }
      /**
       * Update a muted word in user preferences.
       */
      async updateMutedWord(mutedWord) {
        await this.updatePreferences((prefs) => {
          const mutedWordsPref = prefs.findLast(predicate.isValidMutedWordsPref);
          if (mutedWordsPref) {
            mutedWordsPref.items = mutedWordsPref.items.map((existingItem) => {
              const match = matchMutedWord(existingItem, mutedWord);
              if (match) {
                const updated = {
                  ...existingItem,
                  ...mutedWord
                };
                return {
                  id: existingItem.id || common_web_1.TID.nextStr(),
                  value: (0, util_1.sanitizeMutedWordValue)(updated.value) || existingItem.value,
                  targets: updated.targets || [],
                  actorTarget: updated.actorTarget || "all",
                  expiresAt: updated.expiresAt || void 0
                };
              } else {
                return existingItem;
              }
            });
            mutedWordsPref.items = migrateLegacyMutedWordsItems(mutedWordsPref.items);
            return prefs.filter((p) => !index_1.AppBskyActorDefs.isMutedWordsPref(p)).concat(mutedWordsPref);
          }
          return prefs;
        });
      }
      /**
       * Remove a muted word from user preferences.
       */
      async removeMutedWord(mutedWord) {
        await this.updatePreferences((prefs) => {
          const mutedWordsPref = prefs.findLast(predicate.isValidMutedWordsPref);
          if (mutedWordsPref) {
            for (let i = 0; i < mutedWordsPref.items.length; i++) {
              const match = matchMutedWord(mutedWordsPref.items[i], mutedWord);
              if (match) {
                mutedWordsPref.items.splice(i, 1);
                break;
              }
            }
            mutedWordsPref.items = migrateLegacyMutedWordsItems(mutedWordsPref.items);
            return prefs.filter((p) => !index_1.AppBskyActorDefs.isMutedWordsPref(p)).concat(mutedWordsPref);
          }
          return prefs;
        });
      }
      /**
       * Convenience method to remove muted words from user preferences
       */
      async removeMutedWords(mutedWords) {
        await Promise.all(mutedWords.map((word) => this.removeMutedWord(word)));
      }
      async hidePost(postUri) {
        await this.updateHiddenPost(postUri, "hide");
      }
      async unhidePost(postUri) {
        await this.updateHiddenPost(postUri, "unhide");
      }
      async bskyAppQueueNudges(nudges) {
        await this.updatePreferences((prefs) => {
          const pref = prefs.findLast(predicate.isValidBskyAppStatePref) || {
            $type: "app.bsky.actor.defs#bskyAppStatePref"
          };
          pref.queuedNudges = (pref.queuedNudges || []).concat(nudges);
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isBskyAppStatePref(p)).concat(pref);
        });
      }
      async bskyAppDismissNudges(nudges) {
        await this.updatePreferences((prefs) => {
          const pref = prefs.findLast(predicate.isValidBskyAppStatePref) || {
            $type: "app.bsky.actor.defs#bskyAppStatePref"
          };
          nudges = Array.isArray(nudges) ? nudges : [nudges];
          pref.queuedNudges = (pref.queuedNudges || []).filter((nudge) => !nudges.includes(nudge));
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isBskyAppStatePref(p)).concat(pref);
        });
      }
      async bskyAppSetActiveProgressGuide(guide) {
        if (guide) {
          const result = index_1.AppBskyActorDefs.validateBskyAppProgressGuide(guide);
          if (!result.success)
            throw result.error;
        }
        await this.updatePreferences((prefs) => {
          const pref = prefs.findLast(predicate.isValidBskyAppStatePref) || {
            $type: "app.bsky.actor.defs#bskyAppStatePref"
          };
          pref.activeProgressGuide = guide;
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isBskyAppStatePref(p)).concat(pref);
        });
      }
      /**
       * Insert or update a NUX in user prefs
       */
      async bskyAppUpsertNux(nux) {
        (0, util_1.validateNux)(nux);
        await this.updatePreferences((prefs) => {
          const pref = prefs.findLast(predicate.isValidBskyAppStatePref) || {
            $type: "app.bsky.actor.defs#bskyAppStatePref"
          };
          pref.nuxs = pref.nuxs || [];
          const existing = pref.nuxs?.find((n) => {
            return n.id === nux.id;
          });
          let next;
          if (existing) {
            next = {
              id: existing.id,
              completed: nux.completed,
              data: nux.data,
              expiresAt: nux.expiresAt
            };
          } else {
            next = nux;
          }
          pref.nuxs = pref.nuxs.filter((n) => n.id !== nux.id).concat(next);
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isBskyAppStatePref(p)).concat(pref);
        });
      }
      /**
       * Removes NUXs from user preferences.
       */
      async bskyAppRemoveNuxs(ids) {
        await this.updatePreferences((prefs) => {
          const pref = prefs.findLast(predicate.isValidBskyAppStatePref) || {
            $type: "app.bsky.actor.defs#bskyAppStatePref"
          };
          pref.nuxs = (pref.nuxs || []).filter((nux) => !ids.includes(nux.id));
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isBskyAppStatePref(p)).concat(pref);
        });
      }
      async setPostInteractionSettings(settings) {
        const result = index_1.AppBskyActorDefs.validatePostInteractionSettingsPref(settings);
        if (!result.success)
          throw result.error;
        await this.updatePreferences((prefs) => {
          const pref = prefs.findLast(predicate.isValidPostInteractionSettingsPref) || {
            $type: "app.bsky.actor.defs#postInteractionSettingsPref"
          };
          pref.threadgateAllowRules = settings.threadgateAllowRules;
          pref.postgateEmbeddingRules = settings.postgateEmbeddingRules;
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isPostInteractionSettingsPref(p)).concat(pref);
        });
      }
      async setVerificationPrefs(settings) {
        const result = index_1.AppBskyActorDefs.validateVerificationPrefs(settings);
        if (!result.success)
          throw result.error;
        await this.updatePreferences((prefs) => {
          const pref = prefs.findLast(predicate.isValidVerificationPrefs) || {
            $type: "app.bsky.actor.defs#verificationPrefs",
            hideBadges: false
          };
          pref.hideBadges = settings.hideBadges;
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isVerificationPrefs(p)).concat(pref);
        });
      }
      /**
       * This function updates the preferences of a user and allows for a callback function to be executed
       * before the update.
       * @param cb - cb is a callback function that takes in a single parameter of type
       * AppBskyActorDefs.Preferences and returns either a boolean or void. This callback function is used to
       * update the preferences of the user. The function is called with the current preferences as an
       * argument and if the callback returns false, the preferences are not updated.
       */
      async updatePreferences(cb) {
        try {
          await __classPrivateFieldGet2(this, _Agent_prefsLock, "f").acquireAsync();
          const res = await this.app.bsky.actor.getPreferences({});
          const newPrefs = cb(res.data.preferences);
          if (newPrefs === false) {
            return res.data.preferences;
          }
          await this.app.bsky.actor.putPreferences({
            preferences: newPrefs
          });
          return newPrefs;
        } finally {
          __classPrivateFieldGet2(this, _Agent_prefsLock, "f").release();
        }
      }
      async updateHiddenPost(postUri, action) {
        await this.updatePreferences((prefs) => {
          const pref = prefs.findLast(predicate.isValidHiddenPostsPref) || {
            $type: "app.bsky.actor.defs#hiddenPostsPref",
            items: []
          };
          const hiddenItems = new Set(pref.items);
          if (action === "hide")
            hiddenItems.add(postUri);
          else
            hiddenItems.delete(postUri);
          pref.items = [...hiddenItems];
          return prefs.filter((p) => !index_1.AppBskyActorDefs.isHiddenPostsPref(p)).concat(pref);
        });
      }
      /**
       * A helper specifically for updating feed preferences
       */
      async updateFeedPreferences(cb) {
        let res;
        await this.updatePreferences((prefs) => {
          const feedsPref = prefs.findLast(predicate.isValidSavedFeedsPref) || {
            $type: "app.bsky.actor.defs#savedFeedsPref",
            saved: [],
            pinned: []
          };
          res = cb(feedsPref.saved, feedsPref.pinned);
          feedsPref.saved = res.saved;
          feedsPref.pinned = res.pinned;
          return prefs.filter((pref) => !index_1.AppBskyActorDefs.isSavedFeedsPref(pref)).concat(feedsPref);
        });
        return res;
      }
      async updateSavedFeedsV2Preferences(cb) {
        let maybeMutatedSavedFeeds = [];
        await this.updatePreferences((prefs) => {
          const existingV2Pref = prefs.findLast(predicate.isValidSavedFeedsPrefV2) || {
            $type: "app.bsky.actor.defs#savedFeedsPrefV2",
            items: []
          };
          const newSavedFeeds = cb(existingV2Pref.items);
          existingV2Pref.items = [...newSavedFeeds].sort((a, b) => (
            // @NOTE: preserve order of items with the same pinned status
            a.pinned === b.pinned ? 0 : a.pinned ? -1 : 1
          ));
          maybeMutatedSavedFeeds = newSavedFeeds;
          let updatedPrefs = prefs.filter((pref) => !index_1.AppBskyActorDefs.isSavedFeedsPrefV2(pref)).concat(existingV2Pref);
          let existingV1Pref = prefs.findLast(predicate.isValidSavedFeedsPref);
          if (existingV1Pref) {
            const { saved, pinned } = existingV1Pref;
            const v2Compat = (0, util_1.savedFeedsToUriArrays)(
              // v1 only supports feeds and lists
              existingV2Pref.items.filter((i) => ["feed", "list"].includes(i.type))
            );
            existingV1Pref = {
              ...existingV1Pref,
              saved: Array.from(/* @__PURE__ */ new Set([...saved, ...v2Compat.saved])),
              pinned: Array.from(/* @__PURE__ */ new Set([...pinned, ...v2Compat.pinned]))
            };
            updatedPrefs = updatedPrefs.filter((pref) => !index_1.AppBskyActorDefs.isSavedFeedsPref(pref)).concat(existingV1Pref);
          }
          return updatedPrefs;
        });
        return maybeMutatedSavedFeeds;
      }
    };
    exports.Agent = Agent2;
    _Agent_prefsLock = /* @__PURE__ */ new WeakMap();
    Object.defineProperty(Agent2, "appLabelers", {
      enumerable: true,
      configurable: true,
      writable: true,
      value: [const_1.BSKY_LABELER_DID]
    });
    function adjustLegacyContentLabelPref(pref) {
      let visibility = pref.visibility;
      if (visibility === "show") {
        visibility = "ignore";
      }
      return { ...pref, visibility };
    }
    function remapLegacyLabels(labels) {
      const _labels = { ...labels };
      const legacyToNewMap = {
        gore: "graphic-media",
        nsfw: "porn",
        suggestive: "sexual"
      };
      for (const labelName in _labels) {
        const newLabelName = legacyToNewMap[labelName];
        if (newLabelName) {
          _labels[newLabelName] = _labels[labelName];
        }
      }
      return _labels;
    }
    function prefsArrayToLabelerDids(prefs) {
      const labelersPref = prefs.findLast(predicate.isValidLabelersPref);
      let dids = [];
      if (labelersPref) {
        dids = labelersPref.labelers.map((labeler) => labeler.did);
      }
      return dids;
    }
    function isBskyPrefs(v) {
      return v && typeof v === "object" && "moderationPrefs" in v && isModPrefs(v.moderationPrefs);
    }
    function isModPrefs(v) {
      return v && typeof v === "object" && "labelers" in v;
    }
    function migrateLegacyMutedWordsItems(items) {
      return items.map((item) => ({
        ...item,
        id: item.id || common_web_1.TID.nextStr()
      }));
    }
    function matchMutedWord(existingWord, newWord) {
      const existingId = existingWord.id;
      const matchById = existingId && existingId === newWord.id;
      const legacyMatchByValue = !existingId && existingWord.value === newWord.value;
      return matchById || legacyMatchByValue;
    }
  }
});

// node_modules/@atproto/api/dist/atp-agent.js
var require_atp_agent = __commonJS({
  "node_modules/@atproto/api/dist/atp-agent.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.CredentialSession = exports.AtpAgent = void 0;
    var common_web_1 = require_dist4();
    var xrpc_1 = require_dist10();
    var agent_1 = require_agent();
    var client_1 = require_client2();
    var lexicons_1 = require_lexicons2();
    var ReadableStream = globalThis.ReadableStream;
    var AtpAgent = class _AtpAgent extends agent_1.Agent {
      constructor(options) {
        const sessionManager = options instanceof CredentialSession ? options : new CredentialSession(new URL(options.service), options.fetch, options.persistSession);
        super(sessionManager);
        Object.defineProperty(this, "sessionManager", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.sessionManager = sessionManager;
        if (!(options instanceof CredentialSession) && options.headers) {
          for (const [key, value] of options.headers) {
            this.setHeader(key, value);
          }
        }
      }
      clone() {
        return this.copyInto(new _AtpAgent(this.sessionManager));
      }
      get session() {
        return this.sessionManager.session;
      }
      get hasSession() {
        return this.sessionManager.hasSession;
      }
      get did() {
        return this.sessionManager.did;
      }
      get serviceUrl() {
        return this.sessionManager.serviceUrl;
      }
      get pdsUrl() {
        return this.sessionManager.pdsUrl;
      }
      get dispatchUrl() {
        return this.sessionManager.dispatchUrl;
      }
      /** @deprecated use {@link serviceUrl} instead */
      get service() {
        return this.serviceUrl;
      }
      get persistSession() {
        throw new Error('Cannot set persistSession directly. "persistSession" is defined through the constructor and will be invoked automatically when session data changes.');
      }
      set persistSession(v) {
        throw new Error('Cannot set persistSession directly. "persistSession" must be defined in the constructor and can no longer be changed.');
      }
      /** @deprecated use {@link AtpAgent.serviceUrl} instead */
      getServiceUrl() {
        return this.serviceUrl;
      }
      async resumeSession(session) {
        return this.sessionManager.resumeSession(session);
      }
      async createAccount(data, opts) {
        return this.sessionManager.createAccount(data, opts);
      }
      async login(opts) {
        return this.sessionManager.login(opts);
      }
      async logout() {
        return this.sessionManager.logout();
      }
    };
    exports.AtpAgent = AtpAgent;
    var CredentialSession = class {
      constructor(serviceUrl, fetch2 = globalThis.fetch, persistSession) {
        Object.defineProperty(this, "serviceUrl", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: serviceUrl
        });
        Object.defineProperty(this, "fetch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: fetch2
        });
        Object.defineProperty(this, "persistSession", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: persistSession
        });
        Object.defineProperty(this, "pdsUrl", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "session", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "refreshSessionPromise", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "server", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: new client_1.ComAtprotoServerNS(
            // Note that the use of the codegen "schemas" (to instantiate `this.api`),
            // as well as the use of `ComAtprotoServerNS` will cause this class to
            // reference (way) more code than it actually needs. It is not possible,
            // with the current state of the codegen, to generate a client that only
            // includes the methods that are actually used by this class. This is a
            // known limitation that should be addressed in a future version of the
            // codegen.
            new xrpc_1.XrpcClient((url, init) => {
              return (0, this.fetch)(new URL(url, this.serviceUrl), init);
            }, lexicons_1.schemas)
          )
        });
      }
      get did() {
        return this.session?.did;
      }
      get dispatchUrl() {
        return this.pdsUrl || this.serviceUrl;
      }
      get hasSession() {
        return !!this.session;
      }
      /**
       * Sets a WhatWG "fetch()" function to be used for making HTTP requests.
       */
      setFetch(fetch2 = globalThis.fetch) {
        this.fetch = fetch2;
      }
      async fetchHandler(url, init) {
        await this.refreshSessionPromise;
        const initialUri = new URL(url, this.dispatchUrl);
        const initialReq = new Request(initialUri, init);
        const initialToken = this.session?.accessJwt;
        if (!initialToken || initialReq.headers.has("authorization")) {
          return (0, this.fetch)(initialReq);
        }
        initialReq.headers.set("authorization", `Bearer ${initialToken}`);
        const initialRes = await (0, this.fetch)(initialReq);
        if (!this.session?.refreshJwt) {
          return initialRes;
        }
        const isExpiredToken = await isErrorResponse(initialRes, [400], ["ExpiredToken"]);
        if (!isExpiredToken) {
          return initialRes;
        }
        try {
          await this.refreshSession();
        } catch {
          return initialRes;
        }
        if (init?.signal?.aborted) {
          return initialRes;
        }
        if (ReadableStream && init?.body instanceof ReadableStream) {
          return initialRes;
        }
        const updatedToken = this.session?.accessJwt;
        if (!updatedToken || updatedToken === initialToken) {
          return initialRes;
        }
        await initialRes.body?.cancel();
        const updatedUri = new URL(url, this.dispatchUrl);
        const updatedReq = new Request(updatedUri, init);
        updatedReq.headers.set("authorization", `Bearer ${updatedToken}`);
        return await (0, this.fetch)(updatedReq);
      }
      /**
       * Create a new account and hydrate its session in this agent.
       */
      async createAccount(data, opts) {
        try {
          const res = await this.server.createAccount(data, opts);
          this.session = {
            accessJwt: res.data.accessJwt,
            refreshJwt: res.data.refreshJwt,
            handle: res.data.handle,
            did: res.data.did,
            email: data.email,
            emailConfirmed: false,
            emailAuthFactor: false,
            active: true
          };
          this.persistSession?.("create", this.session);
          this._updateApiEndpoint(res.data.didDoc);
          return res;
        } catch (e) {
          this.session = void 0;
          this.persistSession?.("create-failed", void 0);
          throw e;
        }
      }
      /**
       * Start a new session with this agent.
       */
      async login(opts) {
        try {
          const res = await this.server.createSession({
            identifier: opts.identifier,
            password: opts.password,
            authFactorToken: opts.authFactorToken,
            allowTakendown: opts.allowTakendown
          });
          this.session = {
            accessJwt: res.data.accessJwt,
            refreshJwt: res.data.refreshJwt,
            handle: res.data.handle,
            did: res.data.did,
            email: res.data.email,
            emailConfirmed: res.data.emailConfirmed,
            emailAuthFactor: res.data.emailAuthFactor,
            active: res.data.active ?? true,
            status: res.data.status
          };
          this._updateApiEndpoint(res.data.didDoc);
          this.persistSession?.("create", this.session);
          return res;
        } catch (e) {
          this.session = void 0;
          this.persistSession?.("create-failed", void 0);
          throw e;
        }
      }
      async logout() {
        if (this.session) {
          try {
            await this.server.deleteSession(void 0, {
              headers: {
                authorization: `Bearer ${this.session.refreshJwt}`
              }
            });
          } catch {
          } finally {
            this.session = void 0;
            this.persistSession?.("expired", void 0);
          }
        }
      }
      /**
       * Resume a pre-existing session with this agent.
       */
      async resumeSession(session) {
        this.session = session;
        try {
          const res = await this.server.getSession(void 0, {
            headers: { authorization: `Bearer ${session.accessJwt}` }
          }).catch(async (err) => {
            if (err instanceof xrpc_1.XRPCError && ["ExpiredToken", "InvalidToken"].includes(err.error) && session.refreshJwt) {
              try {
                const res2 = await this.server.refreshSession(void 0, {
                  headers: { authorization: `Bearer ${session.refreshJwt}` }
                });
                session.accessJwt = res2.data.accessJwt;
                session.refreshJwt = res2.data.refreshJwt;
                return this.server.getSession(void 0, {
                  headers: { authorization: `Bearer ${session.accessJwt}` }
                });
              } catch {
              }
            }
            throw err;
          });
          if (res.data.did !== session.did) {
            throw new xrpc_1.XRPCError(xrpc_1.ResponseType.InvalidRequest, "Invalid session", "InvalidDID");
          }
          session.email = res.data.email;
          session.handle = res.data.handle;
          session.emailConfirmed = res.data.emailConfirmed;
          session.emailAuthFactor = res.data.emailAuthFactor;
          session.active = res.data.active ?? true;
          session.status = res.data.status;
          if (this.session === session) {
            this._updateApiEndpoint(res.data.didDoc);
            this.persistSession?.("update", session);
          }
          return res;
        } catch (err) {
          if (this.session === session) {
            this.session = void 0;
            this.persistSession?.(err instanceof xrpc_1.XRPCError && ["ExpiredToken", "InvalidToken"].includes(err.error) ? "expired" : "network-error", void 0);
          }
          throw err;
        }
      }
      /**
       * Internal helper to refresh sessions
       * - Wraps the actual implementation in a promise-guard to ensure only
       *   one refresh is attempted at a time.
       */
      async refreshSession() {
        return this.refreshSessionPromise || (this.refreshSessionPromise = this._refreshSessionInner().finally(() => {
          this.refreshSessionPromise = void 0;
        }));
      }
      /**
       * Internal helper to refresh sessions (actual behavior)
       */
      async _refreshSessionInner() {
        if (!this.session?.refreshJwt) {
          return;
        }
        try {
          const res = await this.server.refreshSession(void 0, {
            headers: { authorization: `Bearer ${this.session.refreshJwt}` }
          });
          this.session = {
            ...this.session,
            accessJwt: res.data.accessJwt,
            refreshJwt: res.data.refreshJwt,
            handle: res.data.handle,
            did: res.data.did
          };
          this._updateApiEndpoint(res.data.didDoc);
          this.persistSession?.("update", this.session);
        } catch (err) {
          if (err instanceof xrpc_1.XRPCError && err.error && ["ExpiredToken", "InvalidToken"].includes(err.error)) {
            this.session = void 0;
            this.persistSession?.("expired", void 0);
          }
        }
      }
      /**
       * Helper to update the pds endpoint dynamically.
       *
       * The session methods (create, resume, refresh) may respond with the user's
       * did document which contains the user's canonical PDS endpoint. That endpoint
       * may differ from the endpoint used to contact the server. We capture that
       * PDS endpoint and update the client to use that given endpoint for future
       * requests. (This helps ensure smooth migrations between PDSes, especially
       * when the PDSes are operated by a single org.)
       */
      _updateApiEndpoint(didDoc) {
        if ((0, common_web_1.isValidDidDoc)(didDoc)) {
          const endpoint = (0, common_web_1.getPdsEndpoint)(didDoc);
          this.pdsUrl = endpoint ? new URL(endpoint) : void 0;
        } else {
          this.pdsUrl = void 0;
        }
      }
    };
    exports.CredentialSession = CredentialSession;
    function isErrorObject(v) {
      return xrpc_1.errorResponseBody.safeParse(v).success;
    }
    async function isErrorResponse(response, status, errorNames) {
      if (!status.includes(response.status))
        return false;
      try {
        const json = await peekJson(response, 10 * 1024);
        return isErrorObject(json) && errorNames.includes(json.error);
      } catch (err) {
        return false;
      }
    }
    async function peekJson(response, maxSize = Infinity) {
      if (extractType(response) !== "application/json")
        throw new Error("Not JSON");
      if (extractLength(response) > maxSize)
        throw new Error("Response too large");
      return response.clone().json();
    }
    function extractLength({ headers }) {
      return headers.get("Content-Length") ? Number(headers.get("Content-Length")) : NaN;
    }
    function extractType({ headers }) {
      return headers.get("Content-Type")?.split(";")[0]?.trim();
    }
  }
});

// node_modules/@atproto/api/dist/bsky-agent.js
var require_bsky_agent = __commonJS({
  "node_modules/@atproto/api/dist/bsky-agent.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BskyAgent = void 0;
    var atp_agent_1 = require_atp_agent();
    var BskyAgent = class _BskyAgent extends atp_agent_1.AtpAgent {
      clone() {
        if (this.constructor === _BskyAgent) {
          const agent = new _BskyAgent(this.sessionManager);
          return this.copyInto(agent);
        }
        throw new TypeError("Cannot clone a subclass of BskyAgent");
      }
    };
    exports.BskyAgent = BskyAgent;
  }
});

// node_modules/@atproto/api/dist/index.js
var require_dist11 = __commonJS({
  "node_modules/@atproto/api/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.lexicons = exports.default = exports.BskyAgent = exports.CredentialSession = exports.AtpAgent = exports.Agent = exports.LABELS = exports.DEFAULT_LABEL_SETTINGS = exports.asPredicate = exports.schemas = exports.parseLanguage = exports.stringifyLex = exports.lexToJson = exports.jsonToLex = exports.jsonStringToLex = exports.BlobRef = exports.AtUri = void 0;
    var lexicon_1 = require_dist7();
    var lexicons_1 = require_lexicons2();
    var syntax_1 = require_dist5();
    Object.defineProperty(exports, "AtUri", { enumerable: true, get: function() {
      return syntax_1.AtUri;
    } });
    var lexicon_2 = require_dist7();
    Object.defineProperty(exports, "BlobRef", { enumerable: true, get: function() {
      return lexicon_2.BlobRef;
    } });
    Object.defineProperty(exports, "jsonStringToLex", { enumerable: true, get: function() {
      return lexicon_2.jsonStringToLex;
    } });
    Object.defineProperty(exports, "jsonToLex", { enumerable: true, get: function() {
      return lexicon_2.jsonToLex;
    } });
    Object.defineProperty(exports, "lexToJson", { enumerable: true, get: function() {
      return lexicon_2.lexToJson;
    } });
    Object.defineProperty(exports, "stringifyLex", { enumerable: true, get: function() {
      return lexicon_2.stringifyLex;
    } });
    var common_web_1 = require_dist4();
    Object.defineProperty(exports, "parseLanguage", { enumerable: true, get: function() {
      return common_web_1.parseLanguage;
    } });
    __exportStar2(require_types4(), exports);
    __exportStar2(require_const(), exports);
    __exportStar2(require_util6(), exports);
    __exportStar2(require_client2(), exports);
    var lexicons_2 = require_lexicons2();
    Object.defineProperty(exports, "schemas", { enumerable: true, get: function() {
      return lexicons_2.schemas;
    } });
    var util_1 = require_util5();
    Object.defineProperty(exports, "asPredicate", { enumerable: true, get: function() {
      return util_1.asPredicate;
    } });
    __exportStar2(require_rich_text(), exports);
    __exportStar2(require_sanitization(), exports);
    __exportStar2(require_unicode(), exports);
    __exportStar2(require_util9(), exports);
    __exportStar2(require_moderation(), exports);
    __exportStar2(require_types7(), exports);
    __exportStar2(require_mocker(), exports);
    var labels_1 = require_labels();
    Object.defineProperty(exports, "DEFAULT_LABEL_SETTINGS", { enumerable: true, get: function() {
      return labels_1.DEFAULT_LABEL_SETTINGS;
    } });
    Object.defineProperty(exports, "LABELS", { enumerable: true, get: function() {
      return labels_1.LABELS;
    } });
    var agent_1 = require_agent();
    Object.defineProperty(exports, "Agent", { enumerable: true, get: function() {
      return agent_1.Agent;
    } });
    var atp_agent_1 = require_atp_agent();
    Object.defineProperty(exports, "AtpAgent", { enumerable: true, get: function() {
      return atp_agent_1.AtpAgent;
    } });
    var atp_agent_2 = require_atp_agent();
    Object.defineProperty(exports, "CredentialSession", { enumerable: true, get: function() {
      return atp_agent_2.CredentialSession;
    } });
    var bsky_agent_1 = require_bsky_agent();
    Object.defineProperty(exports, "BskyAgent", { enumerable: true, get: function() {
      return bsky_agent_1.BskyAgent;
    } });
    var atp_agent_3 = require_atp_agent();
    Object.defineProperty(exports, "default", { enumerable: true, get: function() {
      return atp_agent_3.AtpAgent;
    } });
    exports.lexicons = new lexicon_1.Lexicons(lexicons_1.lexicons);
  }
});

// node_modules/@atproto/oauth-client-browser/dist/disposable-polyfill/index.js
var require_disposable_polyfill = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/disposable-polyfill/index.js"() {
    "use strict";
    Symbol.dispose ?? (Symbol.dispose = Symbol("@@dispose"));
    Symbol.asyncDispose ?? (Symbol.asyncDispose = Symbol("@@asyncDispose"));
  }
});

// node_modules/@atproto/jwk/dist/errors.js
var require_errors2 = __commonJS({
  "node_modules/@atproto/jwk/dist/errors.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.JwtVerifyError = exports.JwtCreateError = exports.JwkError = exports.ERR_JWT_VERIFY = exports.ERR_JWT_CREATE = exports.ERR_JWT_INVALID = exports.ERR_JWK_NOT_FOUND = exports.ERR_JWK_INVALID = exports.ERR_JWKS_NO_MATCHING_KEY = void 0;
    exports.ERR_JWKS_NO_MATCHING_KEY = "ERR_JWKS_NO_MATCHING_KEY";
    exports.ERR_JWK_INVALID = "ERR_JWK_INVALID";
    exports.ERR_JWK_NOT_FOUND = "ERR_JWK_NOT_FOUND";
    exports.ERR_JWT_INVALID = "ERR_JWT_INVALID";
    exports.ERR_JWT_CREATE = "ERR_JWT_CREATE";
    exports.ERR_JWT_VERIFY = "ERR_JWT_VERIFY";
    var JwkError = class extends TypeError {
      constructor(message2 = "JWK error", code2 = exports.ERR_JWK_INVALID, options) {
        super(message2, options);
        Object.defineProperty(this, "code", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: code2
        });
      }
    };
    exports.JwkError = JwkError;
    var JwtCreateError = class _JwtCreateError extends Error {
      constructor(message2 = "Unable to create JWT", code2 = exports.ERR_JWT_CREATE, options) {
        super(message2, options);
        Object.defineProperty(this, "code", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: code2
        });
      }
      static from(cause, code2, message2) {
        if (cause instanceof _JwtCreateError)
          return cause;
        if (cause instanceof JwkError) {
          return new _JwtCreateError(message2, cause.code, { cause });
        }
        return new _JwtCreateError(message2, code2, { cause });
      }
    };
    exports.JwtCreateError = JwtCreateError;
    var JwtVerifyError = class _JwtVerifyError extends Error {
      constructor(message2 = "Invalid JWT", code2 = exports.ERR_JWT_VERIFY, options) {
        super(message2, options);
        Object.defineProperty(this, "code", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: code2
        });
      }
      static from(cause, code2, message2) {
        if (cause instanceof _JwtVerifyError)
          return cause;
        if (cause instanceof JwkError) {
          return new _JwtVerifyError(message2, cause.code, { cause });
        }
        return new _JwtVerifyError(message2, code2, { cause });
      }
    };
    exports.JwtVerifyError = JwtVerifyError;
  }
});

// node_modules/@atproto/jwk/dist/alg.js
var require_alg = __commonJS({
  "node_modules/@atproto/jwk/dist/alg.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.jwkAlgorithms = jwkAlgorithms;
    var errors_js_1 = require_errors2();
    var { process: process2 } = globalThis;
    var IS_NODE_RUNTIME = typeof process2 !== "undefined" && typeof process2?.versions?.node === "string";
    function* jwkAlgorithms(jwk) {
      if (jwk.alg) {
        yield jwk.alg;
        return;
      }
      switch (jwk.kty) {
        case "EC": {
          if (jwk.use === "enc" || jwk.use === void 0) {
            yield "ECDH-ES";
            yield "ECDH-ES+A128KW";
            yield "ECDH-ES+A192KW";
            yield "ECDH-ES+A256KW";
          }
          if (jwk.use === "sig" || jwk.use === void 0) {
            const crv = "crv" in jwk ? jwk.crv : void 0;
            switch (crv) {
              case "P-256":
              case "P-384":
                yield `ES${crv.slice(-3)}`;
                break;
              case "P-521":
                yield "ES512";
                break;
              case "secp256k1":
                if (IS_NODE_RUNTIME)
                  yield "ES256K";
                break;
              default:
                throw new errors_js_1.JwkError(`Unsupported crv "${crv}"`);
            }
          }
          return;
        }
        case "OKP": {
          if (!jwk.use)
            throw new errors_js_1.JwkError('Missing "use" Parameter value');
          yield "ECDH-ES";
          yield "ECDH-ES+A128KW";
          yield "ECDH-ES+A192KW";
          yield "ECDH-ES+A256KW";
          return;
        }
        case "RSA": {
          if (jwk.use === "enc" || jwk.use === void 0) {
            yield "RSA-OAEP";
            yield "RSA-OAEP-256";
            yield "RSA-OAEP-384";
            yield "RSA-OAEP-512";
            if (IS_NODE_RUNTIME)
              yield "RSA1_5";
          }
          if (jwk.use === "sig" || jwk.use === void 0) {
            yield "PS256";
            yield "PS384";
            yield "PS512";
            yield "RS256";
            yield "RS384";
            yield "RS512";
          }
          return;
        }
        case "oct": {
          if (jwk.use === "enc" || jwk.use === void 0) {
            yield "A128GCMKW";
            yield "A192GCMKW";
            yield "A256GCMKW";
            yield "A128KW";
            yield "A192KW";
            yield "A256KW";
          }
          if (jwk.use === "sig" || jwk.use === void 0) {
            yield "HS256";
            yield "HS384";
            yield "HS512";
          }
          return;
        }
        default:
          throw new errors_js_1.JwkError(`Unsupported kty "${jwk.kty}"`);
      }
    }
  }
});

// node_modules/@atproto/jwk/dist/jwk.js
var require_jwk = __commonJS({
  "node_modules/@atproto/jwk/dist/jwk.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.jwkPrivateSchema = exports.jwkPubSchema = exports.jwkValidator = exports.jwkSchema = exports.jwkUnknownKeySchema = exports.jwkSymKeySchema = exports.jwkOkpKeySchema = exports.jwkEcSecp256k1KeySchema = exports.jwkEcKeySchema = exports.jwkRsaKeySchema = exports.jwkBaseSchema = exports.keyUsageSchema = void 0;
    var zod_1 = require_zod();
    exports.keyUsageSchema = zod_1.z.enum([
      "sign",
      "verify",
      "encrypt",
      "decrypt",
      "wrapKey",
      "unwrapKey",
      "deriveKey",
      "deriveBits"
    ]);
    exports.jwkBaseSchema = zod_1.z.object({
      kty: zod_1.z.string().min(1),
      alg: zod_1.z.string().min(1).optional(),
      kid: zod_1.z.string().min(1).optional(),
      ext: zod_1.z.boolean().optional(),
      use: zod_1.z.enum(["sig", "enc"]).optional(),
      key_ops: zod_1.z.array(exports.keyUsageSchema).optional(),
      x5c: zod_1.z.array(zod_1.z.string()).optional(),
      // X.509 Certificate Chain
      x5t: zod_1.z.string().min(1).optional(),
      // X.509 Certificate SHA-1 Thumbprint
      "x5t#S256": zod_1.z.string().min(1).optional(),
      // X.509 Certificate SHA-256 Thumbprint
      x5u: zod_1.z.string().url().optional()
      // X.509 URL
    });
    exports.jwkRsaKeySchema = exports.jwkBaseSchema.extend({
      kty: zod_1.z.literal("RSA"),
      alg: zod_1.z.enum(["RS256", "RS384", "RS512", "PS256", "PS384", "PS512"]).optional(),
      n: zod_1.z.string().min(1),
      // Modulus
      e: zod_1.z.string().min(1),
      // Exponent
      d: zod_1.z.string().min(1).optional(),
      // Private Exponent
      p: zod_1.z.string().min(1).optional(),
      // First Prime Factor
      q: zod_1.z.string().min(1).optional(),
      // Second Prime Factor
      dp: zod_1.z.string().min(1).optional(),
      // First Factor CRT Exponent
      dq: zod_1.z.string().min(1).optional(),
      // Second Factor CRT Exponent
      qi: zod_1.z.string().min(1).optional(),
      // First CRT Coefficient
      oth: zod_1.z.array(zod_1.z.object({
        r: zod_1.z.string().optional(),
        d: zod_1.z.string().optional(),
        t: zod_1.z.string().optional()
      })).nonempty().optional()
      // Other Primes Info
    });
    exports.jwkEcKeySchema = exports.jwkBaseSchema.extend({
      kty: zod_1.z.literal("EC"),
      alg: zod_1.z.enum(["ES256", "ES384", "ES512"]).optional(),
      crv: zod_1.z.enum(["P-256", "P-384", "P-521"]),
      x: zod_1.z.string().min(1),
      y: zod_1.z.string().min(1),
      d: zod_1.z.string().min(1).optional()
      // ECC Private Key
    });
    exports.jwkEcSecp256k1KeySchema = exports.jwkBaseSchema.extend({
      kty: zod_1.z.literal("EC"),
      alg: zod_1.z.enum(["ES256K"]).optional(),
      crv: zod_1.z.enum(["secp256k1"]),
      x: zod_1.z.string().min(1),
      y: zod_1.z.string().min(1),
      d: zod_1.z.string().min(1).optional()
      // ECC Private Key
    });
    exports.jwkOkpKeySchema = exports.jwkBaseSchema.extend({
      kty: zod_1.z.literal("OKP"),
      alg: zod_1.z.enum(["EdDSA"]).optional(),
      crv: zod_1.z.enum(["Ed25519", "Ed448"]),
      x: zod_1.z.string().min(1),
      d: zod_1.z.string().min(1).optional()
      // ECC Private Key
    });
    exports.jwkSymKeySchema = exports.jwkBaseSchema.extend({
      kty: zod_1.z.literal("oct"),
      // Octet Sequence (used to represent symmetric keys)
      alg: zod_1.z.enum(["HS256", "HS384", "HS512"]).optional(),
      k: zod_1.z.string()
      // Key Value (base64url encoded)
    });
    exports.jwkUnknownKeySchema = exports.jwkBaseSchema.extend({
      kty: zod_1.z.string().refine((v) => v !== "RSA" && v !== "EC" && v !== "OKP" && v !== "oct")
    });
    exports.jwkSchema = zod_1.z.union([
      exports.jwkUnknownKeySchema,
      exports.jwkRsaKeySchema,
      exports.jwkEcKeySchema,
      exports.jwkEcSecp256k1KeySchema,
      exports.jwkOkpKeySchema,
      exports.jwkSymKeySchema
    ]).refine((k) => (
      // https://datatracker.ietf.org/doc/html/rfc7517#section-4.3
      // > The "use" parameter is employed to indicate whether a public key is
      // > used for encrypting data or verifying the signature on data.
      !k.use || !k.key_ops || k.key_ops.every(k.use === "sig" ? (o) => o === "verify" : (o) => o === "decrypt")
    ), {
      message: "use and key_ops must be consistent",
      path: ["key_ops"]
    });
    exports.jwkValidator = exports.jwkSchema;
    exports.jwkPubSchema = exports.jwkSchema.refine((k) => k.kid != null, "kid is required").refine((k) => !("k" in k) && !("d" in k), "private key not allowed");
    exports.jwkPrivateSchema = exports.jwkSchema.refine((k) => "k" in k && k.k != null || "d" in k && k.d != null, "private key required");
  }
});

// node_modules/@atproto/jwk/dist/jwks.js
var require_jwks = __commonJS({
  "node_modules/@atproto/jwk/dist/jwks.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.jwksPubSchema = exports.jwksSchema = void 0;
    var zod_1 = require_zod();
    var jwk_js_1 = require_jwk();
    exports.jwksSchema = zod_1.z.object({
      keys: zod_1.z.array(jwk_js_1.jwkSchema)
    });
    exports.jwksPubSchema = zod_1.z.object({
      keys: zod_1.z.array(jwk_js_1.jwkPubSchema)
    });
  }
});

// node_modules/@atproto/jwk/dist/util.js
var require_util11 = __commonJS({
  "node_modules/@atproto/jwk/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.segmentedStringRefinementFactory = exports.jwtCharsRefinement = exports.cachedGetter = exports.preferredOrderCmp = exports.isDefined = void 0;
    exports.matchesAny = matchesAny;
    exports.parseB64uJson = parseB64uJson;
    var base64_1 = (init_base64(), __toCommonJS(base64_exports));
    var zod_1 = require_zod();
    var isDefined = (i) => i !== void 0;
    exports.isDefined = isDefined;
    var preferredOrderCmp = (order) => (a, b) => {
      const aIdx = order.indexOf(a);
      const bIdx = order.indexOf(b);
      if (aIdx === bIdx)
        return 0;
      if (aIdx === -1)
        return 1;
      if (bIdx === -1)
        return -1;
      return aIdx - bIdx;
    };
    exports.preferredOrderCmp = preferredOrderCmp;
    function matchesAny(value) {
      return value == null ? (v) => true : Array.isArray(value) ? (v) => value.includes(v) : (v) => v === value;
    }
    var cachedGetter = (target, _context) => {
      return function() {
        const value = target.call(this);
        Object.defineProperty(this, target.name, {
          get: () => value,
          enumerable: true,
          configurable: true
        });
        return value;
      };
    };
    exports.cachedGetter = cachedGetter;
    var decoder2 = new TextDecoder();
    function parseB64uJson(input) {
      const inputBytes = base64_1.base64url.baseDecode(input);
      const json = decoder2.decode(inputBytes);
      return JSON.parse(json);
    }
    var jwtCharsRefinement = (data, ctx) => {
      let char;
      for (let i = 0; i < data.length; i++) {
        char = data.charCodeAt(i);
        if (
          // Base64 URL encoding (most frequent)
          65 <= char && char <= 90 || // A-Z
          97 <= char && char <= 122 || // a-z
          48 <= char && char <= 57 || // 0-9
          char === 45 || // -
          char === 95 || // _
          // Boundary (least frequent, check last)
          char === 46
        ) {
        } else {
          const invalidChar = String.fromCodePoint(data.codePointAt(i));
          return ctx.addIssue({
            code: zod_1.ZodIssueCode.custom,
            message: `Invalid character "${invalidChar}" in JWT at position ${i}`
          });
        }
      }
    };
    exports.jwtCharsRefinement = jwtCharsRefinement;
    var segmentedStringRefinementFactory = (count, minPartLength = 2) => {
      if (!Number.isFinite(count) || count < 1 || (count | 0) !== count) {
        throw new TypeError(`Count must be a natural number (got ${count})`);
      }
      const minTotalLength = count * minPartLength + (count - 1);
      const errorPrefix = `Invalid JWT format`;
      return (data, ctx) => {
        if (data.length < minTotalLength) {
          ctx.addIssue({
            code: zod_1.ZodIssueCode.custom,
            message: `${errorPrefix}: too short`
          });
          return false;
        }
        let currentStart = 0;
        for (let i = 0; i < count - 1; i++) {
          const nextDot = data.indexOf(".", currentStart);
          if (nextDot === -1) {
            ctx.addIssue({
              code: zod_1.ZodIssueCode.custom,
              message: `${errorPrefix}: expected ${count} segments, got ${i + 1}`
            });
            return false;
          }
          if (nextDot - currentStart < minPartLength) {
            ctx.addIssue({
              code: zod_1.ZodIssueCode.custom,
              message: `${errorPrefix}: segment ${i + 1} is too short`
            });
            return false;
          }
          currentStart = nextDot + 1;
        }
        if (data.indexOf(".", currentStart) !== -1) {
          ctx.addIssue({
            code: zod_1.ZodIssueCode.custom,
            message: `${errorPrefix}: too many segments`
          });
          return false;
        }
        if (data.length - currentStart < minPartLength) {
          ctx.addIssue({
            code: zod_1.ZodIssueCode.custom,
            message: `${errorPrefix}: last segment is too short`
          });
          return false;
        }
        return true;
      };
    };
    exports.segmentedStringRefinementFactory = segmentedStringRefinementFactory;
  }
});

// node_modules/@atproto/jwk/dist/jwt.js
var require_jwt = __commonJS({
  "node_modules/@atproto/jwk/dist/jwt.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.jwtPayloadSchema = exports.htuSchema = exports.jwtHeaderSchema = exports.isUnsignedJwt = exports.unsignedJwtSchema = exports.isSignedJwt = exports.signedJwtSchema = void 0;
    var zod_1 = require_zod();
    var jwk_js_1 = require_jwk();
    var util_js_1 = require_util11();
    exports.signedJwtSchema = zod_1.z.string().superRefine(util_js_1.jwtCharsRefinement).superRefine((0, util_js_1.segmentedStringRefinementFactory)(3));
    var isSignedJwt = (data) => exports.signedJwtSchema.safeParse(data).success;
    exports.isSignedJwt = isSignedJwt;
    exports.unsignedJwtSchema = zod_1.z.string().superRefine(util_js_1.jwtCharsRefinement).superRefine((0, util_js_1.segmentedStringRefinementFactory)(2));
    var isUnsignedJwt = (data) => exports.unsignedJwtSchema.safeParse(data).success;
    exports.isUnsignedJwt = isUnsignedJwt;
    exports.jwtHeaderSchema = zod_1.z.object({
      /** "alg" (Algorithm) Header Parameter */
      alg: zod_1.z.string(),
      /** "jku" (JWK Set URL) Header Parameter */
      jku: zod_1.z.string().url().optional(),
      /** "jwk" (JSON Web Key) Header Parameter */
      jwk: zod_1.z.object({
        kty: zod_1.z.string(),
        crv: zod_1.z.string().optional(),
        x: zod_1.z.string().optional(),
        y: zod_1.z.string().optional(),
        e: zod_1.z.string().optional(),
        n: zod_1.z.string().optional()
      }).optional(),
      /** "kid" (Key ID) Header Parameter */
      kid: zod_1.z.string().optional(),
      /** "x5u" (X.509 URL) Header Parameter */
      x5u: zod_1.z.string().optional(),
      /** "x5c" (X.509 Certificate Chain) Header Parameter */
      x5c: zod_1.z.array(zod_1.z.string()).optional(),
      /** "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter */
      x5t: zod_1.z.string().optional(),
      /** "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header Parameter */
      "x5t#S256": zod_1.z.string().optional(),
      /** "typ" (Type) Header Parameter */
      typ: zod_1.z.string().optional(),
      /** "cty" (Content Type) Header Parameter */
      cty: zod_1.z.string().optional(),
      /** "crit" (Critical) Header Parameter */
      crit: zod_1.z.array(zod_1.z.string()).optional()
    }).passthrough();
    exports.htuSchema = zod_1.z.string().superRefine((value, ctx) => {
      try {
        const url = new URL(value);
        if (url.protocol !== "http:" && url.protocol !== "https:") {
          ctx.addIssue({
            code: zod_1.z.ZodIssueCode.custom,
            message: "Only http: and https: protocols are allowed"
          });
        }
        if (url.username || url.password) {
          ctx.addIssue({
            code: zod_1.z.ZodIssueCode.custom,
            message: "Credentials not allowed"
          });
        }
        if (url.search) {
          ctx.addIssue({
            code: zod_1.z.ZodIssueCode.custom,
            message: "Query string not allowed"
          });
        }
        if (url.hash) {
          ctx.addIssue({
            code: zod_1.z.ZodIssueCode.custom,
            message: "Fragment not allowed"
          });
        }
      } catch (err) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.invalid_string,
          validation: "url"
        });
      }
      return value;
    });
    exports.jwtPayloadSchema = zod_1.z.object({
      iss: zod_1.z.string().optional(),
      aud: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string()).nonempty()]).optional(),
      sub: zod_1.z.string().optional(),
      exp: zod_1.z.number().int().optional(),
      nbf: zod_1.z.number().int().optional(),
      iat: zod_1.z.number().int().optional(),
      jti: zod_1.z.string().optional(),
      htm: zod_1.z.string().optional(),
      htu: exports.htuSchema.optional(),
      ath: zod_1.z.string().optional(),
      acr: zod_1.z.string().optional(),
      azp: zod_1.z.string().optional(),
      amr: zod_1.z.array(zod_1.z.string()).optional(),
      // https://datatracker.ietf.org/doc/html/rfc7800
      cnf: zod_1.z.object({
        kid: zod_1.z.string().optional(),
        // Key ID
        jwk: jwk_js_1.jwkPubSchema.optional(),
        // JWK
        jwe: zod_1.z.string().optional(),
        // Encrypted key
        jku: zod_1.z.string().url().optional(),
        // JWK Set URI ("kid" should also be provided)
        // https://datatracker.ietf.org/doc/html/rfc9449#section-6.1
        jkt: zod_1.z.string().optional(),
        // https://datatracker.ietf.org/doc/html/rfc8705
        "x5t#S256": zod_1.z.string().optional(),
        // X.509 Certificate SHA-256 Thumbprint
        // https://datatracker.ietf.org/doc/html/rfc9203
        osc: zod_1.z.string().optional()
        // OSCORE_Input_Material carrying the parameters for using OSCORE per-message security with implicit key confirmation
      }).optional(),
      client_id: zod_1.z.string().optional(),
      scope: zod_1.z.string().optional(),
      nonce: zod_1.z.string().optional(),
      at_hash: zod_1.z.string().optional(),
      c_hash: zod_1.z.string().optional(),
      s_hash: zod_1.z.string().optional(),
      auth_time: zod_1.z.number().int().optional(),
      // https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims
      // OpenID: "profile" scope
      name: zod_1.z.string().optional(),
      family_name: zod_1.z.string().optional(),
      given_name: zod_1.z.string().optional(),
      middle_name: zod_1.z.string().optional(),
      nickname: zod_1.z.string().optional(),
      preferred_username: zod_1.z.string().optional(),
      gender: zod_1.z.string().optional(),
      // OpenID only defines "male" and "female" without forbidding other values
      picture: zod_1.z.string().url().optional(),
      profile: zod_1.z.string().url().optional(),
      website: zod_1.z.string().url().optional(),
      birthdate: zod_1.z.string().regex(/\d{4}-\d{2}-\d{2}/).optional(),
      zoneinfo: zod_1.z.string().regex(/^[A-Za-z0-9_/]+$/).optional(),
      locale: zod_1.z.string().regex(/^[a-z]{2,3}(-[A-Z]{2})?$/).optional(),
      updated_at: zod_1.z.number().int().optional(),
      // OpenID: "email" scope
      email: zod_1.z.string().optional(),
      email_verified: zod_1.z.boolean().optional(),
      // OpenID: "phone" scope
      phone_number: zod_1.z.string().optional(),
      phone_number_verified: zod_1.z.boolean().optional(),
      // OpenID: "address" scope
      // https://openid.net/specs/openid-connect-core-1_0.html#AddressClaim
      address: zod_1.z.object({
        formatted: zod_1.z.string().optional(),
        street_address: zod_1.z.string().optional(),
        locality: zod_1.z.string().optional(),
        region: zod_1.z.string().optional(),
        postal_code: zod_1.z.string().optional(),
        country: zod_1.z.string().optional()
      }).optional(),
      // https://datatracker.ietf.org/doc/html/rfc9396#section-14.2
      authorization_details: zod_1.z.array(zod_1.z.object({
        type: zod_1.z.string(),
        // https://datatracker.ietf.org/doc/html/rfc9396#section-2.2
        locations: zod_1.z.array(zod_1.z.string()).optional(),
        actions: zod_1.z.array(zod_1.z.string()).optional(),
        datatypes: zod_1.z.array(zod_1.z.string()).optional(),
        identifier: zod_1.z.string().optional(),
        privileges: zod_1.z.array(zod_1.z.string()).optional()
      }).passthrough()).optional()
    }).passthrough();
  }
});

// node_modules/@atproto/jwk/dist/jwt-decode.js
var require_jwt_decode = __commonJS({
  "node_modules/@atproto/jwk/dist/jwt-decode.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.unsafeDecodeJwt = unsafeDecodeJwt;
    var errors_js_1 = require_errors2();
    var jwt_js_1 = require_jwt();
    var util_js_1 = require_util11();
    function unsafeDecodeJwt(jwt) {
      const { 0: headerEnc, 1: payloadEnc, length: length2 } = jwt.split(".");
      if (length2 > 3 || length2 < 2) {
        throw new errors_js_1.JwtVerifyError(void 0, errors_js_1.ERR_JWT_INVALID);
      }
      const header = jwt_js_1.jwtHeaderSchema.parse((0, util_js_1.parseB64uJson)(headerEnc));
      if (length2 === 2 && header?.alg !== "none") {
        throw new errors_js_1.JwtVerifyError(void 0, errors_js_1.ERR_JWT_INVALID);
      }
      const payload = jwt_js_1.jwtPayloadSchema.parse((0, util_js_1.parseB64uJson)(payloadEnc));
      return { header, payload };
    }
  }
});

// node_modules/@atproto/jwk/dist/jwt-verify.js
var require_jwt_verify = __commonJS({
  "node_modules/@atproto/jwk/dist/jwt-verify.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/@atproto/jwk/dist/key.js
var require_key = __commonJS({
  "node_modules/@atproto/jwk/dist/key.js"(exports) {
    "use strict";
    var __runInitializers2 = exports && exports.__runInitializers || function(thisArg, initializers, value) {
      var useValue = arguments.length > 2;
      for (var i = 0; i < initializers.length; i++) {
        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
      }
      return useValue ? value : void 0;
    };
    var __esDecorate2 = exports && exports.__esDecorate || function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
      function accept(f) {
        if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
        return f;
      }
      var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
      var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
      var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
      var _, done = false;
      for (var i = decorators.length - 1; i >= 0; i--) {
        var context = {};
        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
        context.addInitializer = function(f) {
          if (done) throw new TypeError("Cannot add initializers after decoration has completed");
          extraInitializers.push(accept(f || null));
        };
        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
        if (kind === "accessor") {
          if (result === void 0) continue;
          if (result === null || typeof result !== "object") throw new TypeError("Object expected");
          if (_ = accept(result.get)) descriptor.get = _;
          if (_ = accept(result.set)) descriptor.set = _;
          if (_ = accept(result.init)) initializers.unshift(_);
        } else if (_ = accept(result)) {
          if (kind === "field") initializers.unshift(_);
          else descriptor[key] = _;
        }
      }
      if (target) Object.defineProperty(target, contextIn.name, descriptor);
      done = true;
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Key = void 0;
    var alg_js_1 = require_alg();
    var errors_js_1 = require_errors2();
    var jwk_js_1 = require_jwk();
    var util_js_1 = require_util11();
    var jwkSchemaReadonly = jwk_js_1.jwkSchema.readonly();
    var Key = (() => {
      var _a;
      let _instanceExtraInitializers = [];
      let _get_publicJwk_decorators;
      let _get_bareJwk_decorators;
      let _get_algorithms_decorators;
      return _a = class Key {
        constructor(jwk) {
          Object.defineProperty(this, "jwk", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: (__runInitializers2(this, _instanceExtraInitializers), jwk)
          });
          if (!jwk.use)
            throw new errors_js_1.JwkError('Missing "use" Parameter value');
        }
        get isPrivate() {
          const { jwk } = this;
          if ("d" in jwk && jwk.d !== void 0)
            return true;
          if ("k" in jwk && jwk.k !== void 0)
            return true;
          return false;
        }
        get isSymetric() {
          const { jwk } = this;
          if ("k" in jwk && jwk.k !== void 0)
            return true;
          return false;
        }
        get privateJwk() {
          return this.isPrivate ? this.jwk : void 0;
        }
        get publicJwk() {
          if (this.isSymetric)
            return void 0;
          return jwkSchemaReadonly.parse({
            ...this.jwk,
            d: void 0,
            k: void 0
          });
        }
        get bareJwk() {
          if (this.isSymetric)
            return void 0;
          const { kty, crv, e, n, x, y } = this.jwk;
          return jwkSchemaReadonly.parse({ crv, e, kty, n, x, y });
        }
        get use() {
          return this.jwk.use;
        }
        /**
         * The (forced) algorithm to use. If not provided, the key will be usable with
         * any of the algorithms in {@link algorithms}.
         *
         * @see {@link https://datatracker.ietf.org/doc/html/rfc7518#section-3.1 | "alg" (Algorithm) Header Parameter Values for JWS}
         */
        get alg() {
          return this.jwk.alg;
        }
        get kid() {
          return this.jwk.kid;
        }
        get crv() {
          return this.jwk.crv;
        }
        /**
         * All the algorithms that this key can be used with. If `alg` is provided,
         * this set will only contain that algorithm.
         */
        get algorithms() {
          return Object.freeze(Array.from((0, alg_js_1.jwkAlgorithms)(this.jwk)));
        }
      }, (() => {
        const _metadata = typeof Symbol === "function" && Symbol.metadata ? /* @__PURE__ */ Object.create(null) : void 0;
        _get_publicJwk_decorators = [util_js_1.cachedGetter];
        _get_bareJwk_decorators = [util_js_1.cachedGetter];
        _get_algorithms_decorators = [util_js_1.cachedGetter];
        __esDecorate2(_a, null, _get_publicJwk_decorators, { kind: "getter", name: "publicJwk", static: false, private: false, access: { has: (obj) => "publicJwk" in obj, get: (obj) => obj.publicJwk }, metadata: _metadata }, null, _instanceExtraInitializers);
        __esDecorate2(_a, null, _get_bareJwk_decorators, { kind: "getter", name: "bareJwk", static: false, private: false, access: { has: (obj) => "bareJwk" in obj, get: (obj) => obj.bareJwk }, metadata: _metadata }, null, _instanceExtraInitializers);
        __esDecorate2(_a, null, _get_algorithms_decorators, { kind: "getter", name: "algorithms", static: false, private: false, access: { has: (obj) => "algorithms" in obj, get: (obj) => obj.algorithms }, metadata: _metadata }, null, _instanceExtraInitializers);
        if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      })(), _a;
    })();
    exports.Key = Key;
  }
});

// node_modules/@atproto/jwk/dist/keyset.js
var require_keyset = __commonJS({
  "node_modules/@atproto/jwk/dist/keyset.js"(exports) {
    "use strict";
    var __runInitializers2 = exports && exports.__runInitializers || function(thisArg, initializers, value) {
      var useValue = arguments.length > 2;
      for (var i = 0; i < initializers.length; i++) {
        value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
      }
      return useValue ? value : void 0;
    };
    var __esDecorate2 = exports && exports.__esDecorate || function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
      function accept(f) {
        if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
        return f;
      }
      var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
      var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
      var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
      var _, done = false;
      for (var i = decorators.length - 1; i >= 0; i--) {
        var context = {};
        for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
        for (var p in contextIn.access) context.access[p] = contextIn.access[p];
        context.addInitializer = function(f) {
          if (done) throw new TypeError("Cannot add initializers after decoration has completed");
          extraInitializers.push(accept(f || null));
        };
        var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
        if (kind === "accessor") {
          if (result === void 0) continue;
          if (result === null || typeof result !== "object") throw new TypeError("Object expected");
          if (_ = accept(result.get)) descriptor.get = _;
          if (_ = accept(result.set)) descriptor.set = _;
          if (_ = accept(result.init)) initializers.unshift(_);
        } else if (_ = accept(result)) {
          if (kind === "field") initializers.unshift(_);
          else descriptor[key] = _;
        }
      }
      if (target) Object.defineProperty(target, contextIn.name, descriptor);
      done = true;
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Keyset = void 0;
    var errors_js_1 = require_errors2();
    var jwt_decode_js_1 = require_jwt_decode();
    var util_js_1 = require_util11();
    var extractPrivateJwk = (key) => key.privateJwk;
    var extractPublicJwk = (key) => key.publicJwk;
    var Keyset = (() => {
      var _a;
      let _instanceExtraInitializers = [];
      let _get_signAlgorithms_decorators;
      let _get_publicJwks_decorators;
      let _get_privateJwks_decorators;
      return _a = class Keyset {
        constructor(iterable, preferredSigningAlgorithms = iterable instanceof _a ? [...iterable.preferredSigningAlgorithms] : [
          // Prefer elliptic curve algorithms
          "EdDSA",
          "ES256K",
          "ES256",
          // https://datatracker.ietf.org/doc/html/rfc7518#section-3.5
          "PS256",
          "PS384",
          "PS512",
          "HS256",
          "HS384",
          "HS512"
        ]) {
          Object.defineProperty(this, "preferredSigningAlgorithms", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: (__runInitializers2(this, _instanceExtraInitializers), preferredSigningAlgorithms)
          });
          Object.defineProperty(this, "keys", {
            enumerable: true,
            configurable: true,
            writable: true,
            value: void 0
          });
          const keys = [];
          const kids = /* @__PURE__ */ new Set();
          for (const key of iterable) {
            if (!key)
              continue;
            keys.push(key);
            if (key.kid) {
              if (kids.has(key.kid))
                throw new errors_js_1.JwkError(`Duplicate key: ${key.kid}`);
              else
                kids.add(key.kid);
            }
          }
          this.keys = Object.freeze(keys);
        }
        get size() {
          return this.keys.length;
        }
        get signAlgorithms() {
          const algorithms = /* @__PURE__ */ new Set();
          for (const key of this) {
            if (key.use !== "sig")
              continue;
            for (const alg of key.algorithms) {
              algorithms.add(alg);
            }
          }
          return Object.freeze([...algorithms].sort((0, util_js_1.preferredOrderCmp)(this.preferredSigningAlgorithms)));
        }
        get publicJwks() {
          return {
            keys: Array.from(this, extractPublicJwk).filter(util_js_1.isDefined)
          };
        }
        get privateJwks() {
          return {
            keys: Array.from(this, extractPrivateJwk).filter(util_js_1.isDefined)
          };
        }
        has(kid) {
          return this.keys.some((key) => key.kid === kid);
        }
        get(search) {
          for (const key of this.list(search)) {
            return key;
          }
          throw new errors_js_1.JwkError(`Key not found ${search.kid || search.alg || "<unknown>"}`, errors_js_1.ERR_JWK_NOT_FOUND);
        }
        *list(search) {
          if (search.kid?.length === 0)
            return;
          if (search.alg?.length === 0)
            return;
          for (const key of this) {
            if (search.use && key.use !== search.use)
              continue;
            if (Array.isArray(search.kid)) {
              if (!key.kid || !search.kid.includes(key.kid))
                continue;
            } else if (search.kid) {
              if (key.kid !== search.kid)
                continue;
            }
            if (Array.isArray(search.alg)) {
              if (!search.alg.some((a) => key.algorithms.includes(a)))
                continue;
            } else if (typeof search.alg === "string") {
              if (!key.algorithms.includes(search.alg))
                continue;
            }
            yield key;
          }
        }
        findPrivateKey({ kid, alg, use }) {
          const matchingKeys = [];
          for (const key of this.list({ kid, alg, use })) {
            if (!key.isPrivate)
              continue;
            if (typeof alg === "string")
              return { key, alg };
            matchingKeys.push(key);
          }
          const isAllowedAlg = (0, util_js_1.matchesAny)(alg);
          const candidates = matchingKeys.map((key) => [key, key.algorithms.filter(isAllowedAlg)]);
          for (const prefAlg of this.preferredSigningAlgorithms) {
            for (const [matchingKey, matchingAlgs] of candidates) {
              if (matchingAlgs.includes(prefAlg)) {
                return { key: matchingKey, alg: prefAlg };
              }
            }
          }
          for (const [matchingKey, matchingAlgs] of candidates) {
            for (const alg2 of matchingAlgs) {
              return { key: matchingKey, alg: alg2 };
            }
          }
          throw new errors_js_1.JwkError(`No private key found for ${kid || alg || use || "<unknown>"}`, errors_js_1.ERR_JWK_NOT_FOUND);
        }
        [(_get_signAlgorithms_decorators = [util_js_1.cachedGetter], _get_publicJwks_decorators = [util_js_1.cachedGetter], _get_privateJwks_decorators = [util_js_1.cachedGetter], Symbol.iterator)]() {
          return this.keys.values();
        }
        async createJwt({ alg: sAlg, kid: sKid, ...header }, payload) {
          try {
            const { key, alg } = this.findPrivateKey({
              alg: sAlg,
              kid: sKid,
              use: "sig"
            });
            const protectedHeader = { ...header, alg, kid: key.kid };
            if (typeof payload === "function") {
              payload = await payload(protectedHeader, key);
            }
            return await key.createJwt(protectedHeader, payload);
          } catch (err) {
            throw errors_js_1.JwtCreateError.from(err);
          }
        }
        async verifyJwt(token, options) {
          const { header } = (0, jwt_decode_js_1.unsafeDecodeJwt)(token);
          const { kid, alg } = header;
          const errors = [];
          for (const key of this.list({ kid, alg })) {
            try {
              const result = await key.verifyJwt(token, options);
              return { ...result, key };
            } catch (err) {
              errors.push(err);
            }
          }
          switch (errors.length) {
            case 0:
              throw new errors_js_1.JwtVerifyError("No key matched", errors_js_1.ERR_JWKS_NO_MATCHING_KEY);
            case 1:
              throw errors_js_1.JwtVerifyError.from(errors[0], errors_js_1.ERR_JWT_INVALID);
            default:
              throw errors_js_1.JwtVerifyError.from(errors, errors_js_1.ERR_JWT_INVALID);
          }
        }
        toJSON() {
          return structuredClone(this.publicJwks);
        }
      }, (() => {
        const _metadata = typeof Symbol === "function" && Symbol.metadata ? /* @__PURE__ */ Object.create(null) : void 0;
        __esDecorate2(_a, null, _get_signAlgorithms_decorators, { kind: "getter", name: "signAlgorithms", static: false, private: false, access: { has: (obj) => "signAlgorithms" in obj, get: (obj) => obj.signAlgorithms }, metadata: _metadata }, null, _instanceExtraInitializers);
        __esDecorate2(_a, null, _get_publicJwks_decorators, { kind: "getter", name: "publicJwks", static: false, private: false, access: { has: (obj) => "publicJwks" in obj, get: (obj) => obj.publicJwks }, metadata: _metadata }, null, _instanceExtraInitializers);
        __esDecorate2(_a, null, _get_privateJwks_decorators, { kind: "getter", name: "privateJwks", static: false, private: false, access: { has: (obj) => "privateJwks" in obj, get: (obj) => obj.privateJwks }, metadata: _metadata }, null, _instanceExtraInitializers);
        if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
      })(), _a;
    })();
    exports.Keyset = Keyset;
  }
});

// node_modules/@atproto/jwk/dist/index.js
var require_dist12 = __commonJS({
  "node_modules/@atproto/jwk/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.ValidationError = void 0;
    var zod_1 = require_zod();
    Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function() {
      return zod_1.ZodError;
    } });
    __exportStar2(require_alg(), exports);
    __exportStar2(require_errors2(), exports);
    __exportStar2(require_jwk(), exports);
    __exportStar2(require_jwks(), exports);
    __exportStar2(require_jwt_decode(), exports);
    __exportStar2(require_jwt_verify(), exports);
    __exportStar2(require_jwt(), exports);
    __exportStar2(require_key(), exports);
    __exportStar2(require_keyset(), exports);
  }
});

// node_modules/jose/dist/browser/runtime/webcrypto.js
var webcrypto_default, isCryptoKey;
var init_webcrypto = __esm({
  "node_modules/jose/dist/browser/runtime/webcrypto.js"() {
    webcrypto_default = crypto;
    isCryptoKey = (key) => key instanceof CryptoKey;
  }
});

// node_modules/jose/dist/browser/runtime/digest.js
var digest2, digest_default;
var init_digest2 = __esm({
  "node_modules/jose/dist/browser/runtime/digest.js"() {
    init_webcrypto();
    digest2 = async (algorithm, data) => {
      const subtleDigest = `SHA-${algorithm.slice(-3)}`;
      return new Uint8Array(await webcrypto_default.subtle.digest(subtleDigest, data));
    };
    digest_default = digest2;
  }
});

// node_modules/jose/dist/browser/lib/buffer_utils.js
function concat(...buffers) {
  const size = buffers.reduce((acc, { length: length2 }) => acc + length2, 0);
  const buf = new Uint8Array(size);
  let i = 0;
  for (const buffer of buffers) {
    buf.set(buffer, i);
    i += buffer.length;
  }
  return buf;
}
function p2s(alg, p2sInput) {
  return concat(encoder.encode(alg), new Uint8Array([0]), p2sInput);
}
function writeUInt32BE(buf, value, offset) {
  if (value < 0 || value >= MAX_INT32) {
    throw new RangeError(`value must be >= 0 and <= ${MAX_INT32 - 1}. Received ${value}`);
  }
  buf.set([value >>> 24, value >>> 16, value >>> 8, value & 255], offset);
}
function uint64be(value) {
  const high = Math.floor(value / MAX_INT32);
  const low = value % MAX_INT32;
  const buf = new Uint8Array(8);
  writeUInt32BE(buf, high, 0);
  writeUInt32BE(buf, low, 4);
  return buf;
}
function uint32be(value) {
  const buf = new Uint8Array(4);
  writeUInt32BE(buf, value);
  return buf;
}
function lengthAndInput(input) {
  return concat(uint32be(input.length), input);
}
async function concatKdf(secret, bits, value) {
  const iterations = Math.ceil((bits >> 3) / 32);
  const res = new Uint8Array(iterations * 32);
  for (let iter = 0; iter < iterations; iter++) {
    const buf = new Uint8Array(4 + secret.length + value.length);
    buf.set(uint32be(iter + 1));
    buf.set(secret, 4);
    buf.set(value, 4 + secret.length);
    res.set(await digest_default("sha256", buf), iter * 32);
  }
  return res.slice(0, bits >> 3);
}
var encoder, decoder, MAX_INT32;
var init_buffer_utils = __esm({
  "node_modules/jose/dist/browser/lib/buffer_utils.js"() {
    init_digest2();
    encoder = new TextEncoder();
    decoder = new TextDecoder();
    MAX_INT32 = 2 ** 32;
  }
});

// node_modules/jose/dist/browser/runtime/base64url.js
var encodeBase64, encode5, decodeBase64, decode6;
var init_base64url = __esm({
  "node_modules/jose/dist/browser/runtime/base64url.js"() {
    init_buffer_utils();
    encodeBase64 = (input) => {
      let unencoded = input;
      if (typeof unencoded === "string") {
        unencoded = encoder.encode(unencoded);
      }
      const CHUNK_SIZE = 32768;
      const arr = [];
      for (let i = 0; i < unencoded.length; i += CHUNK_SIZE) {
        arr.push(String.fromCharCode.apply(null, unencoded.subarray(i, i + CHUNK_SIZE)));
      }
      return btoa(arr.join(""));
    };
    encode5 = (input) => {
      return encodeBase64(input).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
    };
    decodeBase64 = (encoded) => {
      const binary = atob(encoded);
      const bytes = new Uint8Array(binary.length);
      for (let i = 0; i < binary.length; i++) {
        bytes[i] = binary.charCodeAt(i);
      }
      return bytes;
    };
    decode6 = (input) => {
      let encoded = input;
      if (encoded instanceof Uint8Array) {
        encoded = decoder.decode(encoded);
      }
      encoded = encoded.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
      try {
        return decodeBase64(encoded);
      } catch {
        throw new TypeError("The input to be decoded is not correctly encoded.");
      }
    };
  }
});

// node_modules/jose/dist/browser/util/errors.js
var errors_exports = {};
__export(errors_exports, {
  JOSEAlgNotAllowed: () => JOSEAlgNotAllowed,
  JOSEError: () => JOSEError,
  JOSENotSupported: () => JOSENotSupported,
  JWEDecryptionFailed: () => JWEDecryptionFailed,
  JWEInvalid: () => JWEInvalid,
  JWKInvalid: () => JWKInvalid,
  JWKSInvalid: () => JWKSInvalid,
  JWKSMultipleMatchingKeys: () => JWKSMultipleMatchingKeys,
  JWKSNoMatchingKey: () => JWKSNoMatchingKey,
  JWKSTimeout: () => JWKSTimeout,
  JWSInvalid: () => JWSInvalid,
  JWSSignatureVerificationFailed: () => JWSSignatureVerificationFailed,
  JWTClaimValidationFailed: () => JWTClaimValidationFailed,
  JWTExpired: () => JWTExpired,
  JWTInvalid: () => JWTInvalid
});
var JOSEError, JWTClaimValidationFailed, JWTExpired, JOSEAlgNotAllowed, JOSENotSupported, JWEDecryptionFailed, JWEInvalid, JWSInvalid, JWTInvalid, JWKInvalid, JWKSInvalid, JWKSNoMatchingKey, JWKSMultipleMatchingKeys, JWKSTimeout, JWSSignatureVerificationFailed;
var init_errors = __esm({
  "node_modules/jose/dist/browser/util/errors.js"() {
    JOSEError = class extends Error {
      constructor(message2, options) {
        super(message2, options);
        this.code = "ERR_JOSE_GENERIC";
        this.name = this.constructor.name;
        Error.captureStackTrace?.(this, this.constructor);
      }
    };
    JOSEError.code = "ERR_JOSE_GENERIC";
    JWTClaimValidationFailed = class extends JOSEError {
      constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
        super(message2, { cause: { claim, reason, payload } });
        this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
        this.claim = claim;
        this.reason = reason;
        this.payload = payload;
      }
    };
    JWTClaimValidationFailed.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
    JWTExpired = class extends JOSEError {
      constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
        super(message2, { cause: { claim, reason, payload } });
        this.code = "ERR_JWT_EXPIRED";
        this.claim = claim;
        this.reason = reason;
        this.payload = payload;
      }
    };
    JWTExpired.code = "ERR_JWT_EXPIRED";
    JOSEAlgNotAllowed = class extends JOSEError {
      constructor() {
        super(...arguments);
        this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
      }
    };
    JOSEAlgNotAllowed.code = "ERR_JOSE_ALG_NOT_ALLOWED";
    JOSENotSupported = class extends JOSEError {
      constructor() {
        super(...arguments);
        this.code = "ERR_JOSE_NOT_SUPPORTED";
      }
    };
    JOSENotSupported.code = "ERR_JOSE_NOT_SUPPORTED";
    JWEDecryptionFailed = class extends JOSEError {
      constructor(message2 = "decryption operation failed", options) {
        super(message2, options);
        this.code = "ERR_JWE_DECRYPTION_FAILED";
      }
    };
    JWEDecryptionFailed.code = "ERR_JWE_DECRYPTION_FAILED";
    JWEInvalid = class extends JOSEError {
      constructor() {
        super(...arguments);
        this.code = "ERR_JWE_INVALID";
      }
    };
    JWEInvalid.code = "ERR_JWE_INVALID";
    JWSInvalid = class extends JOSEError {
      constructor() {
        super(...arguments);
        this.code = "ERR_JWS_INVALID";
      }
    };
    JWSInvalid.code = "ERR_JWS_INVALID";
    JWTInvalid = class extends JOSEError {
      constructor() {
        super(...arguments);
        this.code = "ERR_JWT_INVALID";
      }
    };
    JWTInvalid.code = "ERR_JWT_INVALID";
    JWKInvalid = class extends JOSEError {
      constructor() {
        super(...arguments);
        this.code = "ERR_JWK_INVALID";
      }
    };
    JWKInvalid.code = "ERR_JWK_INVALID";
    JWKSInvalid = class extends JOSEError {
      constructor() {
        super(...arguments);
        this.code = "ERR_JWKS_INVALID";
      }
    };
    JWKSInvalid.code = "ERR_JWKS_INVALID";
    JWKSNoMatchingKey = class extends JOSEError {
      constructor(message2 = "no applicable key found in the JSON Web Key Set", options) {
        super(message2, options);
        this.code = "ERR_JWKS_NO_MATCHING_KEY";
      }
    };
    JWKSNoMatchingKey.code = "ERR_JWKS_NO_MATCHING_KEY";
    JWKSMultipleMatchingKeys = class extends JOSEError {
      constructor(message2 = "multiple matching keys found in the JSON Web Key Set", options) {
        super(message2, options);
        this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
      }
    };
    JWKSMultipleMatchingKeys.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
    JWKSTimeout = class extends JOSEError {
      constructor(message2 = "request timed out", options) {
        super(message2, options);
        this.code = "ERR_JWKS_TIMEOUT";
      }
    };
    JWKSTimeout.code = "ERR_JWKS_TIMEOUT";
    JWSSignatureVerificationFailed = class extends JOSEError {
      constructor(message2 = "signature verification failed", options) {
        super(message2, options);
        this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
      }
    };
    JWSSignatureVerificationFailed.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
  }
});

// node_modules/jose/dist/browser/runtime/random.js
var random_default;
var init_random = __esm({
  "node_modules/jose/dist/browser/runtime/random.js"() {
    init_webcrypto();
    random_default = webcrypto_default.getRandomValues.bind(webcrypto_default);
  }
});

// node_modules/jose/dist/browser/lib/iv.js
function bitLength(alg) {
  switch (alg) {
    case "A128GCM":
    case "A128GCMKW":
    case "A192GCM":
    case "A192GCMKW":
    case "A256GCM":
    case "A256GCMKW":
      return 96;
    case "A128CBC-HS256":
    case "A192CBC-HS384":
    case "A256CBC-HS512":
      return 128;
    default:
      throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`);
  }
}
var iv_default;
var init_iv = __esm({
  "node_modules/jose/dist/browser/lib/iv.js"() {
    init_errors();
    init_random();
    iv_default = (alg) => random_default(new Uint8Array(bitLength(alg) >> 3));
  }
});

// node_modules/jose/dist/browser/lib/check_iv_length.js
var checkIvLength, check_iv_length_default;
var init_check_iv_length = __esm({
  "node_modules/jose/dist/browser/lib/check_iv_length.js"() {
    init_errors();
    init_iv();
    checkIvLength = (enc, iv) => {
      if (iv.length << 3 !== bitLength(enc)) {
        throw new JWEInvalid("Invalid Initialization Vector length");
      }
    };
    check_iv_length_default = checkIvLength;
  }
});

// node_modules/jose/dist/browser/runtime/check_cek_length.js
var checkCekLength, check_cek_length_default;
var init_check_cek_length = __esm({
  "node_modules/jose/dist/browser/runtime/check_cek_length.js"() {
    init_errors();
    checkCekLength = (cek, expected) => {
      const actual = cek.byteLength << 3;
      if (actual !== expected) {
        throw new JWEInvalid(`Invalid Content Encryption Key length. Expected ${expected} bits, got ${actual} bits`);
      }
    };
    check_cek_length_default = checkCekLength;
  }
});

// node_modules/jose/dist/browser/runtime/timing_safe_equal.js
var timingSafeEqual, timing_safe_equal_default;
var init_timing_safe_equal = __esm({
  "node_modules/jose/dist/browser/runtime/timing_safe_equal.js"() {
    timingSafeEqual = (a, b) => {
      if (!(a instanceof Uint8Array)) {
        throw new TypeError("First argument must be a buffer");
      }
      if (!(b instanceof Uint8Array)) {
        throw new TypeError("Second argument must be a buffer");
      }
      if (a.length !== b.length) {
        throw new TypeError("Input buffers must have the same length");
      }
      const len = a.length;
      let out = 0;
      let i = -1;
      while (++i < len) {
        out |= a[i] ^ b[i];
      }
      return out === 0;
    };
    timing_safe_equal_default = timingSafeEqual;
  }
});

// node_modules/jose/dist/browser/lib/crypto_key.js
function unusable(name2, prop = "algorithm.name") {
  return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name2}`);
}
function isAlgorithm(algorithm, name2) {
  return algorithm.name === name2;
}
function getHashLength(hash) {
  return parseInt(hash.name.slice(4), 10);
}
function getNamedCurve(alg) {
  switch (alg) {
    case "ES256":
      return "P-256";
    case "ES384":
      return "P-384";
    case "ES512":
      return "P-521";
    default:
      throw new Error("unreachable");
  }
}
function checkUsage(key, usages) {
  if (usages.length && !usages.some((expected) => key.usages.includes(expected))) {
    let msg = "CryptoKey does not support this operation, its usages must include ";
    if (usages.length > 2) {
      const last = usages.pop();
      msg += `one of ${usages.join(", ")}, or ${last}.`;
    } else if (usages.length === 2) {
      msg += `one of ${usages[0]} or ${usages[1]}.`;
    } else {
      msg += `${usages[0]}.`;
    }
    throw new TypeError(msg);
  }
}
function checkSigCryptoKey(key, alg, ...usages) {
  switch (alg) {
    case "HS256":
    case "HS384":
    case "HS512": {
      if (!isAlgorithm(key.algorithm, "HMAC"))
        throw unusable("HMAC");
      const expected = parseInt(alg.slice(2), 10);
      const actual = getHashLength(key.algorithm.hash);
      if (actual !== expected)
        throw unusable(`SHA-${expected}`, "algorithm.hash");
      break;
    }
    case "RS256":
    case "RS384":
    case "RS512": {
      if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
        throw unusable("RSASSA-PKCS1-v1_5");
      const expected = parseInt(alg.slice(2), 10);
      const actual = getHashLength(key.algorithm.hash);
      if (actual !== expected)
        throw unusable(`SHA-${expected}`, "algorithm.hash");
      break;
    }
    case "PS256":
    case "PS384":
    case "PS512": {
      if (!isAlgorithm(key.algorithm, "RSA-PSS"))
        throw unusable("RSA-PSS");
      const expected = parseInt(alg.slice(2), 10);
      const actual = getHashLength(key.algorithm.hash);
      if (actual !== expected)
        throw unusable(`SHA-${expected}`, "algorithm.hash");
      break;
    }
    case "EdDSA": {
      if (key.algorithm.name !== "Ed25519" && key.algorithm.name !== "Ed448") {
        throw unusable("Ed25519 or Ed448");
      }
      break;
    }
    case "Ed25519": {
      if (!isAlgorithm(key.algorithm, "Ed25519"))
        throw unusable("Ed25519");
      break;
    }
    case "ES256":
    case "ES384":
    case "ES512": {
      if (!isAlgorithm(key.algorithm, "ECDSA"))
        throw unusable("ECDSA");
      const expected = getNamedCurve(alg);
      const actual = key.algorithm.namedCurve;
      if (actual !== expected)
        throw unusable(expected, "algorithm.namedCurve");
      break;
    }
    default:
      throw new TypeError("CryptoKey does not support this operation");
  }
  checkUsage(key, usages);
}
function checkEncCryptoKey(key, alg, ...usages) {
  switch (alg) {
    case "A128GCM":
    case "A192GCM":
    case "A256GCM": {
      if (!isAlgorithm(key.algorithm, "AES-GCM"))
        throw unusable("AES-GCM");
      const expected = parseInt(alg.slice(1, 4), 10);
      const actual = key.algorithm.length;
      if (actual !== expected)
        throw unusable(expected, "algorithm.length");
      break;
    }
    case "A128KW":
    case "A192KW":
    case "A256KW": {
      if (!isAlgorithm(key.algorithm, "AES-KW"))
        throw unusable("AES-KW");
      const expected = parseInt(alg.slice(1, 4), 10);
      const actual = key.algorithm.length;
      if (actual !== expected)
        throw unusable(expected, "algorithm.length");
      break;
    }
    case "ECDH": {
      switch (key.algorithm.name) {
        case "ECDH":
        case "X25519":
        case "X448":
          break;
        default:
          throw unusable("ECDH, X25519, or X448");
      }
      break;
    }
    case "PBES2-HS256+A128KW":
    case "PBES2-HS384+A192KW":
    case "PBES2-HS512+A256KW":
      if (!isAlgorithm(key.algorithm, "PBKDF2"))
        throw unusable("PBKDF2");
      break;
    case "RSA-OAEP":
    case "RSA-OAEP-256":
    case "RSA-OAEP-384":
    case "RSA-OAEP-512": {
      if (!isAlgorithm(key.algorithm, "RSA-OAEP"))
        throw unusable("RSA-OAEP");
      const expected = parseInt(alg.slice(9), 10) || 1;
      const actual = getHashLength(key.algorithm.hash);
      if (actual !== expected)
        throw unusable(`SHA-${expected}`, "algorithm.hash");
      break;
    }
    default:
      throw new TypeError("CryptoKey does not support this operation");
  }
  checkUsage(key, usages);
}
var init_crypto_key = __esm({
  "node_modules/jose/dist/browser/lib/crypto_key.js"() {
  }
});

// node_modules/jose/dist/browser/lib/invalid_key_input.js
function message(msg, actual, ...types2) {
  types2 = types2.filter(Boolean);
  if (types2.length > 2) {
    const last = types2.pop();
    msg += `one of type ${types2.join(", ")}, or ${last}.`;
  } else if (types2.length === 2) {
    msg += `one of type ${types2[0]} or ${types2[1]}.`;
  } else {
    msg += `of type ${types2[0]}.`;
  }
  if (actual == null) {
    msg += ` Received ${actual}`;
  } else if (typeof actual === "function" && actual.name) {
    msg += ` Received function ${actual.name}`;
  } else if (typeof actual === "object" && actual != null) {
    if (actual.constructor?.name) {
      msg += ` Received an instance of ${actual.constructor.name}`;
    }
  }
  return msg;
}
function withAlg(alg, actual, ...types2) {
  return message(`Key for the ${alg} algorithm must be `, actual, ...types2);
}
var invalid_key_input_default;
var init_invalid_key_input = __esm({
  "node_modules/jose/dist/browser/lib/invalid_key_input.js"() {
    invalid_key_input_default = (actual, ...types2) => {
      return message("Key must be ", actual, ...types2);
    };
  }
});

// node_modules/jose/dist/browser/runtime/is_key_like.js
var is_key_like_default, types;
var init_is_key_like = __esm({
  "node_modules/jose/dist/browser/runtime/is_key_like.js"() {
    init_webcrypto();
    is_key_like_default = (key) => {
      if (isCryptoKey(key)) {
        return true;
      }
      return key?.[Symbol.toStringTag] === "KeyObject";
    };
    types = ["CryptoKey"];
  }
});

// node_modules/jose/dist/browser/runtime/decrypt.js
async function cbcDecrypt(enc, cek, ciphertext, iv, tag2, aad) {
  if (!(cek instanceof Uint8Array)) {
    throw new TypeError(invalid_key_input_default(cek, "Uint8Array"));
  }
  const keySize = parseInt(enc.slice(1, 4), 10);
  const encKey = await webcrypto_default.subtle.importKey("raw", cek.subarray(keySize >> 3), "AES-CBC", false, ["decrypt"]);
  const macKey = await webcrypto_default.subtle.importKey("raw", cek.subarray(0, keySize >> 3), {
    hash: `SHA-${keySize << 1}`,
    name: "HMAC"
  }, false, ["sign"]);
  const macData = concat(aad, iv, ciphertext, uint64be(aad.length << 3));
  const expectedTag = new Uint8Array((await webcrypto_default.subtle.sign("HMAC", macKey, macData)).slice(0, keySize >> 3));
  let macCheckPassed;
  try {
    macCheckPassed = timing_safe_equal_default(tag2, expectedTag);
  } catch {
  }
  if (!macCheckPassed) {
    throw new JWEDecryptionFailed();
  }
  let plaintext;
  try {
    plaintext = new Uint8Array(await webcrypto_default.subtle.decrypt({ iv, name: "AES-CBC" }, encKey, ciphertext));
  } catch {
  }
  if (!plaintext) {
    throw new JWEDecryptionFailed();
  }
  return plaintext;
}
async function gcmDecrypt(enc, cek, ciphertext, iv, tag2, aad) {
  let encKey;
  if (cek instanceof Uint8Array) {
    encKey = await webcrypto_default.subtle.importKey("raw", cek, "AES-GCM", false, ["decrypt"]);
  } else {
    checkEncCryptoKey(cek, enc, "decrypt");
    encKey = cek;
  }
  try {
    return new Uint8Array(await webcrypto_default.subtle.decrypt({
      additionalData: aad,
      iv,
      name: "AES-GCM",
      tagLength: 128
    }, encKey, concat(ciphertext, tag2)));
  } catch {
    throw new JWEDecryptionFailed();
  }
}
var decrypt, decrypt_default;
var init_decrypt = __esm({
  "node_modules/jose/dist/browser/runtime/decrypt.js"() {
    init_buffer_utils();
    init_check_iv_length();
    init_check_cek_length();
    init_timing_safe_equal();
    init_errors();
    init_webcrypto();
    init_crypto_key();
    init_invalid_key_input();
    init_is_key_like();
    decrypt = async (enc, cek, ciphertext, iv, tag2, aad) => {
      if (!isCryptoKey(cek) && !(cek instanceof Uint8Array)) {
        throw new TypeError(invalid_key_input_default(cek, ...types, "Uint8Array"));
      }
      if (!iv) {
        throw new JWEInvalid("JWE Initialization Vector missing");
      }
      if (!tag2) {
        throw new JWEInvalid("JWE Authentication Tag missing");
      }
      check_iv_length_default(enc, iv);
      switch (enc) {
        case "A128CBC-HS256":
        case "A192CBC-HS384":
        case "A256CBC-HS512":
          if (cek instanceof Uint8Array)
            check_cek_length_default(cek, parseInt(enc.slice(-3), 10));
          return cbcDecrypt(enc, cek, ciphertext, iv, tag2, aad);
        case "A128GCM":
        case "A192GCM":
        case "A256GCM":
          if (cek instanceof Uint8Array)
            check_cek_length_default(cek, parseInt(enc.slice(1, 4), 10));
          return gcmDecrypt(enc, cek, ciphertext, iv, tag2, aad);
        default:
          throw new JOSENotSupported("Unsupported JWE Content Encryption Algorithm");
      }
    };
    decrypt_default = decrypt;
  }
});

// node_modules/jose/dist/browser/lib/is_disjoint.js
var isDisjoint, is_disjoint_default;
var init_is_disjoint = __esm({
  "node_modules/jose/dist/browser/lib/is_disjoint.js"() {
    isDisjoint = (...headers) => {
      const sources = headers.filter(Boolean);
      if (sources.length === 0 || sources.length === 1) {
        return true;
      }
      let acc;
      for (const header of sources) {
        const parameters = Object.keys(header);
        if (!acc || acc.size === 0) {
          acc = new Set(parameters);
          continue;
        }
        for (const parameter of parameters) {
          if (acc.has(parameter)) {
            return false;
          }
          acc.add(parameter);
        }
      }
      return true;
    };
    is_disjoint_default = isDisjoint;
  }
});

// node_modules/jose/dist/browser/lib/is_object.js
function isObjectLike(value) {
  return typeof value === "object" && value !== null;
}
function isObject(input) {
  if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
    return false;
  }
  if (Object.getPrototypeOf(input) === null) {
    return true;
  }
  let proto = input;
  while (Object.getPrototypeOf(proto) !== null) {
    proto = Object.getPrototypeOf(proto);
  }
  return Object.getPrototypeOf(input) === proto;
}
var init_is_object = __esm({
  "node_modules/jose/dist/browser/lib/is_object.js"() {
  }
});

// node_modules/jose/dist/browser/runtime/bogus.js
var bogusWebCrypto, bogus_default;
var init_bogus = __esm({
  "node_modules/jose/dist/browser/runtime/bogus.js"() {
    bogusWebCrypto = [
      { hash: "SHA-256", name: "HMAC" },
      true,
      ["sign"]
    ];
    bogus_default = bogusWebCrypto;
  }
});

// node_modules/jose/dist/browser/runtime/aeskw.js
function checkKeySize(key, alg) {
  if (key.algorithm.length !== parseInt(alg.slice(1, 4), 10)) {
    throw new TypeError(`Invalid key size for alg: ${alg}`);
  }
}
function getCryptoKey(key, alg, usage) {
  if (isCryptoKey(key)) {
    checkEncCryptoKey(key, alg, usage);
    return key;
  }
  if (key instanceof Uint8Array) {
    return webcrypto_default.subtle.importKey("raw", key, "AES-KW", true, [usage]);
  }
  throw new TypeError(invalid_key_input_default(key, ...types, "Uint8Array"));
}
var wrap, unwrap;
var init_aeskw = __esm({
  "node_modules/jose/dist/browser/runtime/aeskw.js"() {
    init_bogus();
    init_webcrypto();
    init_crypto_key();
    init_invalid_key_input();
    init_is_key_like();
    wrap = async (alg, key, cek) => {
      const cryptoKey = await getCryptoKey(key, alg, "wrapKey");
      checkKeySize(cryptoKey, alg);
      const cryptoKeyCek = await webcrypto_default.subtle.importKey("raw", cek, ...bogus_default);
      return new Uint8Array(await webcrypto_default.subtle.wrapKey("raw", cryptoKeyCek, cryptoKey, "AES-KW"));
    };
    unwrap = async (alg, key, encryptedKey) => {
      const cryptoKey = await getCryptoKey(key, alg, "unwrapKey");
      checkKeySize(cryptoKey, alg);
      const cryptoKeyCek = await webcrypto_default.subtle.unwrapKey("raw", encryptedKey, cryptoKey, "AES-KW", ...bogus_default);
      return new Uint8Array(await webcrypto_default.subtle.exportKey("raw", cryptoKeyCek));
    };
  }
});

// node_modules/jose/dist/browser/runtime/ecdhes.js
async function deriveKey(publicKey, privateKey, algorithm, keyLength, apu = new Uint8Array(0), apv = new Uint8Array(0)) {
  if (!isCryptoKey(publicKey)) {
    throw new TypeError(invalid_key_input_default(publicKey, ...types));
  }
  checkEncCryptoKey(publicKey, "ECDH");
  if (!isCryptoKey(privateKey)) {
    throw new TypeError(invalid_key_input_default(privateKey, ...types));
  }
  checkEncCryptoKey(privateKey, "ECDH", "deriveBits");
  const value = concat(lengthAndInput(encoder.encode(algorithm)), lengthAndInput(apu), lengthAndInput(apv), uint32be(keyLength));
  let length2;
  if (publicKey.algorithm.name === "X25519") {
    length2 = 256;
  } else if (publicKey.algorithm.name === "X448") {
    length2 = 448;
  } else {
    length2 = Math.ceil(parseInt(publicKey.algorithm.namedCurve.substr(-3), 10) / 8) << 3;
  }
  const sharedSecret = new Uint8Array(await webcrypto_default.subtle.deriveBits({
    name: publicKey.algorithm.name,
    public: publicKey
  }, privateKey, length2));
  return concatKdf(sharedSecret, keyLength, value);
}
async function generateEpk(key) {
  if (!isCryptoKey(key)) {
    throw new TypeError(invalid_key_input_default(key, ...types));
  }
  return webcrypto_default.subtle.generateKey(key.algorithm, true, ["deriveBits"]);
}
function ecdhAllowed(key) {
  if (!isCryptoKey(key)) {
    throw new TypeError(invalid_key_input_default(key, ...types));
  }
  return ["P-256", "P-384", "P-521"].includes(key.algorithm.namedCurve) || key.algorithm.name === "X25519" || key.algorithm.name === "X448";
}
var init_ecdhes = __esm({
  "node_modules/jose/dist/browser/runtime/ecdhes.js"() {
    init_buffer_utils();
    init_webcrypto();
    init_crypto_key();
    init_invalid_key_input();
    init_is_key_like();
  }
});

// node_modules/jose/dist/browser/lib/check_p2s.js
function checkP2s(p2s2) {
  if (!(p2s2 instanceof Uint8Array) || p2s2.length < 8) {
    throw new JWEInvalid("PBES2 Salt Input must be 8 or more octets");
  }
}
var init_check_p2s = __esm({
  "node_modules/jose/dist/browser/lib/check_p2s.js"() {
    init_errors();
  }
});

// node_modules/jose/dist/browser/runtime/pbes2kw.js
function getCryptoKey2(key, alg) {
  if (key instanceof Uint8Array) {
    return webcrypto_default.subtle.importKey("raw", key, "PBKDF2", false, ["deriveBits"]);
  }
  if (isCryptoKey(key)) {
    checkEncCryptoKey(key, alg, "deriveBits", "deriveKey");
    return key;
  }
  throw new TypeError(invalid_key_input_default(key, ...types, "Uint8Array"));
}
async function deriveKey2(p2s2, alg, p2c, key) {
  checkP2s(p2s2);
  const salt = p2s(alg, p2s2);
  const keylen = parseInt(alg.slice(13, 16), 10);
  const subtleAlg = {
    hash: `SHA-${alg.slice(8, 11)}`,
    iterations: p2c,
    name: "PBKDF2",
    salt
  };
  const wrapAlg = {
    length: keylen,
    name: "AES-KW"
  };
  const cryptoKey = await getCryptoKey2(key, alg);
  if (cryptoKey.usages.includes("deriveBits")) {
    return new Uint8Array(await webcrypto_default.subtle.deriveBits(subtleAlg, cryptoKey, keylen));
  }
  if (cryptoKey.usages.includes("deriveKey")) {
    return webcrypto_default.subtle.deriveKey(subtleAlg, cryptoKey, wrapAlg, false, ["wrapKey", "unwrapKey"]);
  }
  throw new TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"');
}
var encrypt, decrypt2;
var init_pbes2kw = __esm({
  "node_modules/jose/dist/browser/runtime/pbes2kw.js"() {
    init_random();
    init_buffer_utils();
    init_base64url();
    init_aeskw();
    init_check_p2s();
    init_webcrypto();
    init_crypto_key();
    init_invalid_key_input();
    init_is_key_like();
    encrypt = async (alg, key, cek, p2c = 2048, p2s2 = random_default(new Uint8Array(16))) => {
      const derived = await deriveKey2(p2s2, alg, p2c, key);
      const encryptedKey = await wrap(alg.slice(-6), derived, cek);
      return { encryptedKey, p2c, p2s: encode5(p2s2) };
    };
    decrypt2 = async (alg, key, encryptedKey, p2c, p2s2) => {
      const derived = await deriveKey2(p2s2, alg, p2c, key);
      return unwrap(alg.slice(-6), derived, encryptedKey);
    };
  }
});

// node_modules/jose/dist/browser/runtime/subtle_rsaes.js
function subtleRsaEs(alg) {
  switch (alg) {
    case "RSA-OAEP":
    case "RSA-OAEP-256":
    case "RSA-OAEP-384":
    case "RSA-OAEP-512":
      return "RSA-OAEP";
    default:
      throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
  }
}
var init_subtle_rsaes = __esm({
  "node_modules/jose/dist/browser/runtime/subtle_rsaes.js"() {
    init_errors();
  }
});

// node_modules/jose/dist/browser/runtime/check_key_length.js
var check_key_length_default;
var init_check_key_length = __esm({
  "node_modules/jose/dist/browser/runtime/check_key_length.js"() {
    check_key_length_default = (alg, key) => {
      if (alg.startsWith("RS") || alg.startsWith("PS")) {
        const { modulusLength } = key.algorithm;
        if (typeof modulusLength !== "number" || modulusLength < 2048) {
          throw new TypeError(`${alg} requires key modulusLength to be 2048 bits or larger`);
        }
      }
    };
  }
});

// node_modules/jose/dist/browser/runtime/rsaes.js
var encrypt2, decrypt3;
var init_rsaes = __esm({
  "node_modules/jose/dist/browser/runtime/rsaes.js"() {
    init_subtle_rsaes();
    init_bogus();
    init_webcrypto();
    init_crypto_key();
    init_check_key_length();
    init_invalid_key_input();
    init_is_key_like();
    encrypt2 = async (alg, key, cek) => {
      if (!isCryptoKey(key)) {
        throw new TypeError(invalid_key_input_default(key, ...types));
      }
      checkEncCryptoKey(key, alg, "encrypt", "wrapKey");
      check_key_length_default(alg, key);
      if (key.usages.includes("encrypt")) {
        return new Uint8Array(await webcrypto_default.subtle.encrypt(subtleRsaEs(alg), key, cek));
      }
      if (key.usages.includes("wrapKey")) {
        const cryptoKeyCek = await webcrypto_default.subtle.importKey("raw", cek, ...bogus_default);
        return new Uint8Array(await webcrypto_default.subtle.wrapKey("raw", cryptoKeyCek, key, subtleRsaEs(alg)));
      }
      throw new TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation');
    };
    decrypt3 = async (alg, key, encryptedKey) => {
      if (!isCryptoKey(key)) {
        throw new TypeError(invalid_key_input_default(key, ...types));
      }
      checkEncCryptoKey(key, alg, "decrypt", "unwrapKey");
      check_key_length_default(alg, key);
      if (key.usages.includes("decrypt")) {
        return new Uint8Array(await webcrypto_default.subtle.decrypt(subtleRsaEs(alg), key, encryptedKey));
      }
      if (key.usages.includes("unwrapKey")) {
        const cryptoKeyCek = await webcrypto_default.subtle.unwrapKey("raw", encryptedKey, key, subtleRsaEs(alg), ...bogus_default);
        return new Uint8Array(await webcrypto_default.subtle.exportKey("raw", cryptoKeyCek));
      }
      throw new TypeError('RSA-OAEP key "usages" must include "decrypt" or "unwrapKey" for this operation');
    };
  }
});

// node_modules/jose/dist/browser/lib/is_jwk.js
function isJWK(key) {
  return isObject(key) && typeof key.kty === "string";
}
function isPrivateJWK(key) {
  return key.kty !== "oct" && typeof key.d === "string";
}
function isPublicJWK(key) {
  return key.kty !== "oct" && typeof key.d === "undefined";
}
function isSecretJWK(key) {
  return isJWK(key) && key.kty === "oct" && typeof key.k === "string";
}
var init_is_jwk = __esm({
  "node_modules/jose/dist/browser/lib/is_jwk.js"() {
    init_is_object();
  }
});

// node_modules/jose/dist/browser/runtime/jwk_to_key.js
function subtleMapping(jwk) {
  let algorithm;
  let keyUsages;
  switch (jwk.kty) {
    case "RSA": {
      switch (jwk.alg) {
        case "PS256":
        case "PS384":
        case "PS512":
          algorithm = { name: "RSA-PSS", hash: `SHA-${jwk.alg.slice(-3)}` };
          keyUsages = jwk.d ? ["sign"] : ["verify"];
          break;
        case "RS256":
        case "RS384":
        case "RS512":
          algorithm = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${jwk.alg.slice(-3)}` };
          keyUsages = jwk.d ? ["sign"] : ["verify"];
          break;
        case "RSA-OAEP":
        case "RSA-OAEP-256":
        case "RSA-OAEP-384":
        case "RSA-OAEP-512":
          algorithm = {
            name: "RSA-OAEP",
            hash: `SHA-${parseInt(jwk.alg.slice(-3), 10) || 1}`
          };
          keyUsages = jwk.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
          break;
        default:
          throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
      }
      break;
    }
    case "EC": {
      switch (jwk.alg) {
        case "ES256":
          algorithm = { name: "ECDSA", namedCurve: "P-256" };
          keyUsages = jwk.d ? ["sign"] : ["verify"];
          break;
        case "ES384":
          algorithm = { name: "ECDSA", namedCurve: "P-384" };
          keyUsages = jwk.d ? ["sign"] : ["verify"];
          break;
        case "ES512":
          algorithm = { name: "ECDSA", namedCurve: "P-521" };
          keyUsages = jwk.d ? ["sign"] : ["verify"];
          break;
        case "ECDH-ES":
        case "ECDH-ES+A128KW":
        case "ECDH-ES+A192KW":
        case "ECDH-ES+A256KW":
          algorithm = { name: "ECDH", namedCurve: jwk.crv };
          keyUsages = jwk.d ? ["deriveBits"] : [];
          break;
        default:
          throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
      }
      break;
    }
    case "OKP": {
      switch (jwk.alg) {
        case "Ed25519":
          algorithm = { name: "Ed25519" };
          keyUsages = jwk.d ? ["sign"] : ["verify"];
          break;
        case "EdDSA":
          algorithm = { name: jwk.crv };
          keyUsages = jwk.d ? ["sign"] : ["verify"];
          break;
        case "ECDH-ES":
        case "ECDH-ES+A128KW":
        case "ECDH-ES+A192KW":
        case "ECDH-ES+A256KW":
          algorithm = { name: jwk.crv };
          keyUsages = jwk.d ? ["deriveBits"] : [];
          break;
        default:
          throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
      }
      break;
    }
    default:
      throw new JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
  }
  return { algorithm, keyUsages };
}
var parse, jwk_to_key_default;
var init_jwk_to_key = __esm({
  "node_modules/jose/dist/browser/runtime/jwk_to_key.js"() {
    init_webcrypto();
    init_errors();
    parse = async (jwk) => {
      if (!jwk.alg) {
        throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
      }
      const { algorithm, keyUsages } = subtleMapping(jwk);
      const rest = [
        algorithm,
        jwk.ext ?? false,
        jwk.key_ops ?? keyUsages
      ];
      const keyData = { ...jwk };
      delete keyData.alg;
      delete keyData.use;
      return webcrypto_default.subtle.importKey("jwk", keyData, ...rest);
    };
    jwk_to_key_default = parse;
  }
});

// node_modules/jose/dist/browser/runtime/normalize_key.js
var exportKeyValue, privCache, pubCache, isKeyObject, importAndCache, normalizePublicKey, normalizePrivateKey, normalize_key_default;
var init_normalize_key = __esm({
  "node_modules/jose/dist/browser/runtime/normalize_key.js"() {
    init_is_jwk();
    init_base64url();
    init_jwk_to_key();
    exportKeyValue = (k) => decode6(k);
    isKeyObject = (key) => {
      return key?.[Symbol.toStringTag] === "KeyObject";
    };
    importAndCache = async (cache, key, jwk, alg, freeze = false) => {
      let cached = cache.get(key);
      if (cached?.[alg]) {
        return cached[alg];
      }
      const cryptoKey = await jwk_to_key_default({ ...jwk, alg });
      if (freeze)
        Object.freeze(key);
      if (!cached) {
        cache.set(key, { [alg]: cryptoKey });
      } else {
        cached[alg] = cryptoKey;
      }
      return cryptoKey;
    };
    normalizePublicKey = (key, alg) => {
      if (isKeyObject(key)) {
        let jwk = key.export({ format: "jwk" });
        delete jwk.d;
        delete jwk.dp;
        delete jwk.dq;
        delete jwk.p;
        delete jwk.q;
        delete jwk.qi;
        if (jwk.k) {
          return exportKeyValue(jwk.k);
        }
        pubCache || (pubCache = /* @__PURE__ */ new WeakMap());
        return importAndCache(pubCache, key, jwk, alg);
      }
      if (isJWK(key)) {
        if (key.k)
          return decode6(key.k);
        pubCache || (pubCache = /* @__PURE__ */ new WeakMap());
        const cryptoKey = importAndCache(pubCache, key, key, alg, true);
        return cryptoKey;
      }
      return key;
    };
    normalizePrivateKey = (key, alg) => {
      if (isKeyObject(key)) {
        let jwk = key.export({ format: "jwk" });
        if (jwk.k) {
          return exportKeyValue(jwk.k);
        }
        privCache || (privCache = /* @__PURE__ */ new WeakMap());
        return importAndCache(privCache, key, jwk, alg);
      }
      if (isJWK(key)) {
        if (key.k)
          return decode6(key.k);
        privCache || (privCache = /* @__PURE__ */ new WeakMap());
        const cryptoKey = importAndCache(privCache, key, key, alg, true);
        return cryptoKey;
      }
      return key;
    };
    normalize_key_default = { normalizePublicKey, normalizePrivateKey };
  }
});

// node_modules/jose/dist/browser/lib/cek.js
function bitLength2(alg) {
  switch (alg) {
    case "A128GCM":
      return 128;
    case "A192GCM":
      return 192;
    case "A256GCM":
    case "A128CBC-HS256":
      return 256;
    case "A192CBC-HS384":
      return 384;
    case "A256CBC-HS512":
      return 512;
    default:
      throw new JOSENotSupported(`Unsupported JWE Algorithm: ${alg}`);
  }
}
var cek_default;
var init_cek = __esm({
  "node_modules/jose/dist/browser/lib/cek.js"() {
    init_errors();
    init_random();
    cek_default = (alg) => random_default(new Uint8Array(bitLength2(alg) >> 3));
  }
});

// node_modules/jose/dist/browser/lib/format_pem.js
var format_pem_default;
var init_format_pem = __esm({
  "node_modules/jose/dist/browser/lib/format_pem.js"() {
    format_pem_default = (b64, descriptor) => {
      const newlined = (b64.match(/.{1,64}/g) || []).join("\n");
      return `-----BEGIN ${descriptor}-----
${newlined}
-----END ${descriptor}-----`;
    };
  }
});

// node_modules/jose/dist/browser/runtime/asn1.js
function getElement(seq) {
  const result = [];
  let next = 0;
  while (next < seq.length) {
    const nextPart = parseElement(seq.subarray(next));
    result.push(nextPart);
    next += nextPart.byteLength;
  }
  return result;
}
function parseElement(bytes) {
  let position = 0;
  let tag2 = bytes[0] & 31;
  position++;
  if (tag2 === 31) {
    tag2 = 0;
    while (bytes[position] >= 128) {
      tag2 = tag2 * 128 + bytes[position] - 128;
      position++;
    }
    tag2 = tag2 * 128 + bytes[position] - 128;
    position++;
  }
  let length2 = 0;
  if (bytes[position] < 128) {
    length2 = bytes[position];
    position++;
  } else if (length2 === 128) {
    length2 = 0;
    while (bytes[position + length2] !== 0 || bytes[position + length2 + 1] !== 0) {
      if (length2 > bytes.byteLength) {
        throw new TypeError("invalid indefinite form length");
      }
      length2++;
    }
    const byteLength2 = position + length2 + 2;
    return {
      byteLength: byteLength2,
      contents: bytes.subarray(position, position + length2),
      raw: bytes.subarray(0, byteLength2)
    };
  } else {
    const numberOfDigits = bytes[position] & 127;
    position++;
    length2 = 0;
    for (let i = 0; i < numberOfDigits; i++) {
      length2 = length2 * 256 + bytes[position];
      position++;
    }
  }
  const byteLength = position + length2;
  return {
    byteLength,
    contents: bytes.subarray(position, byteLength),
    raw: bytes.subarray(0, byteLength)
  };
}
function spkiFromX509(buf) {
  const tbsCertificate = getElement(getElement(parseElement(buf).contents)[0].contents);
  return encodeBase64(tbsCertificate[tbsCertificate[0].raw[0] === 160 ? 6 : 5].raw);
}
function getSPKI(x509) {
  const pem = x509.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, "");
  const raw = decodeBase64(pem);
  return format_pem_default(spkiFromX509(raw), "PUBLIC KEY");
}
var genericExport, toSPKI, toPKCS8, findOid, getNamedCurve2, genericImport, fromPKCS8, fromSPKI, fromX509;
var init_asn1 = __esm({
  "node_modules/jose/dist/browser/runtime/asn1.js"() {
    init_webcrypto();
    init_invalid_key_input();
    init_base64url();
    init_format_pem();
    init_errors();
    init_is_key_like();
    genericExport = async (keyType, keyFormat, key) => {
      if (!isCryptoKey(key)) {
        throw new TypeError(invalid_key_input_default(key, ...types));
      }
      if (!key.extractable) {
        throw new TypeError("CryptoKey is not extractable");
      }
      if (key.type !== keyType) {
        throw new TypeError(`key is not a ${keyType} key`);
      }
      return format_pem_default(encodeBase64(new Uint8Array(await webcrypto_default.subtle.exportKey(keyFormat, key))), `${keyType.toUpperCase()} KEY`);
    };
    toSPKI = (key) => {
      return genericExport("public", "spki", key);
    };
    toPKCS8 = (key) => {
      return genericExport("private", "pkcs8", key);
    };
    findOid = (keyData, oid, from3 = 0) => {
      if (from3 === 0) {
        oid.unshift(oid.length);
        oid.unshift(6);
      }
      const i = keyData.indexOf(oid[0], from3);
      if (i === -1)
        return false;
      const sub = keyData.subarray(i, i + oid.length);
      if (sub.length !== oid.length)
        return false;
      return sub.every((value, index) => value === oid[index]) || findOid(keyData, oid, i + 1);
    };
    getNamedCurve2 = (keyData) => {
      switch (true) {
        case findOid(keyData, [42, 134, 72, 206, 61, 3, 1, 7]):
          return "P-256";
        case findOid(keyData, [43, 129, 4, 0, 34]):
          return "P-384";
        case findOid(keyData, [43, 129, 4, 0, 35]):
          return "P-521";
        case findOid(keyData, [43, 101, 110]):
          return "X25519";
        case findOid(keyData, [43, 101, 111]):
          return "X448";
        case findOid(keyData, [43, 101, 112]):
          return "Ed25519";
        case findOid(keyData, [43, 101, 113]):
          return "Ed448";
        default:
          throw new JOSENotSupported("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
      }
    };
    genericImport = async (replace, keyFormat, pem, alg, options) => {
      let algorithm;
      let keyUsages;
      const keyData = new Uint8Array(atob(pem.replace(replace, "")).split("").map((c) => c.charCodeAt(0)));
      const isPublic = keyFormat === "spki";
      switch (alg) {
        case "PS256":
        case "PS384":
        case "PS512":
          algorithm = { name: "RSA-PSS", hash: `SHA-${alg.slice(-3)}` };
          keyUsages = isPublic ? ["verify"] : ["sign"];
          break;
        case "RS256":
        case "RS384":
        case "RS512":
          algorithm = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${alg.slice(-3)}` };
          keyUsages = isPublic ? ["verify"] : ["sign"];
          break;
        case "RSA-OAEP":
        case "RSA-OAEP-256":
        case "RSA-OAEP-384":
        case "RSA-OAEP-512":
          algorithm = {
            name: "RSA-OAEP",
            hash: `SHA-${parseInt(alg.slice(-3), 10) || 1}`
          };
          keyUsages = isPublic ? ["encrypt", "wrapKey"] : ["decrypt", "unwrapKey"];
          break;
        case "ES256":
          algorithm = { name: "ECDSA", namedCurve: "P-256" };
          keyUsages = isPublic ? ["verify"] : ["sign"];
          break;
        case "ES384":
          algorithm = { name: "ECDSA", namedCurve: "P-384" };
          keyUsages = isPublic ? ["verify"] : ["sign"];
          break;
        case "ES512":
          algorithm = { name: "ECDSA", namedCurve: "P-521" };
          keyUsages = isPublic ? ["verify"] : ["sign"];
          break;
        case "ECDH-ES":
        case "ECDH-ES+A128KW":
        case "ECDH-ES+A192KW":
        case "ECDH-ES+A256KW": {
          const namedCurve = getNamedCurve2(keyData);
          algorithm = namedCurve.startsWith("P-") ? { name: "ECDH", namedCurve } : { name: namedCurve };
          keyUsages = isPublic ? [] : ["deriveBits"];
          break;
        }
        case "Ed25519":
          algorithm = { name: "Ed25519" };
          keyUsages = isPublic ? ["verify"] : ["sign"];
          break;
        case "EdDSA":
          algorithm = { name: getNamedCurve2(keyData) };
          keyUsages = isPublic ? ["verify"] : ["sign"];
          break;
        default:
          throw new JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value');
      }
      return webcrypto_default.subtle.importKey(keyFormat, keyData, algorithm, options?.extractable ?? false, keyUsages);
    };
    fromPKCS8 = (pem, alg, options) => {
      return genericImport(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, "pkcs8", pem, alg, options);
    };
    fromSPKI = (pem, alg, options) => {
      return genericImport(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", pem, alg, options);
    };
    fromX509 = (pem, alg, options) => {
      let spki;
      try {
        spki = getSPKI(pem);
      } catch (cause) {
        throw new TypeError("Failed to parse the X.509 certificate", { cause });
      }
      return fromSPKI(spki, alg, options);
    };
  }
});

// node_modules/jose/dist/browser/key/import.js
async function importSPKI(spki, alg, options) {
  if (typeof spki !== "string" || spki.indexOf("-----BEGIN PUBLIC KEY-----") !== 0) {
    throw new TypeError('"spki" must be SPKI formatted string');
  }
  return fromSPKI(spki, alg, options);
}
async function importX509(x509, alg, options) {
  if (typeof x509 !== "string" || x509.indexOf("-----BEGIN CERTIFICATE-----") !== 0) {
    throw new TypeError('"x509" must be X.509 formatted string');
  }
  return fromX509(x509, alg, options);
}
async function importPKCS8(pkcs8, alg, options) {
  if (typeof pkcs8 !== "string" || pkcs8.indexOf("-----BEGIN PRIVATE KEY-----") !== 0) {
    throw new TypeError('"pkcs8" must be PKCS#8 formatted string');
  }
  return fromPKCS8(pkcs8, alg, options);
}
async function importJWK(jwk, alg) {
  if (!isObject(jwk)) {
    throw new TypeError("JWK must be an object");
  }
  alg || (alg = jwk.alg);
  switch (jwk.kty) {
    case "oct":
      if (typeof jwk.k !== "string" || !jwk.k) {
        throw new TypeError('missing "k" (Key Value) Parameter value');
      }
      return decode6(jwk.k);
    case "RSA":
      if ("oth" in jwk && jwk.oth !== void 0) {
        throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
      }
    case "EC":
    case "OKP":
      return jwk_to_key_default({ ...jwk, alg });
    default:
      throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
  }
}
var init_import = __esm({
  "node_modules/jose/dist/browser/key/import.js"() {
    init_base64url();
    init_asn1();
    init_jwk_to_key();
    init_errors();
    init_is_object();
  }
});

// node_modules/jose/dist/browser/lib/check_key_type.js
function checkKeyType(allowJwk, alg, key, usage) {
  const symmetric = alg.startsWith("HS") || alg === "dir" || alg.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(alg);
  if (symmetric) {
    symmetricTypeCheck(alg, key, usage, allowJwk);
  } else {
    asymmetricTypeCheck(alg, key, usage, allowJwk);
  }
}
var tag, jwkMatchesOp, symmetricTypeCheck, asymmetricTypeCheck, check_key_type_default, checkKeyTypeWithJwk;
var init_check_key_type = __esm({
  "node_modules/jose/dist/browser/lib/check_key_type.js"() {
    init_invalid_key_input();
    init_is_key_like();
    init_is_jwk();
    tag = (key) => key?.[Symbol.toStringTag];
    jwkMatchesOp = (alg, key, usage) => {
      if (key.use !== void 0 && key.use !== "sig") {
        throw new TypeError("Invalid key for this operation, when present its use must be sig");
      }
      if (key.key_ops !== void 0 && key.key_ops.includes?.(usage) !== true) {
        throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage}`);
      }
      if (key.alg !== void 0 && key.alg !== alg) {
        throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);
      }
      return true;
    };
    symmetricTypeCheck = (alg, key, usage, allowJwk) => {
      if (key instanceof Uint8Array)
        return;
      if (allowJwk && isJWK(key)) {
        if (isSecretJWK(key) && jwkMatchesOp(alg, key, usage))
          return;
        throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`);
      }
      if (!is_key_like_default(key)) {
        throw new TypeError(withAlg(alg, key, ...types, "Uint8Array", allowJwk ? "JSON Web Key" : null));
      }
      if (key.type !== "secret") {
        throw new TypeError(`${tag(key)} instances for symmetric algorithms must be of type "secret"`);
      }
    };
    asymmetricTypeCheck = (alg, key, usage, allowJwk) => {
      if (allowJwk && isJWK(key)) {
        switch (usage) {
          case "sign":
            if (isPrivateJWK(key) && jwkMatchesOp(alg, key, usage))
              return;
            throw new TypeError(`JSON Web Key for this operation be a private JWK`);
          case "verify":
            if (isPublicJWK(key) && jwkMatchesOp(alg, key, usage))
              return;
            throw new TypeError(`JSON Web Key for this operation be a public JWK`);
        }
      }
      if (!is_key_like_default(key)) {
        throw new TypeError(withAlg(alg, key, ...types, allowJwk ? "JSON Web Key" : null));
      }
      if (key.type === "secret") {
        throw new TypeError(`${tag(key)} instances for asymmetric algorithms must not be of type "secret"`);
      }
      if (usage === "sign" && key.type === "public") {
        throw new TypeError(`${tag(key)} instances for asymmetric algorithm signing must be of type "private"`);
      }
      if (usage === "decrypt" && key.type === "public") {
        throw new TypeError(`${tag(key)} instances for asymmetric algorithm decryption must be of type "private"`);
      }
      if (key.algorithm && usage === "verify" && key.type === "private") {
        throw new TypeError(`${tag(key)} instances for asymmetric algorithm verifying must be of type "public"`);
      }
      if (key.algorithm && usage === "encrypt" && key.type === "private") {
        throw new TypeError(`${tag(key)} instances for asymmetric algorithm encryption must be of type "public"`);
      }
    };
    check_key_type_default = checkKeyType.bind(void 0, false);
    checkKeyTypeWithJwk = checkKeyType.bind(void 0, true);
  }
});

// node_modules/jose/dist/browser/runtime/encrypt.js
async function cbcEncrypt(enc, plaintext, cek, iv, aad) {
  if (!(cek instanceof Uint8Array)) {
    throw new TypeError(invalid_key_input_default(cek, "Uint8Array"));
  }
  const keySize = parseInt(enc.slice(1, 4), 10);
  const encKey = await webcrypto_default.subtle.importKey("raw", cek.subarray(keySize >> 3), "AES-CBC", false, ["encrypt"]);
  const macKey = await webcrypto_default.subtle.importKey("raw", cek.subarray(0, keySize >> 3), {
    hash: `SHA-${keySize << 1}`,
    name: "HMAC"
  }, false, ["sign"]);
  const ciphertext = new Uint8Array(await webcrypto_default.subtle.encrypt({
    iv,
    name: "AES-CBC"
  }, encKey, plaintext));
  const macData = concat(aad, iv, ciphertext, uint64be(aad.length << 3));
  const tag2 = new Uint8Array((await webcrypto_default.subtle.sign("HMAC", macKey, macData)).slice(0, keySize >> 3));
  return { ciphertext, tag: tag2, iv };
}
async function gcmEncrypt(enc, plaintext, cek, iv, aad) {
  let encKey;
  if (cek instanceof Uint8Array) {
    encKey = await webcrypto_default.subtle.importKey("raw", cek, "AES-GCM", false, ["encrypt"]);
  } else {
    checkEncCryptoKey(cek, enc, "encrypt");
    encKey = cek;
  }
  const encrypted = new Uint8Array(await webcrypto_default.subtle.encrypt({
    additionalData: aad,
    iv,
    name: "AES-GCM",
    tagLength: 128
  }, encKey, plaintext));
  const tag2 = encrypted.slice(-16);
  const ciphertext = encrypted.slice(0, -16);
  return { ciphertext, tag: tag2, iv };
}
var encrypt3, encrypt_default;
var init_encrypt = __esm({
  "node_modules/jose/dist/browser/runtime/encrypt.js"() {
    init_buffer_utils();
    init_check_iv_length();
    init_check_cek_length();
    init_webcrypto();
    init_crypto_key();
    init_invalid_key_input();
    init_iv();
    init_errors();
    init_is_key_like();
    encrypt3 = async (enc, plaintext, cek, iv, aad) => {
      if (!isCryptoKey(cek) && !(cek instanceof Uint8Array)) {
        throw new TypeError(invalid_key_input_default(cek, ...types, "Uint8Array"));
      }
      if (iv) {
        check_iv_length_default(enc, iv);
      } else {
        iv = iv_default(enc);
      }
      switch (enc) {
        case "A128CBC-HS256":
        case "A192CBC-HS384":
        case "A256CBC-HS512":
          if (cek instanceof Uint8Array) {
            check_cek_length_default(cek, parseInt(enc.slice(-3), 10));
          }
          return cbcEncrypt(enc, plaintext, cek, iv, aad);
        case "A128GCM":
        case "A192GCM":
        case "A256GCM":
          if (cek instanceof Uint8Array) {
            check_cek_length_default(cek, parseInt(enc.slice(1, 4), 10));
          }
          return gcmEncrypt(enc, plaintext, cek, iv, aad);
        default:
          throw new JOSENotSupported("Unsupported JWE Content Encryption Algorithm");
      }
    };
    encrypt_default = encrypt3;
  }
});

// node_modules/jose/dist/browser/lib/aesgcmkw.js
async function wrap2(alg, key, cek, iv) {
  const jweAlgorithm = alg.slice(0, 7);
  const wrapped = await encrypt_default(jweAlgorithm, cek, key, iv, new Uint8Array(0));
  return {
    encryptedKey: wrapped.ciphertext,
    iv: encode5(wrapped.iv),
    tag: encode5(wrapped.tag)
  };
}
async function unwrap2(alg, key, encryptedKey, iv, tag2) {
  const jweAlgorithm = alg.slice(0, 7);
  return decrypt_default(jweAlgorithm, key, encryptedKey, iv, tag2, new Uint8Array(0));
}
var init_aesgcmkw = __esm({
  "node_modules/jose/dist/browser/lib/aesgcmkw.js"() {
    init_encrypt();
    init_decrypt();
    init_base64url();
  }
});

// node_modules/jose/dist/browser/lib/decrypt_key_management.js
async function decryptKeyManagement(alg, key, encryptedKey, joseHeader, options) {
  check_key_type_default(alg, key, "decrypt");
  key = await normalize_key_default.normalizePrivateKey?.(key, alg) || key;
  switch (alg) {
    case "dir": {
      if (encryptedKey !== void 0)
        throw new JWEInvalid("Encountered unexpected JWE Encrypted Key");
      return key;
    }
    case "ECDH-ES":
      if (encryptedKey !== void 0)
        throw new JWEInvalid("Encountered unexpected JWE Encrypted Key");
    case "ECDH-ES+A128KW":
    case "ECDH-ES+A192KW":
    case "ECDH-ES+A256KW": {
      if (!isObject(joseHeader.epk))
        throw new JWEInvalid(`JOSE Header "epk" (Ephemeral Public Key) missing or invalid`);
      if (!ecdhAllowed(key))
        throw new JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");
      const epk = await importJWK(joseHeader.epk, alg);
      let partyUInfo;
      let partyVInfo;
      if (joseHeader.apu !== void 0) {
        if (typeof joseHeader.apu !== "string")
          throw new JWEInvalid(`JOSE Header "apu" (Agreement PartyUInfo) invalid`);
        try {
          partyUInfo = decode6(joseHeader.apu);
        } catch {
          throw new JWEInvalid("Failed to base64url decode the apu");
        }
      }
      if (joseHeader.apv !== void 0) {
        if (typeof joseHeader.apv !== "string")
          throw new JWEInvalid(`JOSE Header "apv" (Agreement PartyVInfo) invalid`);
        try {
          partyVInfo = decode6(joseHeader.apv);
        } catch {
          throw new JWEInvalid("Failed to base64url decode the apv");
        }
      }
      const sharedSecret = await deriveKey(epk, key, alg === "ECDH-ES" ? joseHeader.enc : alg, alg === "ECDH-ES" ? bitLength2(joseHeader.enc) : parseInt(alg.slice(-5, -2), 10), partyUInfo, partyVInfo);
      if (alg === "ECDH-ES")
        return sharedSecret;
      if (encryptedKey === void 0)
        throw new JWEInvalid("JWE Encrypted Key missing");
      return unwrap(alg.slice(-6), sharedSecret, encryptedKey);
    }
    case "RSA1_5":
    case "RSA-OAEP":
    case "RSA-OAEP-256":
    case "RSA-OAEP-384":
    case "RSA-OAEP-512": {
      if (encryptedKey === void 0)
        throw new JWEInvalid("JWE Encrypted Key missing");
      return decrypt3(alg, key, encryptedKey);
    }
    case "PBES2-HS256+A128KW":
    case "PBES2-HS384+A192KW":
    case "PBES2-HS512+A256KW": {
      if (encryptedKey === void 0)
        throw new JWEInvalid("JWE Encrypted Key missing");
      if (typeof joseHeader.p2c !== "number")
        throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) missing or invalid`);
      const p2cLimit = options?.maxPBES2Count || 1e4;
      if (joseHeader.p2c > p2cLimit)
        throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`);
      if (typeof joseHeader.p2s !== "string")
        throw new JWEInvalid(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`);
      let p2s2;
      try {
        p2s2 = decode6(joseHeader.p2s);
      } catch {
        throw new JWEInvalid("Failed to base64url decode the p2s");
      }
      return decrypt2(alg, key, encryptedKey, joseHeader.p2c, p2s2);
    }
    case "A128KW":
    case "A192KW":
    case "A256KW": {
      if (encryptedKey === void 0)
        throw new JWEInvalid("JWE Encrypted Key missing");
      return unwrap(alg, key, encryptedKey);
    }
    case "A128GCMKW":
    case "A192GCMKW":
    case "A256GCMKW": {
      if (encryptedKey === void 0)
        throw new JWEInvalid("JWE Encrypted Key missing");
      if (typeof joseHeader.iv !== "string")
        throw new JWEInvalid(`JOSE Header "iv" (Initialization Vector) missing or invalid`);
      if (typeof joseHeader.tag !== "string")
        throw new JWEInvalid(`JOSE Header "tag" (Authentication Tag) missing or invalid`);
      let iv;
      try {
        iv = decode6(joseHeader.iv);
      } catch {
        throw new JWEInvalid("Failed to base64url decode the iv");
      }
      let tag2;
      try {
        tag2 = decode6(joseHeader.tag);
      } catch {
        throw new JWEInvalid("Failed to base64url decode the tag");
      }
      return unwrap2(alg, key, encryptedKey, iv, tag2);
    }
    default: {
      throw new JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value');
    }
  }
}
var decrypt_key_management_default;
var init_decrypt_key_management = __esm({
  "node_modules/jose/dist/browser/lib/decrypt_key_management.js"() {
    init_aeskw();
    init_ecdhes();
    init_pbes2kw();
    init_rsaes();
    init_base64url();
    init_normalize_key();
    init_errors();
    init_cek();
    init_import();
    init_check_key_type();
    init_is_object();
    init_aesgcmkw();
    decrypt_key_management_default = decryptKeyManagement;
  }
});

// node_modules/jose/dist/browser/lib/validate_crit.js
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
  if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
    throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
  }
  if (!protectedHeader || protectedHeader.crit === void 0) {
    return /* @__PURE__ */ new Set();
  }
  if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
    throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
  }
  let recognized;
  if (recognizedOption !== void 0) {
    recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
  } else {
    recognized = recognizedDefault;
  }
  for (const parameter of protectedHeader.crit) {
    if (!recognized.has(parameter)) {
      throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
    }
    if (joseHeader[parameter] === void 0) {
      throw new Err(`Extension Header Parameter "${parameter}" is missing`);
    }
    if (recognized.get(parameter) && protectedHeader[parameter] === void 0) {
      throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
    }
  }
  return new Set(protectedHeader.crit);
}
var validate_crit_default;
var init_validate_crit = __esm({
  "node_modules/jose/dist/browser/lib/validate_crit.js"() {
    init_errors();
    validate_crit_default = validateCrit;
  }
});

// node_modules/jose/dist/browser/lib/validate_algorithms.js
var validateAlgorithms, validate_algorithms_default;
var init_validate_algorithms = __esm({
  "node_modules/jose/dist/browser/lib/validate_algorithms.js"() {
    validateAlgorithms = (option, algorithms) => {
      if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
        throw new TypeError(`"${option}" option must be an array of strings`);
      }
      if (!algorithms) {
        return void 0;
      }
      return new Set(algorithms);
    };
    validate_algorithms_default = validateAlgorithms;
  }
});

// node_modules/jose/dist/browser/jwe/flattened/decrypt.js
async function flattenedDecrypt(jwe, key, options) {
  if (!isObject(jwe)) {
    throw new JWEInvalid("Flattened JWE must be an object");
  }
  if (jwe.protected === void 0 && jwe.header === void 0 && jwe.unprotected === void 0) {
    throw new JWEInvalid("JOSE Header missing");
  }
  if (jwe.iv !== void 0 && typeof jwe.iv !== "string") {
    throw new JWEInvalid("JWE Initialization Vector incorrect type");
  }
  if (typeof jwe.ciphertext !== "string") {
    throw new JWEInvalid("JWE Ciphertext missing or incorrect type");
  }
  if (jwe.tag !== void 0 && typeof jwe.tag !== "string") {
    throw new JWEInvalid("JWE Authentication Tag incorrect type");
  }
  if (jwe.protected !== void 0 && typeof jwe.protected !== "string") {
    throw new JWEInvalid("JWE Protected Header incorrect type");
  }
  if (jwe.encrypted_key !== void 0 && typeof jwe.encrypted_key !== "string") {
    throw new JWEInvalid("JWE Encrypted Key incorrect type");
  }
  if (jwe.aad !== void 0 && typeof jwe.aad !== "string") {
    throw new JWEInvalid("JWE AAD incorrect type");
  }
  if (jwe.header !== void 0 && !isObject(jwe.header)) {
    throw new JWEInvalid("JWE Shared Unprotected Header incorrect type");
  }
  if (jwe.unprotected !== void 0 && !isObject(jwe.unprotected)) {
    throw new JWEInvalid("JWE Per-Recipient Unprotected Header incorrect type");
  }
  let parsedProt;
  if (jwe.protected) {
    try {
      const protectedHeader2 = decode6(jwe.protected);
      parsedProt = JSON.parse(decoder.decode(protectedHeader2));
    } catch {
      throw new JWEInvalid("JWE Protected Header is invalid");
    }
  }
  if (!is_disjoint_default(parsedProt, jwe.header, jwe.unprotected)) {
    throw new JWEInvalid("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");
  }
  const joseHeader = {
    ...parsedProt,
    ...jwe.header,
    ...jwe.unprotected
  };
  validate_crit_default(JWEInvalid, /* @__PURE__ */ new Map(), options?.crit, parsedProt, joseHeader);
  if (joseHeader.zip !== void 0) {
    throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');
  }
  const { alg, enc } = joseHeader;
  if (typeof alg !== "string" || !alg) {
    throw new JWEInvalid("missing JWE Algorithm (alg) in JWE Header");
  }
  if (typeof enc !== "string" || !enc) {
    throw new JWEInvalid("missing JWE Encryption Algorithm (enc) in JWE Header");
  }
  const keyManagementAlgorithms = options && validate_algorithms_default("keyManagementAlgorithms", options.keyManagementAlgorithms);
  const contentEncryptionAlgorithms = options && validate_algorithms_default("contentEncryptionAlgorithms", options.contentEncryptionAlgorithms);
  if (keyManagementAlgorithms && !keyManagementAlgorithms.has(alg) || !keyManagementAlgorithms && alg.startsWith("PBES2")) {
    throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');
  }
  if (contentEncryptionAlgorithms && !contentEncryptionAlgorithms.has(enc)) {
    throw new JOSEAlgNotAllowed('"enc" (Encryption Algorithm) Header Parameter value not allowed');
  }
  let encryptedKey;
  if (jwe.encrypted_key !== void 0) {
    try {
      encryptedKey = decode6(jwe.encrypted_key);
    } catch {
      throw new JWEInvalid("Failed to base64url decode the encrypted_key");
    }
  }
  let resolvedKey = false;
  if (typeof key === "function") {
    key = await key(parsedProt, jwe);
    resolvedKey = true;
  }
  let cek;
  try {
    cek = await decrypt_key_management_default(alg, key, encryptedKey, joseHeader, options);
  } catch (err) {
    if (err instanceof TypeError || err instanceof JWEInvalid || err instanceof JOSENotSupported) {
      throw err;
    }
    cek = cek_default(enc);
  }
  let iv;
  let tag2;
  if (jwe.iv !== void 0) {
    try {
      iv = decode6(jwe.iv);
    } catch {
      throw new JWEInvalid("Failed to base64url decode the iv");
    }
  }
  if (jwe.tag !== void 0) {
    try {
      tag2 = decode6(jwe.tag);
    } catch {
      throw new JWEInvalid("Failed to base64url decode the tag");
    }
  }
  const protectedHeader = encoder.encode(jwe.protected ?? "");
  let additionalData;
  if (jwe.aad !== void 0) {
    additionalData = concat(protectedHeader, encoder.encode("."), encoder.encode(jwe.aad));
  } else {
    additionalData = protectedHeader;
  }
  let ciphertext;
  try {
    ciphertext = decode6(jwe.ciphertext);
  } catch {
    throw new JWEInvalid("Failed to base64url decode the ciphertext");
  }
  const plaintext = await decrypt_default(enc, cek, ciphertext, iv, tag2, additionalData);
  const result = { plaintext };
  if (jwe.protected !== void 0) {
    result.protectedHeader = parsedProt;
  }
  if (jwe.aad !== void 0) {
    try {
      result.additionalAuthenticatedData = decode6(jwe.aad);
    } catch {
      throw new JWEInvalid("Failed to base64url decode the aad");
    }
  }
  if (jwe.unprotected !== void 0) {
    result.sharedUnprotectedHeader = jwe.unprotected;
  }
  if (jwe.header !== void 0) {
    result.unprotectedHeader = jwe.header;
  }
  if (resolvedKey) {
    return { ...result, key };
  }
  return result;
}
var init_decrypt2 = __esm({
  "node_modules/jose/dist/browser/jwe/flattened/decrypt.js"() {
    init_base64url();
    init_decrypt();
    init_errors();
    init_is_disjoint();
    init_is_object();
    init_decrypt_key_management();
    init_buffer_utils();
    init_cek();
    init_validate_crit();
    init_validate_algorithms();
  }
});

// node_modules/jose/dist/browser/jwe/compact/decrypt.js
async function compactDecrypt(jwe, key, options) {
  if (jwe instanceof Uint8Array) {
    jwe = decoder.decode(jwe);
  }
  if (typeof jwe !== "string") {
    throw new JWEInvalid("Compact JWE must be a string or Uint8Array");
  }
  const { 0: protectedHeader, 1: encryptedKey, 2: iv, 3: ciphertext, 4: tag2, length: length2 } = jwe.split(".");
  if (length2 !== 5) {
    throw new JWEInvalid("Invalid Compact JWE");
  }
  const decrypted = await flattenedDecrypt({
    ciphertext,
    iv: iv || void 0,
    protected: protectedHeader,
    tag: tag2 || void 0,
    encrypted_key: encryptedKey || void 0
  }, key, options);
  const result = { plaintext: decrypted.plaintext, protectedHeader: decrypted.protectedHeader };
  if (typeof key === "function") {
    return { ...result, key: decrypted.key };
  }
  return result;
}
var init_decrypt3 = __esm({
  "node_modules/jose/dist/browser/jwe/compact/decrypt.js"() {
    init_decrypt2();
    init_errors();
    init_buffer_utils();
  }
});

// node_modules/jose/dist/browser/jwe/general/decrypt.js
async function generalDecrypt(jwe, key, options) {
  if (!isObject(jwe)) {
    throw new JWEInvalid("General JWE must be an object");
  }
  if (!Array.isArray(jwe.recipients) || !jwe.recipients.every(isObject)) {
    throw new JWEInvalid("JWE Recipients missing or incorrect type");
  }
  if (!jwe.recipients.length) {
    throw new JWEInvalid("JWE Recipients has no members");
  }
  for (const recipient of jwe.recipients) {
    try {
      return await flattenedDecrypt({
        aad: jwe.aad,
        ciphertext: jwe.ciphertext,
        encrypted_key: recipient.encrypted_key,
        header: recipient.header,
        iv: jwe.iv,
        protected: jwe.protected,
        tag: jwe.tag,
        unprotected: jwe.unprotected
      }, key, options);
    } catch {
    }
  }
  throw new JWEDecryptionFailed();
}
var init_decrypt4 = __esm({
  "node_modules/jose/dist/browser/jwe/general/decrypt.js"() {
    init_decrypt2();
    init_errors();
    init_is_object();
  }
});

// node_modules/jose/dist/browser/lib/private_symbols.js
var unprotected;
var init_private_symbols = __esm({
  "node_modules/jose/dist/browser/lib/private_symbols.js"() {
    unprotected = Symbol();
  }
});

// node_modules/jose/dist/browser/runtime/key_to_jwk.js
var keyToJWK, key_to_jwk_default;
var init_key_to_jwk = __esm({
  "node_modules/jose/dist/browser/runtime/key_to_jwk.js"() {
    init_webcrypto();
    init_invalid_key_input();
    init_base64url();
    init_is_key_like();
    keyToJWK = async (key) => {
      if (key instanceof Uint8Array) {
        return {
          kty: "oct",
          k: encode5(key)
        };
      }
      if (!isCryptoKey(key)) {
        throw new TypeError(invalid_key_input_default(key, ...types, "Uint8Array"));
      }
      if (!key.extractable) {
        throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");
      }
      const { ext, key_ops, alg, use, ...jwk } = await webcrypto_default.subtle.exportKey("jwk", key);
      return jwk;
    };
    key_to_jwk_default = keyToJWK;
  }
});

// node_modules/jose/dist/browser/key/export.js
async function exportSPKI(key) {
  return toSPKI(key);
}
async function exportPKCS8(key) {
  return toPKCS8(key);
}
async function exportJWK(key) {
  return key_to_jwk_default(key);
}
var init_export = __esm({
  "node_modules/jose/dist/browser/key/export.js"() {
    init_asn1();
    init_asn1();
    init_key_to_jwk();
  }
});

// node_modules/jose/dist/browser/lib/encrypt_key_management.js
async function encryptKeyManagement(alg, enc, key, providedCek, providedParameters = {}) {
  let encryptedKey;
  let parameters;
  let cek;
  check_key_type_default(alg, key, "encrypt");
  key = await normalize_key_default.normalizePublicKey?.(key, alg) || key;
  switch (alg) {
    case "dir": {
      cek = key;
      break;
    }
    case "ECDH-ES":
    case "ECDH-ES+A128KW":
    case "ECDH-ES+A192KW":
    case "ECDH-ES+A256KW": {
      if (!ecdhAllowed(key)) {
        throw new JOSENotSupported("ECDH with the provided key is not allowed or not supported by your javascript runtime");
      }
      const { apu, apv } = providedParameters;
      let { epk: ephemeralKey } = providedParameters;
      ephemeralKey || (ephemeralKey = (await generateEpk(key)).privateKey);
      const { x, y, crv, kty } = await exportJWK(ephemeralKey);
      const sharedSecret = await deriveKey(key, ephemeralKey, alg === "ECDH-ES" ? enc : alg, alg === "ECDH-ES" ? bitLength2(enc) : parseInt(alg.slice(-5, -2), 10), apu, apv);
      parameters = { epk: { x, crv, kty } };
      if (kty === "EC")
        parameters.epk.y = y;
      if (apu)
        parameters.apu = encode5(apu);
      if (apv)
        parameters.apv = encode5(apv);
      if (alg === "ECDH-ES") {
        cek = sharedSecret;
        break;
      }
      cek = providedCek || cek_default(enc);
      const kwAlg = alg.slice(-6);
      encryptedKey = await wrap(kwAlg, sharedSecret, cek);
      break;
    }
    case "RSA1_5":
    case "RSA-OAEP":
    case "RSA-OAEP-256":
    case "RSA-OAEP-384":
    case "RSA-OAEP-512": {
      cek = providedCek || cek_default(enc);
      encryptedKey = await encrypt2(alg, key, cek);
      break;
    }
    case "PBES2-HS256+A128KW":
    case "PBES2-HS384+A192KW":
    case "PBES2-HS512+A256KW": {
      cek = providedCek || cek_default(enc);
      const { p2c, p2s: p2s2 } = providedParameters;
      ({ encryptedKey, ...parameters } = await encrypt(alg, key, cek, p2c, p2s2));
      break;
    }
    case "A128KW":
    case "A192KW":
    case "A256KW": {
      cek = providedCek || cek_default(enc);
      encryptedKey = await wrap(alg, key, cek);
      break;
    }
    case "A128GCMKW":
    case "A192GCMKW":
    case "A256GCMKW": {
      cek = providedCek || cek_default(enc);
      const { iv } = providedParameters;
      ({ encryptedKey, ...parameters } = await wrap2(alg, key, cek, iv));
      break;
    }
    default: {
      throw new JOSENotSupported('Invalid or unsupported "alg" (JWE Algorithm) header value');
    }
  }
  return { cek, encryptedKey, parameters };
}
var encrypt_key_management_default;
var init_encrypt_key_management = __esm({
  "node_modules/jose/dist/browser/lib/encrypt_key_management.js"() {
    init_aeskw();
    init_ecdhes();
    init_pbes2kw();
    init_rsaes();
    init_base64url();
    init_normalize_key();
    init_cek();
    init_errors();
    init_export();
    init_check_key_type();
    init_aesgcmkw();
    encrypt_key_management_default = encryptKeyManagement;
  }
});

// node_modules/jose/dist/browser/jwe/flattened/encrypt.js
var FlattenedEncrypt;
var init_encrypt2 = __esm({
  "node_modules/jose/dist/browser/jwe/flattened/encrypt.js"() {
    init_base64url();
    init_private_symbols();
    init_encrypt();
    init_encrypt_key_management();
    init_errors();
    init_is_disjoint();
    init_buffer_utils();
    init_validate_crit();
    FlattenedEncrypt = class {
      constructor(plaintext) {
        if (!(plaintext instanceof Uint8Array)) {
          throw new TypeError("plaintext must be an instance of Uint8Array");
        }
        this._plaintext = plaintext;
      }
      setKeyManagementParameters(parameters) {
        if (this._keyManagementParameters) {
          throw new TypeError("setKeyManagementParameters can only be called once");
        }
        this._keyManagementParameters = parameters;
        return this;
      }
      setProtectedHeader(protectedHeader) {
        if (this._protectedHeader) {
          throw new TypeError("setProtectedHeader can only be called once");
        }
        this._protectedHeader = protectedHeader;
        return this;
      }
      setSharedUnprotectedHeader(sharedUnprotectedHeader) {
        if (this._sharedUnprotectedHeader) {
          throw new TypeError("setSharedUnprotectedHeader can only be called once");
        }
        this._sharedUnprotectedHeader = sharedUnprotectedHeader;
        return this;
      }
      setUnprotectedHeader(unprotectedHeader) {
        if (this._unprotectedHeader) {
          throw new TypeError("setUnprotectedHeader can only be called once");
        }
        this._unprotectedHeader = unprotectedHeader;
        return this;
      }
      setAdditionalAuthenticatedData(aad) {
        this._aad = aad;
        return this;
      }
      setContentEncryptionKey(cek) {
        if (this._cek) {
          throw new TypeError("setContentEncryptionKey can only be called once");
        }
        this._cek = cek;
        return this;
      }
      setInitializationVector(iv) {
        if (this._iv) {
          throw new TypeError("setInitializationVector can only be called once");
        }
        this._iv = iv;
        return this;
      }
      async encrypt(key, options) {
        if (!this._protectedHeader && !this._unprotectedHeader && !this._sharedUnprotectedHeader) {
          throw new JWEInvalid("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");
        }
        if (!is_disjoint_default(this._protectedHeader, this._unprotectedHeader, this._sharedUnprotectedHeader)) {
          throw new JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");
        }
        const joseHeader = {
          ...this._protectedHeader,
          ...this._unprotectedHeader,
          ...this._sharedUnprotectedHeader
        };
        validate_crit_default(JWEInvalid, /* @__PURE__ */ new Map(), options?.crit, this._protectedHeader, joseHeader);
        if (joseHeader.zip !== void 0) {
          throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');
        }
        const { alg, enc } = joseHeader;
        if (typeof alg !== "string" || !alg) {
          throw new JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');
        }
        if (typeof enc !== "string" || !enc) {
          throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');
        }
        let encryptedKey;
        if (this._cek && (alg === "dir" || alg === "ECDH-ES")) {
          throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${alg}`);
        }
        let cek;
        {
          let parameters;
          ({ cek, encryptedKey, parameters } = await encrypt_key_management_default(alg, enc, key, this._cek, this._keyManagementParameters));
          if (parameters) {
            if (options && unprotected in options) {
              if (!this._unprotectedHeader) {
                this.setUnprotectedHeader(parameters);
              } else {
                this._unprotectedHeader = { ...this._unprotectedHeader, ...parameters };
              }
            } else if (!this._protectedHeader) {
              this.setProtectedHeader(parameters);
            } else {
              this._protectedHeader = { ...this._protectedHeader, ...parameters };
            }
          }
        }
        let additionalData;
        let protectedHeader;
        let aadMember;
        if (this._protectedHeader) {
          protectedHeader = encoder.encode(encode5(JSON.stringify(this._protectedHeader)));
        } else {
          protectedHeader = encoder.encode("");
        }
        if (this._aad) {
          aadMember = encode5(this._aad);
          additionalData = concat(protectedHeader, encoder.encode("."), encoder.encode(aadMember));
        } else {
          additionalData = protectedHeader;
        }
        const { ciphertext, tag: tag2, iv } = await encrypt_default(enc, this._plaintext, cek, this._iv, additionalData);
        const jwe = {
          ciphertext: encode5(ciphertext)
        };
        if (iv) {
          jwe.iv = encode5(iv);
        }
        if (tag2) {
          jwe.tag = encode5(tag2);
        }
        if (encryptedKey) {
          jwe.encrypted_key = encode5(encryptedKey);
        }
        if (aadMember) {
          jwe.aad = aadMember;
        }
        if (this._protectedHeader) {
          jwe.protected = decoder.decode(protectedHeader);
        }
        if (this._sharedUnprotectedHeader) {
          jwe.unprotected = this._sharedUnprotectedHeader;
        }
        if (this._unprotectedHeader) {
          jwe.header = this._unprotectedHeader;
        }
        return jwe;
      }
    };
  }
});

// node_modules/jose/dist/browser/jwe/general/encrypt.js
var IndividualRecipient, GeneralEncrypt;
var init_encrypt3 = __esm({
  "node_modules/jose/dist/browser/jwe/general/encrypt.js"() {
    init_encrypt2();
    init_private_symbols();
    init_errors();
    init_cek();
    init_is_disjoint();
    init_encrypt_key_management();
    init_base64url();
    init_validate_crit();
    IndividualRecipient = class {
      constructor(enc, key, options) {
        this.parent = enc;
        this.key = key;
        this.options = options;
      }
      setUnprotectedHeader(unprotectedHeader) {
        if (this.unprotectedHeader) {
          throw new TypeError("setUnprotectedHeader can only be called once");
        }
        this.unprotectedHeader = unprotectedHeader;
        return this;
      }
      addRecipient(...args) {
        return this.parent.addRecipient(...args);
      }
      encrypt(...args) {
        return this.parent.encrypt(...args);
      }
      done() {
        return this.parent;
      }
    };
    GeneralEncrypt = class {
      constructor(plaintext) {
        this._recipients = [];
        this._plaintext = plaintext;
      }
      addRecipient(key, options) {
        const recipient = new IndividualRecipient(this, key, { crit: options?.crit });
        this._recipients.push(recipient);
        return recipient;
      }
      setProtectedHeader(protectedHeader) {
        if (this._protectedHeader) {
          throw new TypeError("setProtectedHeader can only be called once");
        }
        this._protectedHeader = protectedHeader;
        return this;
      }
      setSharedUnprotectedHeader(sharedUnprotectedHeader) {
        if (this._unprotectedHeader) {
          throw new TypeError("setSharedUnprotectedHeader can only be called once");
        }
        this._unprotectedHeader = sharedUnprotectedHeader;
        return this;
      }
      setAdditionalAuthenticatedData(aad) {
        this._aad = aad;
        return this;
      }
      async encrypt() {
        if (!this._recipients.length) {
          throw new JWEInvalid("at least one recipient must be added");
        }
        if (this._recipients.length === 1) {
          const [recipient] = this._recipients;
          const flattened = await new FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(recipient.unprotectedHeader).encrypt(recipient.key, { ...recipient.options });
          const jwe2 = {
            ciphertext: flattened.ciphertext,
            iv: flattened.iv,
            recipients: [{}],
            tag: flattened.tag
          };
          if (flattened.aad)
            jwe2.aad = flattened.aad;
          if (flattened.protected)
            jwe2.protected = flattened.protected;
          if (flattened.unprotected)
            jwe2.unprotected = flattened.unprotected;
          if (flattened.encrypted_key)
            jwe2.recipients[0].encrypted_key = flattened.encrypted_key;
          if (flattened.header)
            jwe2.recipients[0].header = flattened.header;
          return jwe2;
        }
        let enc;
        for (let i = 0; i < this._recipients.length; i++) {
          const recipient = this._recipients[i];
          if (!is_disjoint_default(this._protectedHeader, this._unprotectedHeader, recipient.unprotectedHeader)) {
            throw new JWEInvalid("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");
          }
          const joseHeader = {
            ...this._protectedHeader,
            ...this._unprotectedHeader,
            ...recipient.unprotectedHeader
          };
          const { alg } = joseHeader;
          if (typeof alg !== "string" || !alg) {
            throw new JWEInvalid('JWE "alg" (Algorithm) Header Parameter missing or invalid');
          }
          if (alg === "dir" || alg === "ECDH-ES") {
            throw new JWEInvalid('"dir" and "ECDH-ES" alg may only be used with a single recipient');
          }
          if (typeof joseHeader.enc !== "string" || !joseHeader.enc) {
            throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');
          }
          if (!enc) {
            enc = joseHeader.enc;
          } else if (enc !== joseHeader.enc) {
            throw new JWEInvalid('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients');
          }
          validate_crit_default(JWEInvalid, /* @__PURE__ */ new Map(), recipient.options.crit, this._protectedHeader, joseHeader);
          if (joseHeader.zip !== void 0) {
            throw new JOSENotSupported('JWE "zip" (Compression Algorithm) Header Parameter is not supported.');
          }
        }
        const cek = cek_default(enc);
        const jwe = {
          ciphertext: "",
          iv: "",
          recipients: [],
          tag: ""
        };
        for (let i = 0; i < this._recipients.length; i++) {
          const recipient = this._recipients[i];
          const target = {};
          jwe.recipients.push(target);
          const joseHeader = {
            ...this._protectedHeader,
            ...this._unprotectedHeader,
            ...recipient.unprotectedHeader
          };
          const p2c = joseHeader.alg.startsWith("PBES2") ? 2048 + i : void 0;
          if (i === 0) {
            const flattened = await new FlattenedEncrypt(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(cek).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(recipient.unprotectedHeader).setKeyManagementParameters({ p2c }).encrypt(recipient.key, {
              ...recipient.options,
              [unprotected]: true
            });
            jwe.ciphertext = flattened.ciphertext;
            jwe.iv = flattened.iv;
            jwe.tag = flattened.tag;
            if (flattened.aad)
              jwe.aad = flattened.aad;
            if (flattened.protected)
              jwe.protected = flattened.protected;
            if (flattened.unprotected)
              jwe.unprotected = flattened.unprotected;
            target.encrypted_key = flattened.encrypted_key;
            if (flattened.header)
              target.header = flattened.header;
            continue;
          }
          const { encryptedKey, parameters } = await encrypt_key_management_default(recipient.unprotectedHeader?.alg || this._protectedHeader?.alg || this._unprotectedHeader?.alg, enc, recipient.key, cek, { p2c });
          target.encrypted_key = encode5(encryptedKey);
          if (recipient.unprotectedHeader || parameters)
            target.header = { ...recipient.unprotectedHeader, ...parameters };
        }
        return jwe;
      }
    };
  }
});

// node_modules/jose/dist/browser/runtime/subtle_dsa.js
function subtleDsa(alg, algorithm) {
  const hash = `SHA-${alg.slice(-3)}`;
  switch (alg) {
    case "HS256":
    case "HS384":
    case "HS512":
      return { hash, name: "HMAC" };
    case "PS256":
    case "PS384":
    case "PS512":
      return { hash, name: "RSA-PSS", saltLength: alg.slice(-3) >> 3 };
    case "RS256":
    case "RS384":
    case "RS512":
      return { hash, name: "RSASSA-PKCS1-v1_5" };
    case "ES256":
    case "ES384":
    case "ES512":
      return { hash, name: "ECDSA", namedCurve: algorithm.namedCurve };
    case "Ed25519":
      return { name: "Ed25519" };
    case "EdDSA":
      return { name: algorithm.name };
    default:
      throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
  }
}
var init_subtle_dsa = __esm({
  "node_modules/jose/dist/browser/runtime/subtle_dsa.js"() {
    init_errors();
  }
});

// node_modules/jose/dist/browser/runtime/get_sign_verify_key.js
async function getCryptoKey3(alg, key, usage) {
  if (usage === "sign") {
    key = await normalize_key_default.normalizePrivateKey(key, alg);
  }
  if (usage === "verify") {
    key = await normalize_key_default.normalizePublicKey(key, alg);
  }
  if (isCryptoKey(key)) {
    checkSigCryptoKey(key, alg, usage);
    return key;
  }
  if (key instanceof Uint8Array) {
    if (!alg.startsWith("HS")) {
      throw new TypeError(invalid_key_input_default(key, ...types));
    }
    return webcrypto_default.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
  }
  throw new TypeError(invalid_key_input_default(key, ...types, "Uint8Array", "JSON Web Key"));
}
var init_get_sign_verify_key = __esm({
  "node_modules/jose/dist/browser/runtime/get_sign_verify_key.js"() {
    init_webcrypto();
    init_crypto_key();
    init_invalid_key_input();
    init_is_key_like();
    init_normalize_key();
  }
});

// node_modules/jose/dist/browser/runtime/verify.js
var verify, verify_default;
var init_verify = __esm({
  "node_modules/jose/dist/browser/runtime/verify.js"() {
    init_subtle_dsa();
    init_webcrypto();
    init_check_key_length();
    init_get_sign_verify_key();
    verify = async (alg, key, signature, data) => {
      const cryptoKey = await getCryptoKey3(alg, key, "verify");
      check_key_length_default(alg, cryptoKey);
      const algorithm = subtleDsa(alg, cryptoKey.algorithm);
      try {
        return await webcrypto_default.subtle.verify(algorithm, cryptoKey, signature, data);
      } catch {
        return false;
      }
    };
    verify_default = verify;
  }
});

// node_modules/jose/dist/browser/jws/flattened/verify.js
async function flattenedVerify(jws, key, options) {
  if (!isObject(jws)) {
    throw new JWSInvalid("Flattened JWS must be an object");
  }
  if (jws.protected === void 0 && jws.header === void 0) {
    throw new JWSInvalid('Flattened JWS must have either of the "protected" or "header" members');
  }
  if (jws.protected !== void 0 && typeof jws.protected !== "string") {
    throw new JWSInvalid("JWS Protected Header incorrect type");
  }
  if (jws.payload === void 0) {
    throw new JWSInvalid("JWS Payload missing");
  }
  if (typeof jws.signature !== "string") {
    throw new JWSInvalid("JWS Signature missing or incorrect type");
  }
  if (jws.header !== void 0 && !isObject(jws.header)) {
    throw new JWSInvalid("JWS Unprotected Header incorrect type");
  }
  let parsedProt = {};
  if (jws.protected) {
    try {
      const protectedHeader = decode6(jws.protected);
      parsedProt = JSON.parse(decoder.decode(protectedHeader));
    } catch {
      throw new JWSInvalid("JWS Protected Header is invalid");
    }
  }
  if (!is_disjoint_default(parsedProt, jws.header)) {
    throw new JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
  }
  const joseHeader = {
    ...parsedProt,
    ...jws.header
  };
  const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, parsedProt, joseHeader);
  let b64 = true;
  if (extensions.has("b64")) {
    b64 = parsedProt.b64;
    if (typeof b64 !== "boolean") {
      throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
    }
  }
  const { alg } = joseHeader;
  if (typeof alg !== "string" || !alg) {
    throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
  }
  const algorithms = options && validate_algorithms_default("algorithms", options.algorithms);
  if (algorithms && !algorithms.has(alg)) {
    throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');
  }
  if (b64) {
    if (typeof jws.payload !== "string") {
      throw new JWSInvalid("JWS Payload must be a string");
    }
  } else if (typeof jws.payload !== "string" && !(jws.payload instanceof Uint8Array)) {
    throw new JWSInvalid("JWS Payload must be a string or an Uint8Array instance");
  }
  let resolvedKey = false;
  if (typeof key === "function") {
    key = await key(parsedProt, jws);
    resolvedKey = true;
    checkKeyTypeWithJwk(alg, key, "verify");
    if (isJWK(key)) {
      key = await importJWK(key, alg);
    }
  } else {
    checkKeyTypeWithJwk(alg, key, "verify");
  }
  const data = concat(encoder.encode(jws.protected ?? ""), encoder.encode("."), typeof jws.payload === "string" ? encoder.encode(jws.payload) : jws.payload);
  let signature;
  try {
    signature = decode6(jws.signature);
  } catch {
    throw new JWSInvalid("Failed to base64url decode the signature");
  }
  const verified = await verify_default(alg, key, signature, data);
  if (!verified) {
    throw new JWSSignatureVerificationFailed();
  }
  let payload;
  if (b64) {
    try {
      payload = decode6(jws.payload);
    } catch {
      throw new JWSInvalid("Failed to base64url decode the payload");
    }
  } else if (typeof jws.payload === "string") {
    payload = encoder.encode(jws.payload);
  } else {
    payload = jws.payload;
  }
  const result = { payload };
  if (jws.protected !== void 0) {
    result.protectedHeader = parsedProt;
  }
  if (jws.header !== void 0) {
    result.unprotectedHeader = jws.header;
  }
  if (resolvedKey) {
    return { ...result, key };
  }
  return result;
}
var init_verify2 = __esm({
  "node_modules/jose/dist/browser/jws/flattened/verify.js"() {
    init_base64url();
    init_verify();
    init_errors();
    init_buffer_utils();
    init_is_disjoint();
    init_is_object();
    init_check_key_type();
    init_validate_crit();
    init_validate_algorithms();
    init_is_jwk();
    init_import();
  }
});

// node_modules/jose/dist/browser/jws/compact/verify.js
async function compactVerify(jws, key, options) {
  if (jws instanceof Uint8Array) {
    jws = decoder.decode(jws);
  }
  if (typeof jws !== "string") {
    throw new JWSInvalid("Compact JWS must be a string or Uint8Array");
  }
  const { 0: protectedHeader, 1: payload, 2: signature, length: length2 } = jws.split(".");
  if (length2 !== 3) {
    throw new JWSInvalid("Invalid Compact JWS");
  }
  const verified = await flattenedVerify({ payload, protected: protectedHeader, signature }, key, options);
  const result = { payload: verified.payload, protectedHeader: verified.protectedHeader };
  if (typeof key === "function") {
    return { ...result, key: verified.key };
  }
  return result;
}
var init_verify3 = __esm({
  "node_modules/jose/dist/browser/jws/compact/verify.js"() {
    init_verify2();
    init_errors();
    init_buffer_utils();
  }
});

// node_modules/jose/dist/browser/jws/general/verify.js
async function generalVerify(jws, key, options) {
  if (!isObject(jws)) {
    throw new JWSInvalid("General JWS must be an object");
  }
  if (!Array.isArray(jws.signatures) || !jws.signatures.every(isObject)) {
    throw new JWSInvalid("JWS Signatures missing or incorrect type");
  }
  for (const signature of jws.signatures) {
    try {
      return await flattenedVerify({
        header: signature.header,
        payload: jws.payload,
        protected: signature.protected,
        signature: signature.signature
      }, key, options);
    } catch {
    }
  }
  throw new JWSSignatureVerificationFailed();
}
var init_verify4 = __esm({
  "node_modules/jose/dist/browser/jws/general/verify.js"() {
    init_verify2();
    init_errors();
    init_is_object();
  }
});

// node_modules/jose/dist/browser/lib/epoch.js
var epoch_default;
var init_epoch = __esm({
  "node_modules/jose/dist/browser/lib/epoch.js"() {
    epoch_default = (date) => Math.floor(date.getTime() / 1e3);
  }
});

// node_modules/jose/dist/browser/lib/secs.js
var minute, hour, day, week, year, REGEX, secs_default;
var init_secs = __esm({
  "node_modules/jose/dist/browser/lib/secs.js"() {
    minute = 60;
    hour = minute * 60;
    day = hour * 24;
    week = day * 7;
    year = day * 365.25;
    REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
    secs_default = (str) => {
      const matched = REGEX.exec(str);
      if (!matched || matched[4] && matched[1]) {
        throw new TypeError("Invalid time period format");
      }
      const value = parseFloat(matched[2]);
      const unit = matched[3].toLowerCase();
      let numericDate;
      switch (unit) {
        case "sec":
        case "secs":
        case "second":
        case "seconds":
        case "s":
          numericDate = Math.round(value);
          break;
        case "minute":
        case "minutes":
        case "min":
        case "mins":
        case "m":
          numericDate = Math.round(value * minute);
          break;
        case "hour":
        case "hours":
        case "hr":
        case "hrs":
        case "h":
          numericDate = Math.round(value * hour);
          break;
        case "day":
        case "days":
        case "d":
          numericDate = Math.round(value * day);
          break;
        case "week":
        case "weeks":
        case "w":
          numericDate = Math.round(value * week);
          break;
        default:
          numericDate = Math.round(value * year);
          break;
      }
      if (matched[1] === "-" || matched[4] === "ago") {
        return -numericDate;
      }
      return numericDate;
    };
  }
});

// node_modules/jose/dist/browser/lib/jwt_claims_set.js
var normalizeTyp, checkAudiencePresence, jwt_claims_set_default;
var init_jwt_claims_set = __esm({
  "node_modules/jose/dist/browser/lib/jwt_claims_set.js"() {
    init_errors();
    init_buffer_utils();
    init_epoch();
    init_secs();
    init_is_object();
    normalizeTyp = (value) => value.toLowerCase().replace(/^application\//, "");
    checkAudiencePresence = (audPayload, audOption) => {
      if (typeof audPayload === "string") {
        return audOption.includes(audPayload);
      }
      if (Array.isArray(audPayload)) {
        return audOption.some(Set.prototype.has.bind(new Set(audPayload)));
      }
      return false;
    };
    jwt_claims_set_default = (protectedHeader, encodedPayload, options = {}) => {
      let payload;
      try {
        payload = JSON.parse(decoder.decode(encodedPayload));
      } catch {
      }
      if (!isObject(payload)) {
        throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
      }
      const { typ } = options;
      if (typ && (typeof protectedHeader.typ !== "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
        throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload, "typ", "check_failed");
      }
      const { requiredClaims = [], issuer, subject, audience, maxTokenAge } = options;
      const presenceCheck = [...requiredClaims];
      if (maxTokenAge !== void 0)
        presenceCheck.push("iat");
      if (audience !== void 0)
        presenceCheck.push("aud");
      if (subject !== void 0)
        presenceCheck.push("sub");
      if (issuer !== void 0)
        presenceCheck.push("iss");
      for (const claim of new Set(presenceCheck.reverse())) {
        if (!(claim in payload)) {
          throw new JWTClaimValidationFailed(`missing required "${claim}" claim`, payload, claim, "missing");
        }
      }
      if (issuer && !(Array.isArray(issuer) ? issuer : [issuer]).includes(payload.iss)) {
        throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload, "iss", "check_failed");
      }
      if (subject && payload.sub !== subject) {
        throw new JWTClaimValidationFailed('unexpected "sub" claim value', payload, "sub", "check_failed");
      }
      if (audience && !checkAudiencePresence(payload.aud, typeof audience === "string" ? [audience] : audience)) {
        throw new JWTClaimValidationFailed('unexpected "aud" claim value', payload, "aud", "check_failed");
      }
      let tolerance;
      switch (typeof options.clockTolerance) {
        case "string":
          tolerance = secs_default(options.clockTolerance);
          break;
        case "number":
          tolerance = options.clockTolerance;
          break;
        case "undefined":
          tolerance = 0;
          break;
        default:
          throw new TypeError("Invalid clockTolerance option type");
      }
      const { currentDate } = options;
      const now = epoch_default(currentDate || /* @__PURE__ */ new Date());
      if ((payload.iat !== void 0 || maxTokenAge) && typeof payload.iat !== "number") {
        throw new JWTClaimValidationFailed('"iat" claim must be a number', payload, "iat", "invalid");
      }
      if (payload.nbf !== void 0) {
        if (typeof payload.nbf !== "number") {
          throw new JWTClaimValidationFailed('"nbf" claim must be a number', payload, "nbf", "invalid");
        }
        if (payload.nbf > now + tolerance) {
          throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload, "nbf", "check_failed");
        }
      }
      if (payload.exp !== void 0) {
        if (typeof payload.exp !== "number") {
          throw new JWTClaimValidationFailed('"exp" claim must be a number', payload, "exp", "invalid");
        }
        if (payload.exp <= now - tolerance) {
          throw new JWTExpired('"exp" claim timestamp check failed', payload, "exp", "check_failed");
        }
      }
      if (maxTokenAge) {
        const age = now - payload.iat;
        const max = typeof maxTokenAge === "number" ? maxTokenAge : secs_default(maxTokenAge);
        if (age - tolerance > max) {
          throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload, "iat", "check_failed");
        }
        if (age < 0 - tolerance) {
          throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload, "iat", "check_failed");
        }
      }
      return payload;
    };
  }
});

// node_modules/jose/dist/browser/jwt/verify.js
async function jwtVerify(jwt, key, options) {
  const verified = await compactVerify(jwt, key, options);
  if (verified.protectedHeader.crit?.includes("b64") && verified.protectedHeader.b64 === false) {
    throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
  }
  const payload = jwt_claims_set_default(verified.protectedHeader, verified.payload, options);
  const result = { payload, protectedHeader: verified.protectedHeader };
  if (typeof key === "function") {
    return { ...result, key: verified.key };
  }
  return result;
}
var init_verify5 = __esm({
  "node_modules/jose/dist/browser/jwt/verify.js"() {
    init_verify3();
    init_jwt_claims_set();
    init_errors();
  }
});

// node_modules/jose/dist/browser/jwt/decrypt.js
async function jwtDecrypt(jwt, key, options) {
  const decrypted = await compactDecrypt(jwt, key, options);
  const payload = jwt_claims_set_default(decrypted.protectedHeader, decrypted.plaintext, options);
  const { protectedHeader } = decrypted;
  if (protectedHeader.iss !== void 0 && protectedHeader.iss !== payload.iss) {
    throw new JWTClaimValidationFailed('replicated "iss" claim header parameter mismatch', payload, "iss", "mismatch");
  }
  if (protectedHeader.sub !== void 0 && protectedHeader.sub !== payload.sub) {
    throw new JWTClaimValidationFailed('replicated "sub" claim header parameter mismatch', payload, "sub", "mismatch");
  }
  if (protectedHeader.aud !== void 0 && JSON.stringify(protectedHeader.aud) !== JSON.stringify(payload.aud)) {
    throw new JWTClaimValidationFailed('replicated "aud" claim header parameter mismatch', payload, "aud", "mismatch");
  }
  const result = { payload, protectedHeader };
  if (typeof key === "function") {
    return { ...result, key: decrypted.key };
  }
  return result;
}
var init_decrypt5 = __esm({
  "node_modules/jose/dist/browser/jwt/decrypt.js"() {
    init_decrypt3();
    init_jwt_claims_set();
    init_errors();
  }
});

// node_modules/jose/dist/browser/jwe/compact/encrypt.js
var CompactEncrypt;
var init_encrypt4 = __esm({
  "node_modules/jose/dist/browser/jwe/compact/encrypt.js"() {
    init_encrypt2();
    CompactEncrypt = class {
      constructor(plaintext) {
        this._flattened = new FlattenedEncrypt(plaintext);
      }
      setContentEncryptionKey(cek) {
        this._flattened.setContentEncryptionKey(cek);
        return this;
      }
      setInitializationVector(iv) {
        this._flattened.setInitializationVector(iv);
        return this;
      }
      setProtectedHeader(protectedHeader) {
        this._flattened.setProtectedHeader(protectedHeader);
        return this;
      }
      setKeyManagementParameters(parameters) {
        this._flattened.setKeyManagementParameters(parameters);
        return this;
      }
      async encrypt(key, options) {
        const jwe = await this._flattened.encrypt(key, options);
        return [jwe.protected, jwe.encrypted_key, jwe.iv, jwe.ciphertext, jwe.tag].join(".");
      }
    };
  }
});

// node_modules/jose/dist/browser/runtime/sign.js
var sign, sign_default;
var init_sign = __esm({
  "node_modules/jose/dist/browser/runtime/sign.js"() {
    init_subtle_dsa();
    init_webcrypto();
    init_check_key_length();
    init_get_sign_verify_key();
    sign = async (alg, key, data) => {
      const cryptoKey = await getCryptoKey3(alg, key, "sign");
      check_key_length_default(alg, cryptoKey);
      const signature = await webcrypto_default.subtle.sign(subtleDsa(alg, cryptoKey.algorithm), cryptoKey, data);
      return new Uint8Array(signature);
    };
    sign_default = sign;
  }
});

// node_modules/jose/dist/browser/jws/flattened/sign.js
var FlattenedSign;
var init_sign2 = __esm({
  "node_modules/jose/dist/browser/jws/flattened/sign.js"() {
    init_base64url();
    init_sign();
    init_is_disjoint();
    init_errors();
    init_buffer_utils();
    init_check_key_type();
    init_validate_crit();
    FlattenedSign = class {
      constructor(payload) {
        if (!(payload instanceof Uint8Array)) {
          throw new TypeError("payload must be an instance of Uint8Array");
        }
        this._payload = payload;
      }
      setProtectedHeader(protectedHeader) {
        if (this._protectedHeader) {
          throw new TypeError("setProtectedHeader can only be called once");
        }
        this._protectedHeader = protectedHeader;
        return this;
      }
      setUnprotectedHeader(unprotectedHeader) {
        if (this._unprotectedHeader) {
          throw new TypeError("setUnprotectedHeader can only be called once");
        }
        this._unprotectedHeader = unprotectedHeader;
        return this;
      }
      async sign(key, options) {
        if (!this._protectedHeader && !this._unprotectedHeader) {
          throw new JWSInvalid("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");
        }
        if (!is_disjoint_default(this._protectedHeader, this._unprotectedHeader)) {
          throw new JWSInvalid("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
        }
        const joseHeader = {
          ...this._protectedHeader,
          ...this._unprotectedHeader
        };
        const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, this._protectedHeader, joseHeader);
        let b64 = true;
        if (extensions.has("b64")) {
          b64 = this._protectedHeader.b64;
          if (typeof b64 !== "boolean") {
            throw new JWSInvalid('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
          }
        }
        const { alg } = joseHeader;
        if (typeof alg !== "string" || !alg) {
          throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
        }
        checkKeyTypeWithJwk(alg, key, "sign");
        let payload = this._payload;
        if (b64) {
          payload = encoder.encode(encode5(payload));
        }
        let protectedHeader;
        if (this._protectedHeader) {
          protectedHeader = encoder.encode(encode5(JSON.stringify(this._protectedHeader)));
        } else {
          protectedHeader = encoder.encode("");
        }
        const data = concat(protectedHeader, encoder.encode("."), payload);
        const signature = await sign_default(alg, key, data);
        const jws = {
          signature: encode5(signature),
          payload: ""
        };
        if (b64) {
          jws.payload = decoder.decode(payload);
        }
        if (this._unprotectedHeader) {
          jws.header = this._unprotectedHeader;
        }
        if (this._protectedHeader) {
          jws.protected = decoder.decode(protectedHeader);
        }
        return jws;
      }
    };
  }
});

// node_modules/jose/dist/browser/jws/compact/sign.js
var CompactSign;
var init_sign3 = __esm({
  "node_modules/jose/dist/browser/jws/compact/sign.js"() {
    init_sign2();
    CompactSign = class {
      constructor(payload) {
        this._flattened = new FlattenedSign(payload);
      }
      setProtectedHeader(protectedHeader) {
        this._flattened.setProtectedHeader(protectedHeader);
        return this;
      }
      async sign(key, options) {
        const jws = await this._flattened.sign(key, options);
        if (jws.payload === void 0) {
          throw new TypeError("use the flattened module for creating JWS with b64: false");
        }
        return `${jws.protected}.${jws.payload}.${jws.signature}`;
      }
    };
  }
});

// node_modules/jose/dist/browser/jws/general/sign.js
var IndividualSignature, GeneralSign;
var init_sign4 = __esm({
  "node_modules/jose/dist/browser/jws/general/sign.js"() {
    init_sign2();
    init_errors();
    IndividualSignature = class {
      constructor(sig, key, options) {
        this.parent = sig;
        this.key = key;
        this.options = options;
      }
      setProtectedHeader(protectedHeader) {
        if (this.protectedHeader) {
          throw new TypeError("setProtectedHeader can only be called once");
        }
        this.protectedHeader = protectedHeader;
        return this;
      }
      setUnprotectedHeader(unprotectedHeader) {
        if (this.unprotectedHeader) {
          throw new TypeError("setUnprotectedHeader can only be called once");
        }
        this.unprotectedHeader = unprotectedHeader;
        return this;
      }
      addSignature(...args) {
        return this.parent.addSignature(...args);
      }
      sign(...args) {
        return this.parent.sign(...args);
      }
      done() {
        return this.parent;
      }
    };
    GeneralSign = class {
      constructor(payload) {
        this._signatures = [];
        this._payload = payload;
      }
      addSignature(key, options) {
        const signature = new IndividualSignature(this, key, options);
        this._signatures.push(signature);
        return signature;
      }
      async sign() {
        if (!this._signatures.length) {
          throw new JWSInvalid("at least one signature must be added");
        }
        const jws = {
          signatures: [],
          payload: ""
        };
        for (let i = 0; i < this._signatures.length; i++) {
          const signature = this._signatures[i];
          const flattened = new FlattenedSign(this._payload);
          flattened.setProtectedHeader(signature.protectedHeader);
          flattened.setUnprotectedHeader(signature.unprotectedHeader);
          const { payload, ...rest } = await flattened.sign(signature.key, signature.options);
          if (i === 0) {
            jws.payload = payload;
          } else if (jws.payload !== payload) {
            throw new JWSInvalid("inconsistent use of JWS Unencoded Payload (RFC7797)");
          }
          jws.signatures.push(rest);
        }
        return jws;
      }
    };
  }
});

// node_modules/jose/dist/browser/jwt/produce.js
function validateInput(label, input) {
  if (!Number.isFinite(input)) {
    throw new TypeError(`Invalid ${label} input`);
  }
  return input;
}
var ProduceJWT;
var init_produce = __esm({
  "node_modules/jose/dist/browser/jwt/produce.js"() {
    init_epoch();
    init_is_object();
    init_secs();
    ProduceJWT = class {
      constructor(payload = {}) {
        if (!isObject(payload)) {
          throw new TypeError("JWT Claims Set MUST be an object");
        }
        this._payload = payload;
      }
      setIssuer(issuer) {
        this._payload = { ...this._payload, iss: issuer };
        return this;
      }
      setSubject(subject) {
        this._payload = { ...this._payload, sub: subject };
        return this;
      }
      setAudience(audience) {
        this._payload = { ...this._payload, aud: audience };
        return this;
      }
      setJti(jwtId) {
        this._payload = { ...this._payload, jti: jwtId };
        return this;
      }
      setNotBefore(input) {
        if (typeof input === "number") {
          this._payload = { ...this._payload, nbf: validateInput("setNotBefore", input) };
        } else if (input instanceof Date) {
          this._payload = { ...this._payload, nbf: validateInput("setNotBefore", epoch_default(input)) };
        } else {
          this._payload = { ...this._payload, nbf: epoch_default(/* @__PURE__ */ new Date()) + secs_default(input) };
        }
        return this;
      }
      setExpirationTime(input) {
        if (typeof input === "number") {
          this._payload = { ...this._payload, exp: validateInput("setExpirationTime", input) };
        } else if (input instanceof Date) {
          this._payload = { ...this._payload, exp: validateInput("setExpirationTime", epoch_default(input)) };
        } else {
          this._payload = { ...this._payload, exp: epoch_default(/* @__PURE__ */ new Date()) + secs_default(input) };
        }
        return this;
      }
      setIssuedAt(input) {
        if (typeof input === "undefined") {
          this._payload = { ...this._payload, iat: epoch_default(/* @__PURE__ */ new Date()) };
        } else if (input instanceof Date) {
          this._payload = { ...this._payload, iat: validateInput("setIssuedAt", epoch_default(input)) };
        } else if (typeof input === "string") {
          this._payload = {
            ...this._payload,
            iat: validateInput("setIssuedAt", epoch_default(/* @__PURE__ */ new Date()) + secs_default(input))
          };
        } else {
          this._payload = { ...this._payload, iat: validateInput("setIssuedAt", input) };
        }
        return this;
      }
    };
  }
});

// node_modules/jose/dist/browser/jwt/sign.js
var SignJWT;
var init_sign5 = __esm({
  "node_modules/jose/dist/browser/jwt/sign.js"() {
    init_sign3();
    init_errors();
    init_buffer_utils();
    init_produce();
    SignJWT = class extends ProduceJWT {
      setProtectedHeader(protectedHeader) {
        this._protectedHeader = protectedHeader;
        return this;
      }
      async sign(key, options) {
        const sig = new CompactSign(encoder.encode(JSON.stringify(this._payload)));
        sig.setProtectedHeader(this._protectedHeader);
        if (Array.isArray(this._protectedHeader?.crit) && this._protectedHeader.crit.includes("b64") && this._protectedHeader.b64 === false) {
          throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
        }
        return sig.sign(key, options);
      }
    };
  }
});

// node_modules/jose/dist/browser/jwt/encrypt.js
var EncryptJWT;
var init_encrypt5 = __esm({
  "node_modules/jose/dist/browser/jwt/encrypt.js"() {
    init_encrypt4();
    init_buffer_utils();
    init_produce();
    EncryptJWT = class extends ProduceJWT {
      setProtectedHeader(protectedHeader) {
        if (this._protectedHeader) {
          throw new TypeError("setProtectedHeader can only be called once");
        }
        this._protectedHeader = protectedHeader;
        return this;
      }
      setKeyManagementParameters(parameters) {
        if (this._keyManagementParameters) {
          throw new TypeError("setKeyManagementParameters can only be called once");
        }
        this._keyManagementParameters = parameters;
        return this;
      }
      setContentEncryptionKey(cek) {
        if (this._cek) {
          throw new TypeError("setContentEncryptionKey can only be called once");
        }
        this._cek = cek;
        return this;
      }
      setInitializationVector(iv) {
        if (this._iv) {
          throw new TypeError("setInitializationVector can only be called once");
        }
        this._iv = iv;
        return this;
      }
      replicateIssuerAsHeader() {
        this._replicateIssuerAsHeader = true;
        return this;
      }
      replicateSubjectAsHeader() {
        this._replicateSubjectAsHeader = true;
        return this;
      }
      replicateAudienceAsHeader() {
        this._replicateAudienceAsHeader = true;
        return this;
      }
      async encrypt(key, options) {
        const enc = new CompactEncrypt(encoder.encode(JSON.stringify(this._payload)));
        if (this._replicateIssuerAsHeader) {
          this._protectedHeader = { ...this._protectedHeader, iss: this._payload.iss };
        }
        if (this._replicateSubjectAsHeader) {
          this._protectedHeader = { ...this._protectedHeader, sub: this._payload.sub };
        }
        if (this._replicateAudienceAsHeader) {
          this._protectedHeader = { ...this._protectedHeader, aud: this._payload.aud };
        }
        enc.setProtectedHeader(this._protectedHeader);
        if (this._iv) {
          enc.setInitializationVector(this._iv);
        }
        if (this._cek) {
          enc.setContentEncryptionKey(this._cek);
        }
        if (this._keyManagementParameters) {
          enc.setKeyManagementParameters(this._keyManagementParameters);
        }
        return enc.encrypt(key, options);
      }
    };
  }
});

// node_modules/jose/dist/browser/jwk/thumbprint.js
async function calculateJwkThumbprint(jwk, digestAlgorithm) {
  if (!isObject(jwk)) {
    throw new TypeError("JWK must be an object");
  }
  digestAlgorithm ?? (digestAlgorithm = "sha256");
  if (digestAlgorithm !== "sha256" && digestAlgorithm !== "sha384" && digestAlgorithm !== "sha512") {
    throw new TypeError('digestAlgorithm must one of "sha256", "sha384", or "sha512"');
  }
  let components;
  switch (jwk.kty) {
    case "EC":
      check(jwk.crv, '"crv" (Curve) Parameter');
      check(jwk.x, '"x" (X Coordinate) Parameter');
      check(jwk.y, '"y" (Y Coordinate) Parameter');
      components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x, y: jwk.y };
      break;
    case "OKP":
      check(jwk.crv, '"crv" (Subtype of Key Pair) Parameter');
      check(jwk.x, '"x" (Public Key) Parameter');
      components = { crv: jwk.crv, kty: jwk.kty, x: jwk.x };
      break;
    case "RSA":
      check(jwk.e, '"e" (Exponent) Parameter');
      check(jwk.n, '"n" (Modulus) Parameter');
      components = { e: jwk.e, kty: jwk.kty, n: jwk.n };
      break;
    case "oct":
      check(jwk.k, '"k" (Key Value) Parameter');
      components = { k: jwk.k, kty: jwk.kty };
      break;
    default:
      throw new JOSENotSupported('"kty" (Key Type) Parameter missing or unsupported');
  }
  const data = encoder.encode(JSON.stringify(components));
  return encode5(await digest_default(digestAlgorithm, data));
}
async function calculateJwkThumbprintUri(jwk, digestAlgorithm) {
  digestAlgorithm ?? (digestAlgorithm = "sha256");
  const thumbprint = await calculateJwkThumbprint(jwk, digestAlgorithm);
  return `urn:ietf:params:oauth:jwk-thumbprint:sha-${digestAlgorithm.slice(-3)}:${thumbprint}`;
}
var check;
var init_thumbprint = __esm({
  "node_modules/jose/dist/browser/jwk/thumbprint.js"() {
    init_digest2();
    init_base64url();
    init_errors();
    init_buffer_utils();
    init_is_object();
    check = (value, description) => {
      if (typeof value !== "string" || !value) {
        throw new JWKInvalid(`${description} missing or invalid`);
      }
    };
  }
});

// node_modules/jose/dist/browser/jwk/embedded.js
async function EmbeddedJWK(protectedHeader, token) {
  const joseHeader = {
    ...protectedHeader,
    ...token?.header
  };
  if (!isObject(joseHeader.jwk)) {
    throw new JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a JSON object');
  }
  const key = await importJWK({ ...joseHeader.jwk, ext: true }, joseHeader.alg);
  if (key instanceof Uint8Array || key.type !== "public") {
    throw new JWSInvalid('"jwk" (JSON Web Key) Header Parameter must be a public key');
  }
  return key;
}
var init_embedded = __esm({
  "node_modules/jose/dist/browser/jwk/embedded.js"() {
    init_import();
    init_is_object();
    init_errors();
  }
});

// node_modules/jose/dist/browser/jwks/local.js
function getKtyFromAlg(alg) {
  switch (typeof alg === "string" && alg.slice(0, 2)) {
    case "RS":
    case "PS":
      return "RSA";
    case "ES":
      return "EC";
    case "Ed":
      return "OKP";
    default:
      throw new JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set');
  }
}
function isJWKSLike(jwks) {
  return jwks && typeof jwks === "object" && Array.isArray(jwks.keys) && jwks.keys.every(isJWKLike);
}
function isJWKLike(key) {
  return isObject(key);
}
function clone(obj) {
  if (typeof structuredClone === "function") {
    return structuredClone(obj);
  }
  return JSON.parse(JSON.stringify(obj));
}
async function importWithAlgCache(cache, jwk, alg) {
  const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);
  if (cached[alg] === void 0) {
    const key = await importJWK({ ...jwk, ext: true }, alg);
    if (key instanceof Uint8Array || key.type !== "public") {
      throw new JWKSInvalid("JSON Web Key Set members must be public keys");
    }
    cached[alg] = key;
  }
  return cached[alg];
}
function createLocalJWKSet(jwks) {
  const set = new LocalJWKSet(jwks);
  const localJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);
  Object.defineProperties(localJWKSet, {
    jwks: {
      value: () => clone(set._jwks),
      enumerable: true,
      configurable: false,
      writable: false
    }
  });
  return localJWKSet;
}
var LocalJWKSet;
var init_local = __esm({
  "node_modules/jose/dist/browser/jwks/local.js"() {
    init_import();
    init_errors();
    init_is_object();
    LocalJWKSet = class {
      constructor(jwks) {
        this._cached = /* @__PURE__ */ new WeakMap();
        if (!isJWKSLike(jwks)) {
          throw new JWKSInvalid("JSON Web Key Set malformed");
        }
        this._jwks = clone(jwks);
      }
      async getKey(protectedHeader, token) {
        const { alg, kid } = { ...protectedHeader, ...token?.header };
        const kty = getKtyFromAlg(alg);
        const candidates = this._jwks.keys.filter((jwk2) => {
          let candidate = kty === jwk2.kty;
          if (candidate && typeof kid === "string") {
            candidate = kid === jwk2.kid;
          }
          if (candidate && typeof jwk2.alg === "string") {
            candidate = alg === jwk2.alg;
          }
          if (candidate && typeof jwk2.use === "string") {
            candidate = jwk2.use === "sig";
          }
          if (candidate && Array.isArray(jwk2.key_ops)) {
            candidate = jwk2.key_ops.includes("verify");
          }
          if (candidate) {
            switch (alg) {
              case "ES256":
                candidate = jwk2.crv === "P-256";
                break;
              case "ES256K":
                candidate = jwk2.crv === "secp256k1";
                break;
              case "ES384":
                candidate = jwk2.crv === "P-384";
                break;
              case "ES512":
                candidate = jwk2.crv === "P-521";
                break;
              case "Ed25519":
                candidate = jwk2.crv === "Ed25519";
                break;
              case "EdDSA":
                candidate = jwk2.crv === "Ed25519" || jwk2.crv === "Ed448";
                break;
            }
          }
          return candidate;
        });
        const { 0: jwk, length: length2 } = candidates;
        if (length2 === 0) {
          throw new JWKSNoMatchingKey();
        }
        if (length2 !== 1) {
          const error = new JWKSMultipleMatchingKeys();
          const { _cached } = this;
          error[Symbol.asyncIterator] = async function* () {
            for (const jwk2 of candidates) {
              try {
                yield await importWithAlgCache(_cached, jwk2, alg);
              } catch {
              }
            }
          };
          throw error;
        }
        return importWithAlgCache(this._cached, jwk, alg);
      }
    };
  }
});

// node_modules/jose/dist/browser/runtime/fetch_jwks.js
var fetchJwks, fetch_jwks_default;
var init_fetch_jwks = __esm({
  "node_modules/jose/dist/browser/runtime/fetch_jwks.js"() {
    init_errors();
    fetchJwks = async (url, timeout, options) => {
      let controller;
      let id;
      let timedOut = false;
      if (typeof AbortController === "function") {
        controller = new AbortController();
        id = setTimeout(() => {
          timedOut = true;
          controller.abort();
        }, timeout);
      }
      const response = await fetch(url.href, {
        signal: controller ? controller.signal : void 0,
        redirect: "manual",
        headers: options.headers
      }).catch((err) => {
        if (timedOut)
          throw new JWKSTimeout();
        throw err;
      });
      if (id !== void 0)
        clearTimeout(id);
      if (response.status !== 200) {
        throw new JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");
      }
      try {
        return await response.json();
      } catch {
        throw new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON");
      }
    };
    fetch_jwks_default = fetchJwks;
  }
});

// node_modules/jose/dist/browser/jwks/remote.js
function isCloudflareWorkers() {
  return typeof WebSocketPair !== "undefined" || typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime !== "undefined" && EdgeRuntime === "vercel";
}
function isFreshJwksCache(input, cacheMaxAge) {
  if (typeof input !== "object" || input === null) {
    return false;
  }
  if (!("uat" in input) || typeof input.uat !== "number" || Date.now() - input.uat >= cacheMaxAge) {
    return false;
  }
  if (!("jwks" in input) || !isObject(input.jwks) || !Array.isArray(input.jwks.keys) || !Array.prototype.every.call(input.jwks.keys, isObject)) {
    return false;
  }
  return true;
}
function createRemoteJWKSet(url, options) {
  const set = new RemoteJWKSet(url, options);
  const remoteJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);
  Object.defineProperties(remoteJWKSet, {
    coolingDown: {
      get: () => set.coolingDown(),
      enumerable: true,
      configurable: false
    },
    fresh: {
      get: () => set.fresh(),
      enumerable: true,
      configurable: false
    },
    reload: {
      value: () => set.reload(),
      enumerable: true,
      configurable: false,
      writable: false
    },
    reloading: {
      get: () => !!set._pendingFetch,
      enumerable: true,
      configurable: false
    },
    jwks: {
      value: () => set._local?.jwks(),
      enumerable: true,
      configurable: false,
      writable: false
    }
  });
  return remoteJWKSet;
}
var USER_AGENT, jwksCache, RemoteJWKSet, experimental_jwksCache;
var init_remote = __esm({
  "node_modules/jose/dist/browser/jwks/remote.js"() {
    init_fetch_jwks();
    init_errors();
    init_local();
    init_is_object();
    if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
      const NAME = "jose";
      const VERSION = "v5.10.0";
      USER_AGENT = `${NAME}/${VERSION}`;
    }
    jwksCache = Symbol();
    RemoteJWKSet = class {
      constructor(url, options) {
        if (!(url instanceof URL)) {
          throw new TypeError("url must be an instance of URL");
        }
        this._url = new URL(url.href);
        this._options = { agent: options?.agent, headers: options?.headers };
        this._timeoutDuration = typeof options?.timeoutDuration === "number" ? options?.timeoutDuration : 5e3;
        this._cooldownDuration = typeof options?.cooldownDuration === "number" ? options?.cooldownDuration : 3e4;
        this._cacheMaxAge = typeof options?.cacheMaxAge === "number" ? options?.cacheMaxAge : 6e5;
        if (options?.[jwksCache] !== void 0) {
          this._cache = options?.[jwksCache];
          if (isFreshJwksCache(options?.[jwksCache], this._cacheMaxAge)) {
            this._jwksTimestamp = this._cache.uat;
            this._local = createLocalJWKSet(this._cache.jwks);
          }
        }
      }
      coolingDown() {
        return typeof this._jwksTimestamp === "number" ? Date.now() < this._jwksTimestamp + this._cooldownDuration : false;
      }
      fresh() {
        return typeof this._jwksTimestamp === "number" ? Date.now() < this._jwksTimestamp + this._cacheMaxAge : false;
      }
      async getKey(protectedHeader, token) {
        if (!this._local || !this.fresh()) {
          await this.reload();
        }
        try {
          return await this._local(protectedHeader, token);
        } catch (err) {
          if (err instanceof JWKSNoMatchingKey) {
            if (this.coolingDown() === false) {
              await this.reload();
              return this._local(protectedHeader, token);
            }
          }
          throw err;
        }
      }
      async reload() {
        if (this._pendingFetch && isCloudflareWorkers()) {
          this._pendingFetch = void 0;
        }
        const headers = new Headers(this._options.headers);
        if (USER_AGENT && !headers.has("User-Agent")) {
          headers.set("User-Agent", USER_AGENT);
          this._options.headers = Object.fromEntries(headers.entries());
        }
        this._pendingFetch || (this._pendingFetch = fetch_jwks_default(this._url, this._timeoutDuration, this._options).then((json) => {
          this._local = createLocalJWKSet(json);
          if (this._cache) {
            this._cache.uat = Date.now();
            this._cache.jwks = json;
          }
          this._jwksTimestamp = Date.now();
          this._pendingFetch = void 0;
        }).catch((err) => {
          this._pendingFetch = void 0;
          throw err;
        }));
        await this._pendingFetch;
      }
    };
    experimental_jwksCache = jwksCache;
  }
});

// node_modules/jose/dist/browser/jwt/unsecured.js
var UnsecuredJWT;
var init_unsecured = __esm({
  "node_modules/jose/dist/browser/jwt/unsecured.js"() {
    init_base64url();
    init_buffer_utils();
    init_errors();
    init_jwt_claims_set();
    init_produce();
    UnsecuredJWT = class extends ProduceJWT {
      encode() {
        const header = encode5(JSON.stringify({ alg: "none" }));
        const payload = encode5(JSON.stringify(this._payload));
        return `${header}.${payload}.`;
      }
      static decode(jwt, options) {
        if (typeof jwt !== "string") {
          throw new JWTInvalid("Unsecured JWT must be a string");
        }
        const { 0: encodedHeader, 1: encodedPayload, 2: signature, length: length2 } = jwt.split(".");
        if (length2 !== 3 || signature !== "") {
          throw new JWTInvalid("Invalid Unsecured JWT");
        }
        let header;
        try {
          header = JSON.parse(decoder.decode(decode6(encodedHeader)));
          if (header.alg !== "none")
            throw new Error();
        } catch {
          throw new JWTInvalid("Invalid Unsecured JWT");
        }
        const payload = jwt_claims_set_default(header, decode6(encodedPayload), options);
        return { payload, header };
      }
    };
  }
});

// node_modules/jose/dist/browser/util/base64url.js
var base64url_exports2 = {};
__export(base64url_exports2, {
  decode: () => decode7,
  encode: () => encode6
});
var encode6, decode7;
var init_base64url2 = __esm({
  "node_modules/jose/dist/browser/util/base64url.js"() {
    init_base64url();
    encode6 = encode5;
    decode7 = decode6;
  }
});

// node_modules/jose/dist/browser/util/decode_protected_header.js
function decodeProtectedHeader(token) {
  let protectedB64u;
  if (typeof token === "string") {
    const parts = token.split(".");
    if (parts.length === 3 || parts.length === 5) {
      ;
      [protectedB64u] = parts;
    }
  } else if (typeof token === "object" && token) {
    if ("protected" in token) {
      protectedB64u = token.protected;
    } else {
      throw new TypeError("Token does not contain a Protected Header");
    }
  }
  try {
    if (typeof protectedB64u !== "string" || !protectedB64u) {
      throw new Error();
    }
    const result = JSON.parse(decoder.decode(decode7(protectedB64u)));
    if (!isObject(result)) {
      throw new Error();
    }
    return result;
  } catch {
    throw new TypeError("Invalid Token or Protected Header formatting");
  }
}
var init_decode_protected_header = __esm({
  "node_modules/jose/dist/browser/util/decode_protected_header.js"() {
    init_base64url2();
    init_buffer_utils();
    init_is_object();
  }
});

// node_modules/jose/dist/browser/util/decode_jwt.js
function decodeJwt(jwt) {
  if (typeof jwt !== "string")
    throw new JWTInvalid("JWTs must use Compact JWS serialization, JWT must be a string");
  const { 1: payload, length: length2 } = jwt.split(".");
  if (length2 === 5)
    throw new JWTInvalid("Only JWTs using Compact JWS serialization can be decoded");
  if (length2 !== 3)
    throw new JWTInvalid("Invalid JWT");
  if (!payload)
    throw new JWTInvalid("JWTs must contain a payload");
  let decoded;
  try {
    decoded = decode7(payload);
  } catch {
    throw new JWTInvalid("Failed to base64url decode the payload");
  }
  let result;
  try {
    result = JSON.parse(decoder.decode(decoded));
  } catch {
    throw new JWTInvalid("Failed to parse the decoded payload as JSON");
  }
  if (!isObject(result))
    throw new JWTInvalid("Invalid JWT Claims Set");
  return result;
}
var init_decode_jwt = __esm({
  "node_modules/jose/dist/browser/util/decode_jwt.js"() {
    init_base64url2();
    init_buffer_utils();
    init_is_object();
    init_errors();
  }
});

// node_modules/jose/dist/browser/runtime/generate.js
async function generateSecret(alg, options) {
  let length2;
  let algorithm;
  let keyUsages;
  switch (alg) {
    case "HS256":
    case "HS384":
    case "HS512":
      length2 = parseInt(alg.slice(-3), 10);
      algorithm = { name: "HMAC", hash: `SHA-${length2}`, length: length2 };
      keyUsages = ["sign", "verify"];
      break;
    case "A128CBC-HS256":
    case "A192CBC-HS384":
    case "A256CBC-HS512":
      length2 = parseInt(alg.slice(-3), 10);
      return random_default(new Uint8Array(length2 >> 3));
    case "A128KW":
    case "A192KW":
    case "A256KW":
      length2 = parseInt(alg.slice(1, 4), 10);
      algorithm = { name: "AES-KW", length: length2 };
      keyUsages = ["wrapKey", "unwrapKey"];
      break;
    case "A128GCMKW":
    case "A192GCMKW":
    case "A256GCMKW":
    case "A128GCM":
    case "A192GCM":
    case "A256GCM":
      length2 = parseInt(alg.slice(1, 4), 10);
      algorithm = { name: "AES-GCM", length: length2 };
      keyUsages = ["encrypt", "decrypt"];
      break;
    default:
      throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
  }
  return webcrypto_default.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages);
}
function getModulusLengthOption(options) {
  const modulusLength = options?.modulusLength ?? 2048;
  if (typeof modulusLength !== "number" || modulusLength < 2048) {
    throw new JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");
  }
  return modulusLength;
}
async function generateKeyPair(alg, options) {
  let algorithm;
  let keyUsages;
  switch (alg) {
    case "PS256":
    case "PS384":
    case "PS512":
      algorithm = {
        name: "RSA-PSS",
        hash: `SHA-${alg.slice(-3)}`,
        publicExponent: new Uint8Array([1, 0, 1]),
        modulusLength: getModulusLengthOption(options)
      };
      keyUsages = ["sign", "verify"];
      break;
    case "RS256":
    case "RS384":
    case "RS512":
      algorithm = {
        name: "RSASSA-PKCS1-v1_5",
        hash: `SHA-${alg.slice(-3)}`,
        publicExponent: new Uint8Array([1, 0, 1]),
        modulusLength: getModulusLengthOption(options)
      };
      keyUsages = ["sign", "verify"];
      break;
    case "RSA-OAEP":
    case "RSA-OAEP-256":
    case "RSA-OAEP-384":
    case "RSA-OAEP-512":
      algorithm = {
        name: "RSA-OAEP",
        hash: `SHA-${parseInt(alg.slice(-3), 10) || 1}`,
        publicExponent: new Uint8Array([1, 0, 1]),
        modulusLength: getModulusLengthOption(options)
      };
      keyUsages = ["decrypt", "unwrapKey", "encrypt", "wrapKey"];
      break;
    case "ES256":
      algorithm = { name: "ECDSA", namedCurve: "P-256" };
      keyUsages = ["sign", "verify"];
      break;
    case "ES384":
      algorithm = { name: "ECDSA", namedCurve: "P-384" };
      keyUsages = ["sign", "verify"];
      break;
    case "ES512":
      algorithm = { name: "ECDSA", namedCurve: "P-521" };
      keyUsages = ["sign", "verify"];
      break;
    case "Ed25519":
      algorithm = { name: "Ed25519" };
      keyUsages = ["sign", "verify"];
      break;
    case "EdDSA": {
      keyUsages = ["sign", "verify"];
      const crv = options?.crv ?? "Ed25519";
      switch (crv) {
        case "Ed25519":
        case "Ed448":
          algorithm = { name: crv };
          break;
        default:
          throw new JOSENotSupported("Invalid or unsupported crv option provided");
      }
      break;
    }
    case "ECDH-ES":
    case "ECDH-ES+A128KW":
    case "ECDH-ES+A192KW":
    case "ECDH-ES+A256KW": {
      keyUsages = ["deriveKey", "deriveBits"];
      const crv = options?.crv ?? "P-256";
      switch (crv) {
        case "P-256":
        case "P-384":
        case "P-521": {
          algorithm = { name: "ECDH", namedCurve: crv };
          break;
        }
        case "X25519":
        case "X448":
          algorithm = { name: crv };
          break;
        default:
          throw new JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448");
      }
      break;
    }
    default:
      throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
  }
  return webcrypto_default.subtle.generateKey(algorithm, options?.extractable ?? false, keyUsages);
}
var init_generate = __esm({
  "node_modules/jose/dist/browser/runtime/generate.js"() {
    init_webcrypto();
    init_errors();
    init_random();
  }
});

// node_modules/jose/dist/browser/key/generate_key_pair.js
async function generateKeyPair2(alg, options) {
  return generateKeyPair(alg, options);
}
var init_generate_key_pair = __esm({
  "node_modules/jose/dist/browser/key/generate_key_pair.js"() {
    init_generate();
  }
});

// node_modules/jose/dist/browser/key/generate_secret.js
async function generateSecret2(alg, options) {
  return generateSecret(alg, options);
}
var init_generate_secret = __esm({
  "node_modules/jose/dist/browser/key/generate_secret.js"() {
    init_generate();
  }
});

// node_modules/jose/dist/browser/runtime/runtime.js
var runtime_default;
var init_runtime = __esm({
  "node_modules/jose/dist/browser/runtime/runtime.js"() {
    runtime_default = "WebCryptoAPI";
  }
});

// node_modules/jose/dist/browser/util/runtime.js
var runtime_default2;
var init_runtime2 = __esm({
  "node_modules/jose/dist/browser/util/runtime.js"() {
    init_runtime();
    runtime_default2 = runtime_default;
  }
});

// node_modules/jose/dist/browser/index.js
var browser_exports = {};
__export(browser_exports, {
  CompactEncrypt: () => CompactEncrypt,
  CompactSign: () => CompactSign,
  EmbeddedJWK: () => EmbeddedJWK,
  EncryptJWT: () => EncryptJWT,
  FlattenedEncrypt: () => FlattenedEncrypt,
  FlattenedSign: () => FlattenedSign,
  GeneralEncrypt: () => GeneralEncrypt,
  GeneralSign: () => GeneralSign,
  SignJWT: () => SignJWT,
  UnsecuredJWT: () => UnsecuredJWT,
  base64url: () => base64url_exports2,
  calculateJwkThumbprint: () => calculateJwkThumbprint,
  calculateJwkThumbprintUri: () => calculateJwkThumbprintUri,
  compactDecrypt: () => compactDecrypt,
  compactVerify: () => compactVerify,
  createLocalJWKSet: () => createLocalJWKSet,
  createRemoteJWKSet: () => createRemoteJWKSet,
  cryptoRuntime: () => runtime_default2,
  decodeJwt: () => decodeJwt,
  decodeProtectedHeader: () => decodeProtectedHeader,
  errors: () => errors_exports,
  experimental_jwksCache: () => experimental_jwksCache,
  exportJWK: () => exportJWK,
  exportPKCS8: () => exportPKCS8,
  exportSPKI: () => exportSPKI,
  flattenedDecrypt: () => flattenedDecrypt,
  flattenedVerify: () => flattenedVerify,
  generalDecrypt: () => generalDecrypt,
  generalVerify: () => generalVerify,
  generateKeyPair: () => generateKeyPair2,
  generateSecret: () => generateSecret2,
  importJWK: () => importJWK,
  importPKCS8: () => importPKCS8,
  importSPKI: () => importSPKI,
  importX509: () => importX509,
  jwksCache: () => jwksCache,
  jwtDecrypt: () => jwtDecrypt,
  jwtVerify: () => jwtVerify
});
var init_browser = __esm({
  "node_modules/jose/dist/browser/index.js"() {
    init_decrypt3();
    init_decrypt2();
    init_decrypt4();
    init_encrypt3();
    init_verify3();
    init_verify2();
    init_verify4();
    init_verify5();
    init_decrypt5();
    init_encrypt4();
    init_encrypt2();
    init_sign3();
    init_sign2();
    init_sign4();
    init_sign5();
    init_encrypt5();
    init_thumbprint();
    init_embedded();
    init_local();
    init_remote();
    init_unsecured();
    init_export();
    init_import();
    init_decode_protected_header();
    init_decode_jwt();
    init_errors();
    init_generate_key_pair();
    init_generate_secret();
    init_base64url2();
    init_runtime2();
  }
});

// node_modules/@atproto/jwk-jose/dist/util.js
var require_util12 = __commonJS({
  "node_modules/@atproto/jwk-jose/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.either = either;
    function either(a, b) {
      if (a != null && b != null && a !== b) {
        throw new TypeError(`Expected "${b}", got "${a}"`);
      }
      return a ?? b ?? void 0;
    }
  }
});

// node_modules/@atproto/jwk-jose/dist/jose-key.js
var require_jose_key = __commonJS({
  "node_modules/@atproto/jwk-jose/dist/jose-key.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.JoseKey = void 0;
    var jose_1 = (init_browser(), __toCommonJS(browser_exports));
    var jwk_1 = require_dist12();
    var util_js_1 = require_util12();
    var { JOSEError: JOSEError2 } = jose_1.errors;
    var JoseKey = class _JoseKey extends jwk_1.Key {
      /**
       * Some runtimes (e.g. Bun) require an `alg` second argument to be set when
       * invoking `importJWK`. In order to be compatible with these runtimes, we
       * provide the following method to ensure the `alg` is always set. We also
       * take the opportunity to ensure that the `alg` is compatible with this key.
       */
      async getKeyObj(alg) {
        if (!this.algorithms.includes(alg)) {
          throw new jwk_1.JwkError(`Key cannot be used with algorithm "${alg}"`);
        }
        try {
          return await (0, jose_1.importJWK)(this.jwk, alg);
        } catch (cause) {
          throw new jwk_1.JwkError("Failed to import JWK", void 0, { cause });
        }
      }
      async createJwt(header, payload) {
        try {
          const { kid } = header;
          if (kid && kid !== this.kid) {
            throw new jwk_1.JwtCreateError(`Invalid "kid" (${kid}) used to sign with key "${this.kid}"`);
          }
          const { alg } = header;
          if (!alg) {
            throw new jwk_1.JwtCreateError('Missing "alg" in JWT header');
          }
          const keyObj = await this.getKeyObj(alg);
          const jwtBuilder = new jose_1.SignJWT(payload).setProtectedHeader({
            ...header,
            alg,
            kid: this.kid
          });
          const signedJwt = await jwtBuilder.sign(keyObj);
          return signedJwt;
        } catch (cause) {
          if (cause instanceof JOSEError2) {
            throw new jwk_1.JwtCreateError(cause.message, cause.code, { cause });
          } else {
            throw jwk_1.JwtCreateError.from(cause);
          }
        }
      }
      async verifyJwt(token, options) {
        try {
          const result = await (0, jose_1.jwtVerify)(token, async ({ alg }) => this.getKeyObj(alg), { ...options, algorithms: this.algorithms });
          const headerParsed = jwk_1.jwtHeaderSchema.safeParse(result.protectedHeader);
          if (!headerParsed.success) {
            throw new jwk_1.JwtVerifyError("Invalid JWT header", void 0, {
              cause: headerParsed.error
            });
          }
          const payloadParsed = jwk_1.jwtPayloadSchema.safeParse(result.payload);
          if (!payloadParsed.success) {
            throw new jwk_1.JwtVerifyError("Invalid JWT payload", void 0, {
              cause: payloadParsed.error
            });
          }
          return {
            protectedHeader: headerParsed.data,
            // "requiredClaims" enforced by jwtVerify()
            payload: payloadParsed.data
          };
        } catch (cause) {
          if (cause instanceof JOSEError2) {
            throw new jwk_1.JwtVerifyError(cause.message, cause.code, { cause });
          } else {
            throw jwk_1.JwtVerifyError.from(cause);
          }
        }
      }
      static async generateKeyPair(allowedAlgos = ["ES256"], options) {
        if (!allowedAlgos.length) {
          throw new jwk_1.JwkError("No algorithms provided for key generation");
        }
        const errors = [];
        for (const alg of allowedAlgos) {
          try {
            return await (0, jose_1.generateKeyPair)(alg, options);
          } catch (err) {
            errors.push(err);
          }
        }
        throw new jwk_1.JwkError("Failed to generate key pair", void 0, {
          cause: new AggregateError(errors, "None of the algorithms worked")
        });
      }
      static async generate(allowedAlgos = ["ES256"], kid, options) {
        const kp = await this.generateKeyPair(allowedAlgos, {
          ...options,
          extractable: true
        });
        return this.fromImportable(kp.privateKey, kid);
      }
      static async fromImportable(input, kid) {
        if (typeof input === "string") {
          if (input.startsWith("-----")) {
            return this.fromPKCS8(input, "", kid);
          }
          if (input.startsWith("{")) {
            return this.fromJWK(input, kid);
          }
          throw new jwk_1.JwkError("Invalid input");
        }
        if (typeof input === "object") {
          if ("kty" in input || "alg" in input) {
            return this.fromJWK(input, kid);
          }
          return this.fromKeyLike(input, kid);
        }
        throw new jwk_1.JwkError("Invalid input");
      }
      /**
       * @see {@link exportJWK}
       */
      static async fromKeyLike(keyLike, kid, alg) {
        const jwk = await (0, jose_1.exportJWK)(keyLike);
        if (alg) {
          if (!jwk.alg)
            jwk.alg = alg;
          else if (jwk.alg !== alg)
            throw new jwk_1.JwkError('Invalid "alg" in JWK');
        }
        return this.fromJWK(jwk, kid);
      }
      /**
       * @see {@link importPKCS8}
       */
      static async fromPKCS8(pem, alg, kid) {
        const keyLike = await (0, jose_1.importPKCS8)(pem, alg, { extractable: true });
        return this.fromKeyLike(keyLike, kid);
      }
      static async fromJWK(input, inputKid) {
        const jwk = typeof input === "string" ? JSON.parse(input) : input;
        if (!jwk || typeof jwk !== "object")
          throw new jwk_1.JwkError("Invalid JWK");
        const kid = (0, util_js_1.either)(jwk.kid, inputKid);
        const use = jwk.use || "sig";
        return new _JoseKey(jwk_1.jwkSchema.parse({ ...jwk, kid, use }));
      }
    };
    exports.JoseKey = JoseKey;
  }
});

// node_modules/@atproto/jwk-jose/dist/index.js
var require_dist13 = __commonJS({
  "node_modules/@atproto/jwk-jose/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_jose_key(), exports);
  }
});

// node_modules/@atproto/jwk-webcrypto/dist/util.js
var require_util13 = __commonJS({
  "node_modules/@atproto/jwk-webcrypto/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toSubtleAlgorithm = toSubtleAlgorithm;
    exports.fromSubtleAlgorithm = fromSubtleAlgorithm;
    exports.isCryptoKeyPair = isCryptoKeyPair;
    function toSubtleAlgorithm(alg, crv, options) {
      switch (alg) {
        case "PS256":
        case "PS384":
        case "PS512":
          return {
            name: "RSA-PSS",
            hash: `SHA-${alg.slice(-3)}`,
            modulusLength: options?.modulusLength ?? 2048,
            publicExponent: new Uint8Array([1, 0, 1])
          };
        case "RS256":
        case "RS384":
        case "RS512":
          return {
            name: "RSASSA-PKCS1-v1_5",
            hash: `SHA-${alg.slice(-3)}`,
            modulusLength: options?.modulusLength ?? 2048,
            publicExponent: new Uint8Array([1, 0, 1])
          };
        case "ES256":
        case "ES384":
          return {
            name: "ECDSA",
            namedCurve: `P-${alg.slice(-3)}`
          };
        case "ES512":
          return {
            name: "ECDSA",
            namedCurve: "P-521"
          };
        default:
          throw new TypeError(`Unsupported alg "${alg}"`);
      }
    }
    function fromSubtleAlgorithm(algorithm) {
      switch (algorithm.name) {
        case "RSA-PSS":
        case "RSASSA-PKCS1-v1_5": {
          const hash = algorithm.hash.name;
          switch (hash) {
            case "SHA-256":
            case "SHA-384":
            case "SHA-512": {
              const prefix = algorithm.name === "RSA-PSS" ? "PS" : "RS";
              return `${prefix}${hash.slice(-3)}`;
            }
            default:
              throw new TypeError("unsupported RsaHashedKeyAlgorithm hash");
          }
        }
        case "ECDSA": {
          const namedCurve = algorithm.namedCurve;
          switch (namedCurve) {
            case "P-256":
            case "P-384":
            case "P-512":
              return `ES${namedCurve.slice(-3)}`;
            case "P-521":
              return "ES512";
            default:
              throw new TypeError("unsupported EcKeyAlgorithm namedCurve");
          }
        }
        case "Ed448":
        case "Ed25519":
          return "EdDSA";
        default:
          throw new TypeError(`Unexpected algorithm "${algorithm.name}"`);
      }
    }
    function isCryptoKeyPair(v, extractable) {
      return typeof v === "object" && v !== null && "privateKey" in v && v.privateKey instanceof CryptoKey && v.privateKey.type === "private" && (extractable == null || v.privateKey.extractable === extractable) && v.privateKey.usages.includes("sign") && "publicKey" in v && v.publicKey instanceof CryptoKey && v.publicKey.type === "public" && v.publicKey.extractable === true && v.publicKey.usages.includes("verify");
    }
  }
});

// node_modules/@atproto/jwk-webcrypto/dist/webcrypto-key.js
var require_webcrypto_key = __commonJS({
  "node_modules/@atproto/jwk-webcrypto/dist/webcrypto-key.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.WebcryptoKey = exports.jwkWithAlgSchema = void 0;
    var zod_1 = require_zod();
    var jwk_1 = require_dist12();
    var jwk_jose_1 = require_dist13();
    var util_js_1 = require_util13();
    exports.jwkWithAlgSchema = zod_1.z.intersection(jwk_1.jwkSchema, zod_1.z.object({ alg: zod_1.z.string() }));
    var WebcryptoKey = class _WebcryptoKey extends jwk_jose_1.JoseKey {
      // We need to override the static method generate from JoseKey because
      // the browser needs both the private and public keys
      static async generate(allowedAlgos = ["ES256"], kid = crypto.randomUUID(), options) {
        const keyPair = await this.generateKeyPair(allowedAlgos, options);
        if (!(0, util_js_1.isCryptoKeyPair)(keyPair)) {
          throw new TypeError("Invalid CryptoKeyPair");
        }
        return this.fromKeypair(keyPair, kid);
      }
      static async fromKeypair(cryptoKeyPair, kid) {
        const { key_ops, use, alg = (0, util_js_1.fromSubtleAlgorithm)(cryptoKeyPair.privateKey.algorithm), ...jwk } = await crypto.subtle.exportKey("jwk", cryptoKeyPair.privateKey.extractable ? cryptoKeyPair.privateKey : cryptoKeyPair.publicKey);
        if (use && use !== "sig") {
          throw new TypeError(`Unsupported JWK use "${use}"`);
        }
        if (key_ops && !key_ops.some((o) => o === "sign" || o === "verify")) {
          throw new TypeError(`Invalid key_ops "${key_ops}" for "sig" use`);
        }
        return new _WebcryptoKey(exports.jwkWithAlgSchema.parse({ ...jwk, kid, alg, use: "sig" }), cryptoKeyPair);
      }
      constructor(jwk, cryptoKeyPair) {
        super(jwk);
        Object.defineProperty(this, "cryptoKeyPair", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: cryptoKeyPair
        });
      }
      get isPrivate() {
        return true;
      }
      get privateJwk() {
        if (super.isPrivate)
          return this.jwk;
        throw new Error("Private Webcrypto Key not exportable");
      }
      async getKeyObj(alg) {
        if (this.jwk.alg !== alg) {
          throw new jwk_1.JwkError(`Key cannot be used with algorithm "${alg}"`);
        }
        return this.cryptoKeyPair.privateKey;
      }
    };
    exports.WebcryptoKey = WebcryptoKey;
  }
});

// node_modules/@atproto/jwk-webcrypto/dist/index.js
var require_dist14 = __commonJS({
  "node_modules/@atproto/jwk-webcrypto/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_webcrypto_key(), exports);
  }
});

// node_modules/@atproto/did/dist/did-error.js
var require_did_error = __commonJS({
  "node_modules/@atproto/did/dist/did-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.InvalidDidError = exports.DidError = void 0;
    var DidError = class _DidError extends Error {
      constructor(did, message2, code2, status = 400, cause) {
        super(message2, { cause });
        Object.defineProperty(this, "did", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: did
        });
        Object.defineProperty(this, "code", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: code2
        });
        Object.defineProperty(this, "status", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: status
        });
      }
      /**
       * For compatibility with error handlers in common HTTP frameworks.
       */
      get statusCode() {
        return this.status;
      }
      toString() {
        return `${this.constructor.name} ${this.code} (${this.did}): ${this.message}`;
      }
      static from(cause, did) {
        if (cause instanceof _DidError) {
          return cause;
        }
        const message2 = cause instanceof Error ? cause.message : typeof cause === "string" ? cause : "An unknown error occurred";
        const status = (typeof cause?.["statusCode"] === "number" ? cause["statusCode"] : void 0) ?? (typeof cause?.["status"] === "number" ? cause["status"] : void 0);
        return new _DidError(did, message2, "did-unknown-error", status, cause);
      }
    };
    exports.DidError = DidError;
    var InvalidDidError = class extends DidError {
      constructor(did, message2, cause) {
        super(did, message2, "did-invalid", 400, cause);
      }
    };
    exports.InvalidDidError = InvalidDidError;
  }
});

// node_modules/@atproto/did/dist/lib/uri.js
var require_uri4 = __commonJS({
  "node_modules/@atproto/did/dist/lib/uri.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isFragment = isFragment;
    exports.isHexDigit = isHexDigit;
    function isFragment(value, startIdx = 0, endIdx = value.length) {
      let charCode;
      for (let i = startIdx; i < endIdx; i++) {
        charCode = value.charCodeAt(i);
        if (charCode >= 65 && charCode <= 90 || charCode >= 97 && charCode <= 122 || charCode >= 48 && charCode <= 57 || charCode === 45 || charCode === 46 || charCode === 95 || charCode === 126) {
        } else if (charCode === 33 || charCode === 36 || charCode === 38 || charCode === 39 || charCode === 40 || charCode === 41 || charCode === 42 || charCode === 43 || charCode === 44 || charCode === 59 || charCode === 61) {
        } else if (charCode === 58 || charCode === 64) {
        } else if (charCode === 47 || charCode === 63) {
        } else if (charCode === 37) {
          if (i + 2 >= endIdx)
            return false;
          if (!isHexDigit(value.charCodeAt(i + 1)))
            return false;
          if (!isHexDigit(value.charCodeAt(i + 2)))
            return false;
          i += 2;
        } else {
          return false;
        }
      }
      return true;
    }
    function isHexDigit(code2) {
      return code2 >= 48 && code2 <= 57 || // 0-9
      code2 >= 65 && code2 <= 70 || // A-F
      code2 >= 97 && code2 <= 102;
    }
  }
});

// node_modules/@atproto/did/dist/methods/plc.js
var require_plc = __commonJS({
  "node_modules/@atproto/did/dist/methods/plc.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DID_PLC_PREFIX = void 0;
    exports.isDidPlc = isDidPlc;
    exports.asDidPlc = asDidPlc;
    exports.assertDidPlc = assertDidPlc;
    var did_error_js_1 = require_did_error();
    var DID_PLC_PREFIX = `did:plc:`;
    exports.DID_PLC_PREFIX = DID_PLC_PREFIX;
    var DID_PLC_PREFIX_LENGTH = DID_PLC_PREFIX.length;
    var DID_PLC_LENGTH = 32;
    function isDidPlc(input) {
      if (typeof input !== "string")
        return false;
      if (input.length !== DID_PLC_LENGTH)
        return false;
      if (!input.startsWith(DID_PLC_PREFIX))
        return false;
      for (let i = DID_PLC_PREFIX_LENGTH; i < DID_PLC_LENGTH; i++) {
        if (!isBase32Char(input.charCodeAt(i)))
          return false;
      }
      return true;
    }
    function asDidPlc(input) {
      assertDidPlc(input);
      return input;
    }
    function assertDidPlc(input) {
      if (typeof input !== "string") {
        throw new did_error_js_1.InvalidDidError(typeof input, `DID must be a string`);
      }
      if (!input.startsWith(DID_PLC_PREFIX)) {
        throw new did_error_js_1.InvalidDidError(input, `Invalid did:plc prefix`);
      }
      if (input.length !== DID_PLC_LENGTH) {
        throw new did_error_js_1.InvalidDidError(input, `did:plc must be ${DID_PLC_LENGTH} characters long`);
      }
      for (let i = DID_PLC_PREFIX_LENGTH; i < DID_PLC_LENGTH; i++) {
        if (!isBase32Char(input.charCodeAt(i))) {
          throw new did_error_js_1.InvalidDidError(input, `Invalid character at position ${i}`);
        }
      }
    }
    var isBase32Char = (c) => c >= 97 && c <= 122 || c >= 50 && c <= 55;
  }
});

// node_modules/@atproto/did/dist/did.js
var require_did4 = __commonJS({
  "node_modules/@atproto/did/dist/did.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.didSchema = exports.DID_PREFIX = void 0;
    exports.assertDidMethod = assertDidMethod;
    exports.extractDidMethod = extractDidMethod;
    exports.assertDidMsid = assertDidMsid;
    exports.assertDid = assertDid;
    exports.isDid = isDid;
    exports.asDid = asDid;
    var zod_1 = require_zod();
    var did_error_js_1 = require_did_error();
    var DID_PREFIX = "did:";
    exports.DID_PREFIX = DID_PREFIX;
    var DID_PREFIX_LENGTH = DID_PREFIX.length;
    function assertDidMethod(input, start = 0, end = input.length) {
      if (!Number.isFinite(end) || !Number.isFinite(start) || end < start || end > input.length) {
        throw new TypeError("Invalid start or end position");
      }
      if (end === start) {
        throw new did_error_js_1.InvalidDidError(input, `Empty method name`);
      }
      let c;
      for (let i = start; i < end; i++) {
        c = input.charCodeAt(i);
        if ((c < 97 || c > 122) && // a-z
        (c < 48 || c > 57)) {
          throw new did_error_js_1.InvalidDidError(input, `Invalid character at position ${i} in DID method name`);
        }
      }
    }
    function extractDidMethod(did) {
      const msidSep = did.indexOf(":", DID_PREFIX_LENGTH);
      const method = did.slice(DID_PREFIX_LENGTH, msidSep);
      return method;
    }
    function assertDidMsid(input, start = 0, end = input.length) {
      if (!Number.isFinite(end) || !Number.isFinite(start) || end < start || end > input.length) {
        throw new TypeError("Invalid start or end position");
      }
      if (end === start) {
        throw new did_error_js_1.InvalidDidError(input, `DID method-specific id must not be empty`);
      }
      let c;
      for (let i = start; i < end; i++) {
        c = input.charCodeAt(i);
        if ((c < 97 || c > 122) && // a-z
        (c < 65 || c > 90) && // A-Z
        (c < 48 || c > 57) && // 0-9
        c !== 46 && // .
        c !== 45 && // -
        c !== 95) {
          if (c === 58) {
            if (i === end - 1) {
              throw new did_error_js_1.InvalidDidError(input, `DID cannot end with ":"`);
            }
            continue;
          }
          if (c === 37) {
            c = input.charCodeAt(++i);
            if ((c < 48 || c > 57) && (c < 65 || c > 70)) {
              throw new did_error_js_1.InvalidDidError(input, `Invalid pct-encoded character at position ${i}`);
            }
            c = input.charCodeAt(++i);
            if ((c < 48 || c > 57) && (c < 65 || c > 70)) {
              throw new did_error_js_1.InvalidDidError(input, `Invalid pct-encoded character at position ${i}`);
            }
            if (i >= end) {
              throw new did_error_js_1.InvalidDidError(input, `Incomplete pct-encoded character at position ${i - 2}`);
            }
            continue;
          }
          throw new did_error_js_1.InvalidDidError(input, `Disallowed character in DID at position ${i}`);
        }
      }
    }
    function assertDid(input) {
      if (typeof input !== "string") {
        throw new did_error_js_1.InvalidDidError(typeof input, `DID must be a string`);
      }
      const { length: length2 } = input;
      if (length2 > 2048) {
        throw new did_error_js_1.InvalidDidError(input, `DID is too long (2048 chars max)`);
      }
      if (!input.startsWith(DID_PREFIX)) {
        throw new did_error_js_1.InvalidDidError(input, `DID requires "${DID_PREFIX}" prefix`);
      }
      const idSep = input.indexOf(":", DID_PREFIX_LENGTH);
      if (idSep === -1) {
        throw new did_error_js_1.InvalidDidError(input, `Missing colon after method name`);
      }
      assertDidMethod(input, DID_PREFIX_LENGTH, idSep);
      assertDidMsid(input, idSep + 1, length2);
    }
    function isDid(input) {
      try {
        assertDid(input);
        return true;
      } catch (err) {
        if (err instanceof did_error_js_1.DidError) {
          return false;
        }
        throw err;
      }
    }
    function asDid(input) {
      assertDid(input);
      return input;
    }
    exports.didSchema = zod_1.z.string().superRefine((value, ctx) => {
      try {
        assertDid(value);
        return true;
      } catch (err) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: err instanceof Error ? err.message : "Unexpected error"
        });
        return false;
      }
    });
  }
});

// node_modules/@atproto/did/dist/methods/web.js
var require_web = __commonJS({
  "node_modules/@atproto/did/dist/methods/web.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DID_WEB_PREFIX = void 0;
    exports.isDidWeb = isDidWeb;
    exports.asDidWeb = asDidWeb;
    exports.assertDidWeb = assertDidWeb;
    exports.didWebToUrl = didWebToUrl;
    exports.urlToDidWeb = urlToDidWeb;
    exports.buildDidWebUrl = buildDidWebUrl;
    var did_error_js_1 = require_did_error();
    var did_js_1 = require_did4();
    exports.DID_WEB_PREFIX = `did:web:`;
    var canParse = URL.canParse?.bind(URL) ?? ((url, base3) => {
      try {
        new URL(url, base3);
        return true;
      } catch {
        return false;
      }
    });
    function isDidWeb(input) {
      if (typeof input !== "string")
        return false;
      if (!input.startsWith(exports.DID_WEB_PREFIX))
        return false;
      if (input.charAt(exports.DID_WEB_PREFIX.length) === ":")
        return false;
      try {
        (0, did_js_1.assertDidMsid)(input, exports.DID_WEB_PREFIX.length);
      } catch {
        return false;
      }
      return canParse(buildDidWebUrl(input));
    }
    function asDidWeb(input) {
      assertDidWeb(input);
      return input;
    }
    function assertDidWeb(input) {
      if (typeof input !== "string") {
        throw new did_error_js_1.InvalidDidError(typeof input, `DID must be a string`);
      }
      if (!input.startsWith(exports.DID_WEB_PREFIX)) {
        throw new did_error_js_1.InvalidDidError(input, `Invalid did:web prefix`);
      }
      if (input.charAt(exports.DID_WEB_PREFIX.length) === ":") {
        throw new did_error_js_1.InvalidDidError(input, "did:web MSID must not start with a colon");
      }
      (0, did_js_1.assertDidMsid)(input, exports.DID_WEB_PREFIX.length);
      if (!canParse(buildDidWebUrl(input))) {
        throw new did_error_js_1.InvalidDidError(input, "Invalid Web DID");
      }
    }
    function didWebToUrl(did) {
      try {
        return new URL(buildDidWebUrl(did));
      } catch (cause) {
        throw new did_error_js_1.InvalidDidError(did, "Invalid Web DID", cause);
      }
    }
    function urlToDidWeb(url) {
      const port = url.port ? `%3A${url.port}` : "";
      const path = url.pathname === "/" ? "" : url.pathname.replaceAll("/", ":");
      return `did:web:${url.hostname}${port}${path}`;
    }
    function buildDidWebUrl(did) {
      const hostIdx = exports.DID_WEB_PREFIX.length;
      const pathIdx = did.indexOf(":", hostIdx);
      const hostEnc = pathIdx === -1 ? did.slice(hostIdx) : did.slice(hostIdx, pathIdx);
      const host = hostEnc.replaceAll("%3A", ":");
      const path = pathIdx === -1 ? "" : did.slice(pathIdx).replaceAll(":", "/");
      const proto = host.startsWith("localhost") && (host.length === 9 || host.charCodeAt(9) === 58) ? "http" : "https";
      return `${proto}://${host}${path}`;
    }
  }
});

// node_modules/@atproto/did/dist/methods.js
var require_methods = __commonJS({
  "node_modules/@atproto/did/dist/methods.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_plc(), exports);
    __exportStar2(require_web(), exports);
  }
});

// node_modules/@atproto/did/dist/atproto.js
var require_atproto = __commonJS({
  "node_modules/@atproto/did/dist/atproto.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isAtprotoAudience = exports.atprotoDidSchema = void 0;
    exports.isAtprotoDid = isAtprotoDid;
    exports.asAtprotoDid = asAtprotoDid;
    exports.assertAtprotoDid = assertAtprotoDid;
    exports.assertAtprotoDidWeb = assertAtprotoDidWeb;
    exports.isAtprotoDidWeb = isAtprotoDidWeb;
    var zod_1 = require_zod();
    var did_error_js_1 = require_did_error();
    var uri_js_1 = require_uri4();
    var methods_js_1 = require_methods();
    exports.atprotoDidSchema = zod_1.z.string().refine(isAtprotoDid, `Atproto only allows "plc" and "web" DID methods`);
    function isAtprotoDid(input) {
      if (typeof input !== "string") {
        return false;
      } else if (input.startsWith(methods_js_1.DID_PLC_PREFIX)) {
        return (0, methods_js_1.isDidPlc)(input);
      } else if (input.startsWith(methods_js_1.DID_WEB_PREFIX)) {
        return isAtprotoDidWeb(input);
      } else {
        return false;
      }
    }
    function asAtprotoDid(input) {
      assertAtprotoDid(input);
      return input;
    }
    function assertAtprotoDid(input) {
      if (typeof input !== "string") {
        throw new did_error_js_1.InvalidDidError(typeof input, `DID must be a string`);
      } else if (input.startsWith(methods_js_1.DID_PLC_PREFIX)) {
        (0, methods_js_1.assertDidPlc)(input);
      } else if (input.startsWith(methods_js_1.DID_WEB_PREFIX)) {
        assertAtprotoDidWeb(input);
      } else {
        throw new did_error_js_1.InvalidDidError(input, `Atproto only allows "plc" and "web" DID methods`);
      }
    }
    function assertAtprotoDidWeb(input) {
      (0, methods_js_1.assertDidWeb)(input);
      if (isDidWebWithPath(input)) {
        throw new did_error_js_1.InvalidDidError(input, `Atproto does not allow path components in Web DIDs`);
      }
      if (isDidWebWithHttpsPort(input)) {
        throw new did_error_js_1.InvalidDidError(input, `Atproto does not allow port numbers in Web DIDs, except for localhost`);
      }
    }
    function isAtprotoDidWeb(input) {
      if (!(0, methods_js_1.isDidWeb)(input)) {
        return false;
      }
      if (isDidWebWithPath(input)) {
        return false;
      }
      if (isDidWebWithHttpsPort(input)) {
        return false;
      }
      return true;
    }
    function isDidWebWithPath(did) {
      return did.includes(":", methods_js_1.DID_WEB_PREFIX.length);
    }
    function isLocalhostDid(did) {
      return did === "did:web:localhost" || did.startsWith("did:web:localhost:") || did.startsWith("did:web:localhost%3A");
    }
    function isDidWebWithHttpsPort(did) {
      if (isLocalhostDid(did))
        return false;
      const pathIdx = did.indexOf(":", methods_js_1.DID_WEB_PREFIX.length);
      const hasPort = pathIdx === -1 ? (
        // No path component, check if there's a port separator anywhere after
        // the "did:web:" prefix
        did.includes("%3A", methods_js_1.DID_WEB_PREFIX.length)
      ) : (
        // There is a path component; if there is an encoded colon *before* it,
        // then there is a port number
        did.lastIndexOf("%3A", pathIdx) !== -1
      );
      return hasPort;
    }
    var isAtprotoAudience = (value) => {
      if (typeof value !== "string")
        return false;
      const hashIndex = value.indexOf("#");
      if (hashIndex === -1)
        return false;
      if (value.indexOf("#", hashIndex + 1) !== -1)
        return false;
      return (0, uri_js_1.isFragment)(value, hashIndex + 1) && isAtprotoDid(value.slice(0, hashIndex));
    };
    exports.isAtprotoAudience = isAtprotoAudience;
  }
});

// node_modules/@atproto/did/dist/did-document.js
var require_did_document = __commonJS({
  "node_modules/@atproto/did/dist/did-document.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.didDocumentValidator = exports.didDocumentSchema = void 0;
    var zod_1 = require_zod();
    var did_js_1 = require_did4();
    var uri_js_1 = require_uri4();
    var rfc3968UriSchema = zod_1.z.string().url("RFC3968 compliant URI");
    var didControllerSchema = zod_1.z.union([did_js_1.didSchema, zod_1.z.array(did_js_1.didSchema)]);
    var didRelativeUriSchema = zod_1.z.union([
      rfc3968UriSchema.refine((value) => {
        const fragmentIndex = value.indexOf("#");
        if (fragmentIndex === -1)
          return false;
        return (0, uri_js_1.isFragment)(value, fragmentIndex + 1);
      }, {
        message: "Missing or invalid fragment in RFC3968 URI"
      }),
      zod_1.z.string().refine((value) => value.charCodeAt(0) === 35, {
        message: "Fragment must start with #"
      }).refine((value) => (0, uri_js_1.isFragment)(value, 1), {
        message: "Invalid char in URI fragment"
      })
    ]);
    var didVerificationMethodSchema = zod_1.z.object({
      id: didRelativeUriSchema,
      type: zod_1.z.string().min(1),
      controller: didControllerSchema,
      publicKeyJwk: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
      publicKeyMultibase: zod_1.z.string().optional()
    });
    var didServiceIdSchema = didRelativeUriSchema;
    var didServiceTypeSchema = zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]);
    var didServiceEndpointSchema = zod_1.z.union([
      rfc3968UriSchema,
      zod_1.z.record(zod_1.z.string(), rfc3968UriSchema),
      zod_1.z.array(zod_1.z.union([rfc3968UriSchema, zod_1.z.record(zod_1.z.string(), rfc3968UriSchema)])).nonempty()
    ]);
    var didServiceSchema = zod_1.z.object({
      id: didServiceIdSchema,
      type: didServiceTypeSchema,
      serviceEndpoint: didServiceEndpointSchema
    });
    var didAuthenticationSchema = zod_1.z.union([
      //
      didRelativeUriSchema,
      didVerificationMethodSchema
    ]);
    exports.didDocumentSchema = zod_1.z.object({
      "@context": zod_1.z.union([
        zod_1.z.literal("https://www.w3.org/ns/did/v1"),
        zod_1.z.array(zod_1.z.string().url()).nonempty().refine((data) => data[0] === "https://www.w3.org/ns/did/v1", {
          message: "First @context must be https://www.w3.org/ns/did/v1"
        })
      ]),
      id: did_js_1.didSchema,
      controller: didControllerSchema.optional(),
      alsoKnownAs: zod_1.z.array(rfc3968UriSchema).optional(),
      service: zod_1.z.array(didServiceSchema).optional(),
      authentication: zod_1.z.array(didAuthenticationSchema).optional(),
      verificationMethod: zod_1.z.array(zod_1.z.union([didVerificationMethodSchema, didRelativeUriSchema])).optional()
    });
    exports.didDocumentValidator = exports.didDocumentSchema.superRefine(({ id: did, service }, ctx) => {
      if (service) {
        const visited = /* @__PURE__ */ new Set();
        for (let i = 0; i < service.length; i++) {
          const current = service[i];
          const serviceId = current.id.startsWith("#") ? `${did}${current.id}` : current.id;
          if (!visited.has(serviceId)) {
            visited.add(serviceId);
          } else {
            ctx.addIssue({
              code: zod_1.z.ZodIssueCode.custom,
              message: `Duplicate service id (${current.id}) found in the document`,
              path: ["service", i, "id"]
            });
          }
        }
      }
    });
  }
});

// node_modules/@atproto/did/dist/index.js
var require_dist15 = __commonJS({
  "node_modules/@atproto/did/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_atproto(), exports);
    __exportStar2(require_did_document(), exports);
    __exportStar2(require_did_error(), exports);
    __exportStar2(require_did4(), exports);
    __exportStar2(require_methods(), exports);
  }
});

// node_modules/lru-cache/dist/commonjs/index.js
var require_commonjs = __commonJS({
  "node_modules/lru-cache/dist/commonjs/index.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.LRUCache = void 0;
    var perf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
    var warned = /* @__PURE__ */ new Set();
    var PROCESS = typeof process === "object" && !!process ? process : {};
    var emitWarning = (msg, type, code2, fn) => {
      typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code2, fn) : console.error(`[${code2}] ${type}: ${msg}`);
    };
    var AC = globalThis.AbortController;
    var AS = globalThis.AbortSignal;
    if (typeof AC === "undefined") {
      AS = class AbortSignal {
        onabort;
        _onabort = [];
        reason;
        aborted = false;
        addEventListener(_, fn) {
          this._onabort.push(fn);
        }
      };
      AC = class AbortController {
        constructor() {
          warnACPolyfill();
        }
        signal = new AS();
        abort(reason) {
          if (this.signal.aborted)
            return;
          this.signal.reason = reason;
          this.signal.aborted = true;
          for (const fn of this.signal._onabort) {
            fn(reason);
          }
          this.signal.onabort?.(reason);
        }
      };
      let printACPolyfillWarning = PROCESS.env?.LRU_CACHE_IGNORE_AC_WARNING !== "1";
      const warnACPolyfill = () => {
        if (!printACPolyfillWarning)
          return;
        printACPolyfillWarning = false;
        emitWarning("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.", "NO_ABORT_CONTROLLER", "ENOTSUP", warnACPolyfill);
      };
    }
    var shouldWarn = (code2) => !warned.has(code2);
    var TYPE = Symbol("type");
    var isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n);
    var getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null;
    var ZeroArray = class extends Array {
      constructor(size) {
        super(size);
        this.fill(0);
      }
    };
    var Stack = class _Stack {
      heap;
      length;
      // private constructor
      static #constructing = false;
      static create(max) {
        const HeapCls = getUintArray(max);
        if (!HeapCls)
          return [];
        _Stack.#constructing = true;
        const s = new _Stack(max, HeapCls);
        _Stack.#constructing = false;
        return s;
      }
      constructor(max, HeapCls) {
        if (!_Stack.#constructing) {
          throw new TypeError("instantiate Stack using Stack.create(n)");
        }
        this.heap = new HeapCls(max);
        this.length = 0;
      }
      push(n) {
        this.heap[this.length++] = n;
      }
      pop() {
        return this.heap[--this.length];
      }
    };
    var LRUCache = class _LRUCache {
      // options that cannot be changed without disaster
      #max;
      #maxSize;
      #dispose;
      #disposeAfter;
      #fetchMethod;
      #memoMethod;
      /**
       * {@link LRUCache.OptionsBase.ttl}
       */
      ttl;
      /**
       * {@link LRUCache.OptionsBase.ttlResolution}
       */
      ttlResolution;
      /**
       * {@link LRUCache.OptionsBase.ttlAutopurge}
       */
      ttlAutopurge;
      /**
       * {@link LRUCache.OptionsBase.updateAgeOnGet}
       */
      updateAgeOnGet;
      /**
       * {@link LRUCache.OptionsBase.updateAgeOnHas}
       */
      updateAgeOnHas;
      /**
       * {@link LRUCache.OptionsBase.allowStale}
       */
      allowStale;
      /**
       * {@link LRUCache.OptionsBase.noDisposeOnSet}
       */
      noDisposeOnSet;
      /**
       * {@link LRUCache.OptionsBase.noUpdateTTL}
       */
      noUpdateTTL;
      /**
       * {@link LRUCache.OptionsBase.maxEntrySize}
       */
      maxEntrySize;
      /**
       * {@link LRUCache.OptionsBase.sizeCalculation}
       */
      sizeCalculation;
      /**
       * {@link LRUCache.OptionsBase.noDeleteOnFetchRejection}
       */
      noDeleteOnFetchRejection;
      /**
       * {@link LRUCache.OptionsBase.noDeleteOnStaleGet}
       */
      noDeleteOnStaleGet;
      /**
       * {@link LRUCache.OptionsBase.allowStaleOnFetchAbort}
       */
      allowStaleOnFetchAbort;
      /**
       * {@link LRUCache.OptionsBase.allowStaleOnFetchRejection}
       */
      allowStaleOnFetchRejection;
      /**
       * {@link LRUCache.OptionsBase.ignoreFetchAbort}
       */
      ignoreFetchAbort;
      // computed properties
      #size;
      #calculatedSize;
      #keyMap;
      #keyList;
      #valList;
      #next;
      #prev;
      #head;
      #tail;
      #free;
      #disposed;
      #sizes;
      #starts;
      #ttls;
      #hasDispose;
      #hasFetchMethod;
      #hasDisposeAfter;
      /**
       * Do not call this method unless you need to inspect the
       * inner workings of the cache.  If anything returned by this
       * object is modified in any way, strange breakage may occur.
       *
       * These fields are private for a reason!
       *
       * @internal
       */
      static unsafeExposeInternals(c) {
        return {
          // properties
          starts: c.#starts,
          ttls: c.#ttls,
          sizes: c.#sizes,
          keyMap: c.#keyMap,
          keyList: c.#keyList,
          valList: c.#valList,
          next: c.#next,
          prev: c.#prev,
          get head() {
            return c.#head;
          },
          get tail() {
            return c.#tail;
          },
          free: c.#free,
          // methods
          isBackgroundFetch: (p) => c.#isBackgroundFetch(p),
          backgroundFetch: (k, index, options, context) => c.#backgroundFetch(k, index, options, context),
          moveToTail: (index) => c.#moveToTail(index),
          indexes: (options) => c.#indexes(options),
          rindexes: (options) => c.#rindexes(options),
          isStale: (index) => c.#isStale(index)
        };
      }
      // Protected read-only members
      /**
       * {@link LRUCache.OptionsBase.max} (read-only)
       */
      get max() {
        return this.#max;
      }
      /**
       * {@link LRUCache.OptionsBase.maxSize} (read-only)
       */
      get maxSize() {
        return this.#maxSize;
      }
      /**
       * The total computed size of items in the cache (read-only)
       */
      get calculatedSize() {
        return this.#calculatedSize;
      }
      /**
       * The number of items stored in the cache (read-only)
       */
      get size() {
        return this.#size;
      }
      /**
       * {@link LRUCache.OptionsBase.fetchMethod} (read-only)
       */
      get fetchMethod() {
        return this.#fetchMethod;
      }
      get memoMethod() {
        return this.#memoMethod;
      }
      /**
       * {@link LRUCache.OptionsBase.dispose} (read-only)
       */
      get dispose() {
        return this.#dispose;
      }
      /**
       * {@link LRUCache.OptionsBase.disposeAfter} (read-only)
       */
      get disposeAfter() {
        return this.#disposeAfter;
      }
      constructor(options) {
        const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
        if (max !== 0 && !isPosInt(max)) {
          throw new TypeError("max option must be a nonnegative integer");
        }
        const UintArray = max ? getUintArray(max) : Array;
        if (!UintArray) {
          throw new Error("invalid max value: " + max);
        }
        this.#max = max;
        this.#maxSize = maxSize;
        this.maxEntrySize = maxEntrySize || this.#maxSize;
        this.sizeCalculation = sizeCalculation;
        if (this.sizeCalculation) {
          if (!this.#maxSize && !this.maxEntrySize) {
            throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");
          }
          if (typeof this.sizeCalculation !== "function") {
            throw new TypeError("sizeCalculation set to non-function");
          }
        }
        if (memoMethod !== void 0 && typeof memoMethod !== "function") {
          throw new TypeError("memoMethod must be a function if defined");
        }
        this.#memoMethod = memoMethod;
        if (fetchMethod !== void 0 && typeof fetchMethod !== "function") {
          throw new TypeError("fetchMethod must be a function if specified");
        }
        this.#fetchMethod = fetchMethod;
        this.#hasFetchMethod = !!fetchMethod;
        this.#keyMap = /* @__PURE__ */ new Map();
        this.#keyList = new Array(max).fill(void 0);
        this.#valList = new Array(max).fill(void 0);
        this.#next = new UintArray(max);
        this.#prev = new UintArray(max);
        this.#head = 0;
        this.#tail = 0;
        this.#free = Stack.create(max);
        this.#size = 0;
        this.#calculatedSize = 0;
        if (typeof dispose === "function") {
          this.#dispose = dispose;
        }
        if (typeof disposeAfter === "function") {
          this.#disposeAfter = disposeAfter;
          this.#disposed = [];
        } else {
          this.#disposeAfter = void 0;
          this.#disposed = void 0;
        }
        this.#hasDispose = !!this.#dispose;
        this.#hasDisposeAfter = !!this.#disposeAfter;
        this.noDisposeOnSet = !!noDisposeOnSet;
        this.noUpdateTTL = !!noUpdateTTL;
        this.noDeleteOnFetchRejection = !!noDeleteOnFetchRejection;
        this.allowStaleOnFetchRejection = !!allowStaleOnFetchRejection;
        this.allowStaleOnFetchAbort = !!allowStaleOnFetchAbort;
        this.ignoreFetchAbort = !!ignoreFetchAbort;
        if (this.maxEntrySize !== 0) {
          if (this.#maxSize !== 0) {
            if (!isPosInt(this.#maxSize)) {
              throw new TypeError("maxSize must be a positive integer if specified");
            }
          }
          if (!isPosInt(this.maxEntrySize)) {
            throw new TypeError("maxEntrySize must be a positive integer if specified");
          }
          this.#initializeSizeTracking();
        }
        this.allowStale = !!allowStale;
        this.noDeleteOnStaleGet = !!noDeleteOnStaleGet;
        this.updateAgeOnGet = !!updateAgeOnGet;
        this.updateAgeOnHas = !!updateAgeOnHas;
        this.ttlResolution = isPosInt(ttlResolution) || ttlResolution === 0 ? ttlResolution : 1;
        this.ttlAutopurge = !!ttlAutopurge;
        this.ttl = ttl || 0;
        if (this.ttl) {
          if (!isPosInt(this.ttl)) {
            throw new TypeError("ttl must be a positive integer if specified");
          }
          this.#initializeTTLTracking();
        }
        if (this.#max === 0 && this.ttl === 0 && this.#maxSize === 0) {
          throw new TypeError("At least one of max, maxSize, or ttl is required");
        }
        if (!this.ttlAutopurge && !this.#max && !this.#maxSize) {
          const code2 = "LRU_CACHE_UNBOUNDED";
          if (shouldWarn(code2)) {
            warned.add(code2);
            const msg = "TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.";
            emitWarning(msg, "UnboundedCacheWarning", code2, _LRUCache);
          }
        }
      }
      /**
       * Return the number of ms left in the item's TTL. If item is not in cache,
       * returns `0`. Returns `Infinity` if item is in cache without a defined TTL.
       */
      getRemainingTTL(key) {
        return this.#keyMap.has(key) ? Infinity : 0;
      }
      #initializeTTLTracking() {
        const ttls = new ZeroArray(this.#max);
        const starts = new ZeroArray(this.#max);
        this.#ttls = ttls;
        this.#starts = starts;
        this.#setItemTTL = (index, ttl, start = perf.now()) => {
          starts[index] = ttl !== 0 ? start : 0;
          ttls[index] = ttl;
          if (ttl !== 0 && this.ttlAutopurge) {
            const t = setTimeout(() => {
              if (this.#isStale(index)) {
                this.#delete(this.#keyList[index], "expire");
              }
            }, ttl + 1);
            if (t.unref) {
              t.unref();
            }
          }
        };
        this.#updateItemAge = (index) => {
          starts[index] = ttls[index] !== 0 ? perf.now() : 0;
        };
        this.#statusTTL = (status, index) => {
          if (ttls[index]) {
            const ttl = ttls[index];
            const start = starts[index];
            if (!ttl || !start)
              return;
            status.ttl = ttl;
            status.start = start;
            status.now = cachedNow || getNow();
            const age = status.now - start;
            status.remainingTTL = ttl - age;
          }
        };
        let cachedNow = 0;
        const getNow = () => {
          const n = perf.now();
          if (this.ttlResolution > 0) {
            cachedNow = n;
            const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
            if (t.unref) {
              t.unref();
            }
          }
          return n;
        };
        this.getRemainingTTL = (key) => {
          const index = this.#keyMap.get(key);
          if (index === void 0) {
            return 0;
          }
          const ttl = ttls[index];
          const start = starts[index];
          if (!ttl || !start) {
            return Infinity;
          }
          const age = (cachedNow || getNow()) - start;
          return ttl - age;
        };
        this.#isStale = (index) => {
          const s = starts[index];
          const t = ttls[index];
          return !!t && !!s && (cachedNow || getNow()) - s > t;
        };
      }
      // conditionally set private methods related to TTL
      #updateItemAge = () => {
      };
      #statusTTL = () => {
      };
      #setItemTTL = () => {
      };
      /* c8 ignore stop */
      #isStale = () => false;
      #initializeSizeTracking() {
        const sizes = new ZeroArray(this.#max);
        this.#calculatedSize = 0;
        this.#sizes = sizes;
        this.#removeItemSize = (index) => {
          this.#calculatedSize -= sizes[index];
          sizes[index] = 0;
        };
        this.#requireSize = (k, v, size, sizeCalculation) => {
          if (this.#isBackgroundFetch(v)) {
            return 0;
          }
          if (!isPosInt(size)) {
            if (sizeCalculation) {
              if (typeof sizeCalculation !== "function") {
                throw new TypeError("sizeCalculation must be a function");
              }
              size = sizeCalculation(v, k);
              if (!isPosInt(size)) {
                throw new TypeError("sizeCalculation return invalid (expect positive integer)");
              }
            } else {
              throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");
            }
          }
          return size;
        };
        this.#addItemSize = (index, size, status) => {
          sizes[index] = size;
          if (this.#maxSize) {
            const maxSize = this.#maxSize - sizes[index];
            while (this.#calculatedSize > maxSize) {
              this.#evict(true);
            }
          }
          this.#calculatedSize += sizes[index];
          if (status) {
            status.entrySize = size;
            status.totalCalculatedSize = this.#calculatedSize;
          }
        };
      }
      #removeItemSize = (_i) => {
      };
      #addItemSize = (_i, _s, _st) => {
      };
      #requireSize = (_k, _v, size, sizeCalculation) => {
        if (size || sizeCalculation) {
          throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");
        }
        return 0;
      };
      *#indexes({ allowStale = this.allowStale } = {}) {
        if (this.#size) {
          for (let i = this.#tail; true; ) {
            if (!this.#isValidIndex(i)) {
              break;
            }
            if (allowStale || !this.#isStale(i)) {
              yield i;
            }
            if (i === this.#head) {
              break;
            } else {
              i = this.#prev[i];
            }
          }
        }
      }
      *#rindexes({ allowStale = this.allowStale } = {}) {
        if (this.#size) {
          for (let i = this.#head; true; ) {
            if (!this.#isValidIndex(i)) {
              break;
            }
            if (allowStale || !this.#isStale(i)) {
              yield i;
            }
            if (i === this.#tail) {
              break;
            } else {
              i = this.#next[i];
            }
          }
        }
      }
      #isValidIndex(index) {
        return index !== void 0 && this.#keyMap.get(this.#keyList[index]) === index;
      }
      /**
       * Return a generator yielding `[key, value]` pairs,
       * in order from most recently used to least recently used.
       */
      *entries() {
        for (const i of this.#indexes()) {
          if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
            yield [this.#keyList[i], this.#valList[i]];
          }
        }
      }
      /**
       * Inverse order version of {@link LRUCache.entries}
       *
       * Return a generator yielding `[key, value]` pairs,
       * in order from least recently used to most recently used.
       */
      *rentries() {
        for (const i of this.#rindexes()) {
          if (this.#valList[i] !== void 0 && this.#keyList[i] !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
            yield [this.#keyList[i], this.#valList[i]];
          }
        }
      }
      /**
       * Return a generator yielding the keys in the cache,
       * in order from most recently used to least recently used.
       */
      *keys() {
        for (const i of this.#indexes()) {
          const k = this.#keyList[i];
          if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
            yield k;
          }
        }
      }
      /**
       * Inverse order version of {@link LRUCache.keys}
       *
       * Return a generator yielding the keys in the cache,
       * in order from least recently used to most recently used.
       */
      *rkeys() {
        for (const i of this.#rindexes()) {
          const k = this.#keyList[i];
          if (k !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
            yield k;
          }
        }
      }
      /**
       * Return a generator yielding the values in the cache,
       * in order from most recently used to least recently used.
       */
      *values() {
        for (const i of this.#indexes()) {
          const v = this.#valList[i];
          if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
            yield this.#valList[i];
          }
        }
      }
      /**
       * Inverse order version of {@link LRUCache.values}
       *
       * Return a generator yielding the values in the cache,
       * in order from least recently used to most recently used.
       */
      *rvalues() {
        for (const i of this.#rindexes()) {
          const v = this.#valList[i];
          if (v !== void 0 && !this.#isBackgroundFetch(this.#valList[i])) {
            yield this.#valList[i];
          }
        }
      }
      /**
       * Iterating over the cache itself yields the same results as
       * {@link LRUCache.entries}
       */
      [Symbol.iterator]() {
        return this.entries();
      }
      /**
       * A String value that is used in the creation of the default string
       * description of an object. Called by the built-in method
       * `Object.prototype.toString`.
       */
      [Symbol.toStringTag] = "LRUCache";
      /**
       * Find a value for which the supplied fn method returns a truthy value,
       * similar to `Array.find()`. fn is called as `fn(value, key, cache)`.
       */
      find(fn, getOptions = {}) {
        for (const i of this.#indexes()) {
          const v = this.#valList[i];
          const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
          if (value === void 0)
            continue;
          if (fn(value, this.#keyList[i], this)) {
            return this.get(this.#keyList[i], getOptions);
          }
        }
      }
      /**
       * Call the supplied function on each item in the cache, in order from most
       * recently used to least recently used.
       *
       * `fn` is called as `fn(value, key, cache)`.
       *
       * If `thisp` is provided, function will be called in the `this`-context of
       * the provided object, or the cache if no `thisp` object is provided.
       *
       * Does not update age or recenty of use, or iterate over stale values.
       */
      forEach(fn, thisp = this) {
        for (const i of this.#indexes()) {
          const v = this.#valList[i];
          const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
          if (value === void 0)
            continue;
          fn.call(thisp, value, this.#keyList[i], this);
        }
      }
      /**
       * The same as {@link LRUCache.forEach} but items are iterated over in
       * reverse order.  (ie, less recently used items are iterated over first.)
       */
      rforEach(fn, thisp = this) {
        for (const i of this.#rindexes()) {
          const v = this.#valList[i];
          const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
          if (value === void 0)
            continue;
          fn.call(thisp, value, this.#keyList[i], this);
        }
      }
      /**
       * Delete any stale entries. Returns true if anything was removed,
       * false otherwise.
       */
      purgeStale() {
        let deleted = false;
        for (const i of this.#rindexes({ allowStale: true })) {
          if (this.#isStale(i)) {
            this.#delete(this.#keyList[i], "expire");
            deleted = true;
          }
        }
        return deleted;
      }
      /**
       * Get the extended info about a given entry, to get its value, size, and
       * TTL info simultaneously. Returns `undefined` if the key is not present.
       *
       * Unlike {@link LRUCache#dump}, which is designed to be portable and survive
       * serialization, the `start` value is always the current timestamp, and the
       * `ttl` is a calculated remaining time to live (negative if expired).
       *
       * Always returns stale values, if their info is found in the cache, so be
       * sure to check for expirations (ie, a negative {@link LRUCache.Entry#ttl})
       * if relevant.
       */
      info(key) {
        const i = this.#keyMap.get(key);
        if (i === void 0)
          return void 0;
        const v = this.#valList[i];
        const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
        if (value === void 0)
          return void 0;
        const entry = { value };
        if (this.#ttls && this.#starts) {
          const ttl = this.#ttls[i];
          const start = this.#starts[i];
          if (ttl && start) {
            const remain = ttl - (perf.now() - start);
            entry.ttl = remain;
            entry.start = Date.now();
          }
        }
        if (this.#sizes) {
          entry.size = this.#sizes[i];
        }
        return entry;
      }
      /**
       * Return an array of [key, {@link LRUCache.Entry}] tuples which can be
       * passed to {@link LRLUCache#load}.
       *
       * The `start` fields are calculated relative to a portable `Date.now()`
       * timestamp, even if `performance.now()` is available.
       *
       * Stale entries are always included in the `dump`, even if
       * {@link LRUCache.OptionsBase.allowStale} is false.
       *
       * Note: this returns an actual array, not a generator, so it can be more
       * easily passed around.
       */
      dump() {
        const arr = [];
        for (const i of this.#indexes({ allowStale: true })) {
          const key = this.#keyList[i];
          const v = this.#valList[i];
          const value = this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
          if (value === void 0 || key === void 0)
            continue;
          const entry = { value };
          if (this.#ttls && this.#starts) {
            entry.ttl = this.#ttls[i];
            const age = perf.now() - this.#starts[i];
            entry.start = Math.floor(Date.now() - age);
          }
          if (this.#sizes) {
            entry.size = this.#sizes[i];
          }
          arr.unshift([key, entry]);
        }
        return arr;
      }
      /**
       * Reset the cache and load in the items in entries in the order listed.
       *
       * The shape of the resulting cache may be different if the same options are
       * not used in both caches.
       *
       * The `start` fields are assumed to be calculated relative to a portable
       * `Date.now()` timestamp, even if `performance.now()` is available.
       */
      load(arr) {
        this.clear();
        for (const [key, entry] of arr) {
          if (entry.start) {
            const age = Date.now() - entry.start;
            entry.start = perf.now() - age;
          }
          this.set(key, entry.value, entry);
        }
      }
      /**
       * Add a value to the cache.
       *
       * Note: if `undefined` is specified as a value, this is an alias for
       * {@link LRUCache#delete}
       *
       * Fields on the {@link LRUCache.SetOptions} options param will override
       * their corresponding values in the constructor options for the scope
       * of this single `set()` operation.
       *
       * If `start` is provided, then that will set the effective start
       * time for the TTL calculation. Note that this must be a previous
       * value of `performance.now()` if supported, or a previous value of
       * `Date.now()` if not.
       *
       * Options object may also include `size`, which will prevent
       * calling the `sizeCalculation` function and just use the specified
       * number if it is a positive integer, and `noDisposeOnSet` which
       * will prevent calling a `dispose` function in the case of
       * overwrites.
       *
       * If the `size` (or return value of `sizeCalculation`) for a given
       * entry is greater than `maxEntrySize`, then the item will not be
       * added to the cache.
       *
       * Will update the recency of the entry.
       *
       * If the value is `undefined`, then this is an alias for
       * `cache.delete(key)`. `undefined` is never stored in the cache.
       */
      set(k, v, setOptions = {}) {
        if (v === void 0) {
          this.delete(k);
          return this;
        }
        const { ttl = this.ttl, start, noDisposeOnSet = this.noDisposeOnSet, sizeCalculation = this.sizeCalculation, status } = setOptions;
        let { noUpdateTTL = this.noUpdateTTL } = setOptions;
        const size = this.#requireSize(k, v, setOptions.size || 0, sizeCalculation);
        if (this.maxEntrySize && size > this.maxEntrySize) {
          if (status) {
            status.set = "miss";
            status.maxEntrySizeExceeded = true;
          }
          this.#delete(k, "set");
          return this;
        }
        let index = this.#size === 0 ? void 0 : this.#keyMap.get(k);
        if (index === void 0) {
          index = this.#size === 0 ? this.#tail : this.#free.length !== 0 ? this.#free.pop() : this.#size === this.#max ? this.#evict(false) : this.#size;
          this.#keyList[index] = k;
          this.#valList[index] = v;
          this.#keyMap.set(k, index);
          this.#next[this.#tail] = index;
          this.#prev[index] = this.#tail;
          this.#tail = index;
          this.#size++;
          this.#addItemSize(index, size, status);
          if (status)
            status.set = "add";
          noUpdateTTL = false;
        } else {
          this.#moveToTail(index);
          const oldVal = this.#valList[index];
          if (v !== oldVal) {
            if (this.#hasFetchMethod && this.#isBackgroundFetch(oldVal)) {
              oldVal.__abortController.abort(new Error("replaced"));
              const { __staleWhileFetching: s } = oldVal;
              if (s !== void 0 && !noDisposeOnSet) {
                if (this.#hasDispose) {
                  this.#dispose?.(s, k, "set");
                }
                if (this.#hasDisposeAfter) {
                  this.#disposed?.push([s, k, "set"]);
                }
              }
            } else if (!noDisposeOnSet) {
              if (this.#hasDispose) {
                this.#dispose?.(oldVal, k, "set");
              }
              if (this.#hasDisposeAfter) {
                this.#disposed?.push([oldVal, k, "set"]);
              }
            }
            this.#removeItemSize(index);
            this.#addItemSize(index, size, status);
            this.#valList[index] = v;
            if (status) {
              status.set = "replace";
              const oldValue = oldVal && this.#isBackgroundFetch(oldVal) ? oldVal.__staleWhileFetching : oldVal;
              if (oldValue !== void 0)
                status.oldValue = oldValue;
            }
          } else if (status) {
            status.set = "update";
          }
        }
        if (ttl !== 0 && !this.#ttls) {
          this.#initializeTTLTracking();
        }
        if (this.#ttls) {
          if (!noUpdateTTL) {
            this.#setItemTTL(index, ttl, start);
          }
          if (status)
            this.#statusTTL(status, index);
        }
        if (!noDisposeOnSet && this.#hasDisposeAfter && this.#disposed) {
          const dt = this.#disposed;
          let task;
          while (task = dt?.shift()) {
            this.#disposeAfter?.(...task);
          }
        }
        return this;
      }
      /**
       * Evict the least recently used item, returning its value or
       * `undefined` if cache is empty.
       */
      pop() {
        try {
          while (this.#size) {
            const val = this.#valList[this.#head];
            this.#evict(true);
            if (this.#isBackgroundFetch(val)) {
              if (val.__staleWhileFetching) {
                return val.__staleWhileFetching;
              }
            } else if (val !== void 0) {
              return val;
            }
          }
        } finally {
          if (this.#hasDisposeAfter && this.#disposed) {
            const dt = this.#disposed;
            let task;
            while (task = dt?.shift()) {
              this.#disposeAfter?.(...task);
            }
          }
        }
      }
      #evict(free) {
        const head = this.#head;
        const k = this.#keyList[head];
        const v = this.#valList[head];
        if (this.#hasFetchMethod && this.#isBackgroundFetch(v)) {
          v.__abortController.abort(new Error("evicted"));
        } else if (this.#hasDispose || this.#hasDisposeAfter) {
          if (this.#hasDispose) {
            this.#dispose?.(v, k, "evict");
          }
          if (this.#hasDisposeAfter) {
            this.#disposed?.push([v, k, "evict"]);
          }
        }
        this.#removeItemSize(head);
        if (free) {
          this.#keyList[head] = void 0;
          this.#valList[head] = void 0;
          this.#free.push(head);
        }
        if (this.#size === 1) {
          this.#head = this.#tail = 0;
          this.#free.length = 0;
        } else {
          this.#head = this.#next[head];
        }
        this.#keyMap.delete(k);
        this.#size--;
        return head;
      }
      /**
       * Check if a key is in the cache, without updating the recency of use.
       * Will return false if the item is stale, even though it is technically
       * in the cache.
       *
       * Check if a key is in the cache, without updating the recency of
       * use. Age is updated if {@link LRUCache.OptionsBase.updateAgeOnHas} is set
       * to `true` in either the options or the constructor.
       *
       * Will return `false` if the item is stale, even though it is technically in
       * the cache. The difference can be determined (if it matters) by using a
       * `status` argument, and inspecting the `has` field.
       *
       * Will not update item age unless
       * {@link LRUCache.OptionsBase.updateAgeOnHas} is set.
       */
      has(k, hasOptions = {}) {
        const { updateAgeOnHas = this.updateAgeOnHas, status } = hasOptions;
        const index = this.#keyMap.get(k);
        if (index !== void 0) {
          const v = this.#valList[index];
          if (this.#isBackgroundFetch(v) && v.__staleWhileFetching === void 0) {
            return false;
          }
          if (!this.#isStale(index)) {
            if (updateAgeOnHas) {
              this.#updateItemAge(index);
            }
            if (status) {
              status.has = "hit";
              this.#statusTTL(status, index);
            }
            return true;
          } else if (status) {
            status.has = "stale";
            this.#statusTTL(status, index);
          }
        } else if (status) {
          status.has = "miss";
        }
        return false;
      }
      /**
       * Like {@link LRUCache#get} but doesn't update recency or delete stale
       * items.
       *
       * Returns `undefined` if the item is stale, unless
       * {@link LRUCache.OptionsBase.allowStale} is set.
       */
      peek(k, peekOptions = {}) {
        const { allowStale = this.allowStale } = peekOptions;
        const index = this.#keyMap.get(k);
        if (index === void 0 || !allowStale && this.#isStale(index)) {
          return;
        }
        const v = this.#valList[index];
        return this.#isBackgroundFetch(v) ? v.__staleWhileFetching : v;
      }
      #backgroundFetch(k, index, options, context) {
        const v = index === void 0 ? void 0 : this.#valList[index];
        if (this.#isBackgroundFetch(v)) {
          return v;
        }
        const ac = new AC();
        const { signal } = options;
        signal?.addEventListener("abort", () => ac.abort(signal.reason), {
          signal: ac.signal
        });
        const fetchOpts = {
          signal: ac.signal,
          options,
          context
        };
        const cb = (v2, updateCache = false) => {
          const { aborted } = ac.signal;
          const ignoreAbort = options.ignoreFetchAbort && v2 !== void 0;
          if (options.status) {
            if (aborted && !updateCache) {
              options.status.fetchAborted = true;
              options.status.fetchError = ac.signal.reason;
              if (ignoreAbort)
                options.status.fetchAbortIgnored = true;
            } else {
              options.status.fetchResolved = true;
            }
          }
          if (aborted && !ignoreAbort && !updateCache) {
            return fetchFail(ac.signal.reason);
          }
          const bf2 = p;
          if (this.#valList[index] === p) {
            if (v2 === void 0) {
              if (bf2.__staleWhileFetching) {
                this.#valList[index] = bf2.__staleWhileFetching;
              } else {
                this.#delete(k, "fetch");
              }
            } else {
              if (options.status)
                options.status.fetchUpdated = true;
              this.set(k, v2, fetchOpts.options);
            }
          }
          return v2;
        };
        const eb = (er) => {
          if (options.status) {
            options.status.fetchRejected = true;
            options.status.fetchError = er;
          }
          return fetchFail(er);
        };
        const fetchFail = (er) => {
          const { aborted } = ac.signal;
          const allowStaleAborted = aborted && options.allowStaleOnFetchAbort;
          const allowStale = allowStaleAborted || options.allowStaleOnFetchRejection;
          const noDelete = allowStale || options.noDeleteOnFetchRejection;
          const bf2 = p;
          if (this.#valList[index] === p) {
            const del = !noDelete || bf2.__staleWhileFetching === void 0;
            if (del) {
              this.#delete(k, "fetch");
            } else if (!allowStaleAborted) {
              this.#valList[index] = bf2.__staleWhileFetching;
            }
          }
          if (allowStale) {
            if (options.status && bf2.__staleWhileFetching !== void 0) {
              options.status.returnedStale = true;
            }
            return bf2.__staleWhileFetching;
          } else if (bf2.__returned === bf2) {
            throw er;
          }
        };
        const pcall = (res, rej) => {
          const fmp = this.#fetchMethod?.(k, v, fetchOpts);
          if (fmp && fmp instanceof Promise) {
            fmp.then((v2) => res(v2 === void 0 ? void 0 : v2), rej);
          }
          ac.signal.addEventListener("abort", () => {
            if (!options.ignoreFetchAbort || options.allowStaleOnFetchAbort) {
              res(void 0);
              if (options.allowStaleOnFetchAbort) {
                res = (v2) => cb(v2, true);
              }
            }
          });
        };
        if (options.status)
          options.status.fetchDispatched = true;
        const p = new Promise(pcall).then(cb, eb);
        const bf = Object.assign(p, {
          __abortController: ac,
          __staleWhileFetching: v,
          __returned: void 0
        });
        if (index === void 0) {
          this.set(k, bf, { ...fetchOpts.options, status: void 0 });
          index = this.#keyMap.get(k);
        } else {
          this.#valList[index] = bf;
        }
        return bf;
      }
      #isBackgroundFetch(p) {
        if (!this.#hasFetchMethod)
          return false;
        const b = p;
        return !!b && b instanceof Promise && b.hasOwnProperty("__staleWhileFetching") && b.__abortController instanceof AC;
      }
      async fetch(k, fetchOptions = {}) {
        const {
          // get options
          allowStale = this.allowStale,
          updateAgeOnGet = this.updateAgeOnGet,
          noDeleteOnStaleGet = this.noDeleteOnStaleGet,
          // set options
          ttl = this.ttl,
          noDisposeOnSet = this.noDisposeOnSet,
          size = 0,
          sizeCalculation = this.sizeCalculation,
          noUpdateTTL = this.noUpdateTTL,
          // fetch exclusive options
          noDeleteOnFetchRejection = this.noDeleteOnFetchRejection,
          allowStaleOnFetchRejection = this.allowStaleOnFetchRejection,
          ignoreFetchAbort = this.ignoreFetchAbort,
          allowStaleOnFetchAbort = this.allowStaleOnFetchAbort,
          context,
          forceRefresh = false,
          status,
          signal
        } = fetchOptions;
        if (!this.#hasFetchMethod) {
          if (status)
            status.fetch = "get";
          return this.get(k, {
            allowStale,
            updateAgeOnGet,
            noDeleteOnStaleGet,
            status
          });
        }
        const options = {
          allowStale,
          updateAgeOnGet,
          noDeleteOnStaleGet,
          ttl,
          noDisposeOnSet,
          size,
          sizeCalculation,
          noUpdateTTL,
          noDeleteOnFetchRejection,
          allowStaleOnFetchRejection,
          allowStaleOnFetchAbort,
          ignoreFetchAbort,
          status,
          signal
        };
        let index = this.#keyMap.get(k);
        if (index === void 0) {
          if (status)
            status.fetch = "miss";
          const p = this.#backgroundFetch(k, index, options, context);
          return p.__returned = p;
        } else {
          const v = this.#valList[index];
          if (this.#isBackgroundFetch(v)) {
            const stale = allowStale && v.__staleWhileFetching !== void 0;
            if (status) {
              status.fetch = "inflight";
              if (stale)
                status.returnedStale = true;
            }
            return stale ? v.__staleWhileFetching : v.__returned = v;
          }
          const isStale = this.#isStale(index);
          if (!forceRefresh && !isStale) {
            if (status)
              status.fetch = "hit";
            this.#moveToTail(index);
            if (updateAgeOnGet) {
              this.#updateItemAge(index);
            }
            if (status)
              this.#statusTTL(status, index);
            return v;
          }
          const p = this.#backgroundFetch(k, index, options, context);
          const hasStale = p.__staleWhileFetching !== void 0;
          const staleVal = hasStale && allowStale;
          if (status) {
            status.fetch = isStale ? "stale" : "refresh";
            if (staleVal && isStale)
              status.returnedStale = true;
          }
          return staleVal ? p.__staleWhileFetching : p.__returned = p;
        }
      }
      async forceFetch(k, fetchOptions = {}) {
        const v = await this.fetch(k, fetchOptions);
        if (v === void 0)
          throw new Error("fetch() returned undefined");
        return v;
      }
      memo(k, memoOptions = {}) {
        const memoMethod = this.#memoMethod;
        if (!memoMethod) {
          throw new Error("no memoMethod provided to constructor");
        }
        const { context, forceRefresh, ...options } = memoOptions;
        const v = this.get(k, options);
        if (!forceRefresh && v !== void 0)
          return v;
        const vv = memoMethod(k, v, {
          options,
          context
        });
        this.set(k, vv, options);
        return vv;
      }
      /**
       * Return a value from the cache. Will update the recency of the cache
       * entry found.
       *
       * If the key is not found, get() will return `undefined`.
       */
      get(k, getOptions = {}) {
        const { allowStale = this.allowStale, updateAgeOnGet = this.updateAgeOnGet, noDeleteOnStaleGet = this.noDeleteOnStaleGet, status } = getOptions;
        const index = this.#keyMap.get(k);
        if (index !== void 0) {
          const value = this.#valList[index];
          const fetching = this.#isBackgroundFetch(value);
          if (status)
            this.#statusTTL(status, index);
          if (this.#isStale(index)) {
            if (status)
              status.get = "stale";
            if (!fetching) {
              if (!noDeleteOnStaleGet) {
                this.#delete(k, "expire");
              }
              if (status && allowStale)
                status.returnedStale = true;
              return allowStale ? value : void 0;
            } else {
              if (status && allowStale && value.__staleWhileFetching !== void 0) {
                status.returnedStale = true;
              }
              return allowStale ? value.__staleWhileFetching : void 0;
            }
          } else {
            if (status)
              status.get = "hit";
            if (fetching) {
              return value.__staleWhileFetching;
            }
            this.#moveToTail(index);
            if (updateAgeOnGet) {
              this.#updateItemAge(index);
            }
            return value;
          }
        } else if (status) {
          status.get = "miss";
        }
      }
      #connect(p, n) {
        this.#prev[n] = p;
        this.#next[p] = n;
      }
      #moveToTail(index) {
        if (index !== this.#tail) {
          if (index === this.#head) {
            this.#head = this.#next[index];
          } else {
            this.#connect(this.#prev[index], this.#next[index]);
          }
          this.#connect(this.#tail, index);
          this.#tail = index;
        }
      }
      /**
       * Deletes a key out of the cache.
       *
       * Returns true if the key was deleted, false otherwise.
       */
      delete(k) {
        return this.#delete(k, "delete");
      }
      #delete(k, reason) {
        let deleted = false;
        if (this.#size !== 0) {
          const index = this.#keyMap.get(k);
          if (index !== void 0) {
            deleted = true;
            if (this.#size === 1) {
              this.#clear(reason);
            } else {
              this.#removeItemSize(index);
              const v = this.#valList[index];
              if (this.#isBackgroundFetch(v)) {
                v.__abortController.abort(new Error("deleted"));
              } else if (this.#hasDispose || this.#hasDisposeAfter) {
                if (this.#hasDispose) {
                  this.#dispose?.(v, k, reason);
                }
                if (this.#hasDisposeAfter) {
                  this.#disposed?.push([v, k, reason]);
                }
              }
              this.#keyMap.delete(k);
              this.#keyList[index] = void 0;
              this.#valList[index] = void 0;
              if (index === this.#tail) {
                this.#tail = this.#prev[index];
              } else if (index === this.#head) {
                this.#head = this.#next[index];
              } else {
                const pi = this.#prev[index];
                this.#next[pi] = this.#next[index];
                const ni = this.#next[index];
                this.#prev[ni] = this.#prev[index];
              }
              this.#size--;
              this.#free.push(index);
            }
          }
        }
        if (this.#hasDisposeAfter && this.#disposed?.length) {
          const dt = this.#disposed;
          let task;
          while (task = dt?.shift()) {
            this.#disposeAfter?.(...task);
          }
        }
        return deleted;
      }
      /**
       * Clear the cache entirely, throwing away all values.
       */
      clear() {
        return this.#clear("delete");
      }
      #clear(reason) {
        for (const index of this.#rindexes({ allowStale: true })) {
          const v = this.#valList[index];
          if (this.#isBackgroundFetch(v)) {
            v.__abortController.abort(new Error("deleted"));
          } else {
            const k = this.#keyList[index];
            if (this.#hasDispose) {
              this.#dispose?.(v, k, reason);
            }
            if (this.#hasDisposeAfter) {
              this.#disposed?.push([v, k, reason]);
            }
          }
        }
        this.#keyMap.clear();
        this.#valList.fill(void 0);
        this.#keyList.fill(void 0);
        if (this.#ttls && this.#starts) {
          this.#ttls.fill(0);
          this.#starts.fill(0);
        }
        if (this.#sizes) {
          this.#sizes.fill(0);
        }
        this.#head = 0;
        this.#tail = 0;
        this.#free.length = 0;
        this.#calculatedSize = 0;
        this.#size = 0;
        if (this.#hasDisposeAfter && this.#disposed) {
          const dt = this.#disposed;
          let task;
          while (task = dt?.shift()) {
            this.#disposeAfter?.(...task);
          }
        }
      }
    };
    exports.LRUCache = LRUCache;
  }
});

// node_modules/@atproto-labs/simple-store-memory/dist/util.js
var require_util14 = __commonJS({
  "node_modules/@atproto-labs/simple-store-memory/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.roughSizeOfObject = roughSizeOfObject;
    var knownSizes = /* @__PURE__ */ new WeakMap();
    function roughSizeOfObject(value) {
      const objectList = /* @__PURE__ */ new Set();
      const stack = [value];
      let bytes = 0;
      while (stack.length) {
        const value2 = stack.pop();
        switch (typeof value2) {
          // Types are ordered by frequency
          case "string":
            bytes += 12 + 4 * Math.ceil(value2.length / 4);
            break;
          case "number":
            bytes += 12;
            break;
          case "boolean":
            bytes += 4;
            break;
          case "object":
            bytes += 4;
            if (value2 === null) {
              break;
            }
            if (knownSizes.has(value2)) {
              bytes += knownSizes.get(value2);
              break;
            }
            if (objectList.has(value2))
              continue;
            objectList.add(value2);
            if (Array.isArray(value2)) {
              bytes += 4;
              stack.push(...value2);
            } else {
              bytes += 8;
              const keys = Object.getOwnPropertyNames(value2);
              for (let i = 0; i < keys.length; i++) {
                bytes += 4;
                const key = keys[i];
                const val = value2[key];
                if (val !== void 0)
                  stack.push(val);
                stack.push(key);
              }
            }
            break;
          case "function":
            bytes += 8;
            break;
          case "symbol":
            bytes += 8;
            break;
          case "bigint":
            bytes += 16;
            break;
        }
      }
      if (typeof value === "object" && value !== null) {
        knownSizes.set(value, bytes);
      }
      return bytes;
    }
  }
});

// node_modules/@atproto-labs/simple-store-memory/dist/index.js
var require_dist16 = __commonJS({
  "node_modules/@atproto-labs/simple-store-memory/dist/index.js"(exports) {
    "use strict";
    var __classPrivateFieldSet2 = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
      if (kind === "m") throw new TypeError("Private method is not writable");
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
      return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
    };
    var __classPrivateFieldGet2 = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
      return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
    };
    var _SimpleStoreMemory_cache;
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.SimpleStoreMemory = void 0;
    var lru_cache_1 = require_commonjs();
    var util_js_1 = require_util14();
    var nullSymbol = Symbol("nullItem");
    var toLruValue = (value) => value === null ? nullSymbol : value;
    var fromLruValue = (value) => value === nullSymbol ? null : value;
    var SimpleStoreMemory = class {
      constructor({ sizeCalculation, ...options }) {
        _SimpleStoreMemory_cache.set(this, void 0);
        __classPrivateFieldSet2(this, _SimpleStoreMemory_cache, new lru_cache_1.LRUCache({
          ...options,
          allowStale: false,
          updateAgeOnGet: false,
          updateAgeOnHas: false,
          sizeCalculation: sizeCalculation ? (value, key) => sizeCalculation(fromLruValue(value), key) : options.maxEntrySize != null || options.maxSize != null ? (
            // maxEntrySize and maxSize require a size calculation function.
            util_js_1.roughSizeOfObject
          ) : void 0
        }), "f");
      }
      get(key) {
        const value = __classPrivateFieldGet2(this, _SimpleStoreMemory_cache, "f").get(key);
        if (value === void 0)
          return void 0;
        return fromLruValue(value);
      }
      set(key, value) {
        __classPrivateFieldGet2(this, _SimpleStoreMemory_cache, "f").set(key, toLruValue(value));
      }
      del(key) {
        __classPrivateFieldGet2(this, _SimpleStoreMemory_cache, "f").delete(key);
      }
      clear() {
        __classPrivateFieldGet2(this, _SimpleStoreMemory_cache, "f").clear();
      }
    };
    exports.SimpleStoreMemory = SimpleStoreMemory;
    _SimpleStoreMemory_cache = /* @__PURE__ */ new WeakMap();
  }
});

// node_modules/@atproto-labs/did-resolver/dist/did-cache-memory.js
var require_did_cache_memory = __commonJS({
  "node_modules/@atproto-labs/did-resolver/dist/did-cache-memory.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DidCacheMemory = void 0;
    var simple_store_memory_1 = require_dist16();
    var DEFAULT_TTL = 3600 * 1e3;
    var DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
    var DidCacheMemory = class extends simple_store_memory_1.SimpleStoreMemory {
      constructor(options) {
        super(options?.max == null ? { ttl: DEFAULT_TTL, maxSize: DEFAULT_MAX_SIZE, ...options } : { ttl: DEFAULT_TTL, ...options });
      }
    };
    exports.DidCacheMemory = DidCacheMemory;
  }
});

// node_modules/@atproto-labs/simple-store/dist/cached-getter.js
var require_cached_getter = __commonJS({
  "node_modules/@atproto-labs/simple-store/dist/cached-getter.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.CachedGetter = void 0;
    var returnTrue = () => true;
    var returnFalse = () => false;
    var CachedGetter = class {
      constructor(getter, store, options = {}) {
        Object.defineProperty(this, "getter", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: getter
        });
        Object.defineProperty(this, "store", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: store
        });
        Object.defineProperty(this, "options", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: options
        });
        Object.defineProperty(this, "pending", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: /* @__PURE__ */ new Map()
        });
      }
      async get(key, { signal, context, allowStale = false, noCache = false } = {}) {
        signal?.throwIfAborted();
        const { isStale, deleteOnError } = this.options;
        const allowStored = noCache ? returnFalse : allowStale || isStale == null ? returnTrue : async (value2) => !await isStale(key, value2);
        let previousExecutionFlow;
        while (previousExecutionFlow = this.pending.get(key)) {
          try {
            const { isFresh, value: value2 } = await previousExecutionFlow;
            if (isFresh)
              return value2;
            if (await allowStored(value2))
              return value2;
          } catch {
          }
          signal?.throwIfAborted();
        }
        const currentExecutionFlow = Promise.resolve().then(async () => {
          const storedValue = await this.getStored(key, { signal });
          if (storedValue !== void 0 && await allowStored(storedValue)) {
            return { isFresh: false, value: storedValue };
          }
          return Promise.resolve().then(async () => {
            const options = { signal, noCache, context };
            return this.getter.call(null, key, options, storedValue);
          }).catch(async (err) => {
            if (storedValue !== void 0) {
              try {
                if (await deleteOnError?.(err, key, storedValue)) {
                  await this.delStored(key, err);
                }
              } catch (error) {
                throw new AggregateError([err, error], "Error while deleting stored value");
              }
            }
            throw err;
          }).then(async (value2) => {
            await this.setStored(key, value2);
            return { isFresh: true, value: value2 };
          });
        }).finally(() => {
          this.pending.delete(key);
        });
        if (this.pending.has(key)) {
          throw new Error("Concurrent request for the same key");
        }
        this.pending.set(key, currentExecutionFlow);
        const { value } = await currentExecutionFlow;
        return value;
      }
      async getStored(key, options) {
        try {
          return await this.store.get(key, options);
        } catch (err) {
          return void 0;
        }
      }
      async setStored(key, value) {
        try {
          await this.store.set(key, value);
        } catch (err) {
          const onStoreError = this.options?.onStoreError;
          await onStoreError?.(err, key, value);
        }
      }
      async delStored(key, _cause) {
        await this.store.del(key);
      }
    };
    exports.CachedGetter = CachedGetter;
  }
});

// node_modules/@atproto-labs/simple-store/dist/simple-store.js
var require_simple_store = __commonJS({
  "node_modules/@atproto-labs/simple-store/dist/simple-store.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/@atproto-labs/simple-store/dist/util.js
var require_util15 = __commonJS({
  "node_modules/@atproto-labs/simple-store/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/@atproto-labs/simple-store/dist/index.js
var require_dist17 = __commonJS({
  "node_modules/@atproto-labs/simple-store/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_cached_getter(), exports);
    __exportStar2(require_simple_store(), exports);
    __exportStar2(require_util15(), exports);
  }
});

// node_modules/@atproto-labs/did-resolver/dist/did-cache.js
var require_did_cache = __commonJS({
  "node_modules/@atproto-labs/did-resolver/dist/did-cache.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DidResolverCached = void 0;
    var simple_store_1 = require_dist17();
    var did_cache_memory_js_1 = require_did_cache_memory();
    var DidResolverCached = class {
      constructor(resolver, cache = new did_cache_memory_js_1.DidCacheMemory()) {
        Object.defineProperty(this, "getter", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.getter = new simple_store_1.CachedGetter((did, options) => resolver.resolve(did, options), cache);
      }
      async resolve(did, options) {
        return this.getter.get(did, options);
      }
    };
    exports.DidResolverCached = DidResolverCached;
  }
});

// node_modules/@atproto-labs/did-resolver/dist/did-method.js
var require_did_method = __commonJS({
  "node_modules/@atproto-labs/did-resolver/dist/did-method.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/@atproto-labs/fetch/dist/fetch-error.js
var require_fetch_error = __commonJS({
  "node_modules/@atproto-labs/fetch/dist/fetch-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.FetchError = void 0;
    var FetchError = class extends Error {
      constructor(statusCode, message2, options) {
        super(message2, options);
        Object.defineProperty(this, "statusCode", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: statusCode
        });
      }
      get expose() {
        return true;
      }
    };
    exports.FetchError = FetchError;
  }
});

// node_modules/@atproto-labs/fetch/dist/fetch.js
var require_fetch = __commonJS({
  "node_modules/@atproto-labs/fetch/dist/fetch.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.toRequestTransformer = toRequestTransformer;
    exports.asRequest = asRequest;
    function toRequestTransformer(requestTransformer) {
      return function(input, init) {
        return requestTransformer.call(this, asRequest(input, init));
      };
    }
    function asRequest(input, init) {
      if (!init && input instanceof Request)
        return input;
      return new Request(input, init);
    }
  }
});

// node_modules/@atproto-labs/fetch/dist/util.js
var require_util16 = __commonJS({
  "node_modules/@atproto-labs/fetch/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.extractUrl = exports.MaxBytesTransformStream = exports.ifString = void 0;
    exports.isIp = isIp;
    exports.padLines = padLines;
    exports.cancelBody = cancelBody;
    exports.logCancellationError = logCancellationError;
    exports.stringifyMessage = stringifyMessage;
    function isIp(hostname) {
      if (hostname.match(/^\d+\.\d+\.\d+\.\d+$/))
        return true;
      if (hostname.startsWith("[") && hostname.endsWith("]"))
        return true;
      return false;
    }
    var ifString = (v) => typeof v === "string" ? v : void 0;
    exports.ifString = ifString;
    var MaxBytesTransformStream = class extends TransformStream {
      constructor(maxBytes) {
        if (!(maxBytes >= 0)) {
          throw new TypeError("maxBytes must be a non-negative number");
        }
        let bytesRead = 0;
        super({
          transform: (chunk, ctrl) => {
            if ((bytesRead += chunk.length) <= maxBytes) {
              ctrl.enqueue(chunk);
            } else {
              ctrl.error(new Error("Response too large"));
            }
          }
        });
      }
    };
    exports.MaxBytesTransformStream = MaxBytesTransformStream;
    var LINE_BREAK = /\r?\n/g;
    function padLines(input, pad) {
      if (!input)
        return input;
      return pad + input.replace(LINE_BREAK, `$&${pad}`);
    }
    async function cancelBody(body, onCancellationError) {
      if (body.body && !body.bodyUsed && !body.body.locked && // Support for alternative fetch implementations
      typeof body.body.cancel === "function") {
        if (typeof onCancellationError === "function") {
          void body.body.cancel().catch(onCancellationError);
        } else if (onCancellationError === "log") {
          void body.body.cancel().catch(logCancellationError);
        } else {
          await body.body.cancel();
        }
      }
    }
    function logCancellationError(err) {
      console.warn("Failed to cancel response body", err);
    }
    async function stringifyMessage(input) {
      try {
        const headers = stringifyHeaders(input.headers);
        const payload = await stringifyBody(input);
        return headers && payload ? `${headers}
${payload}` : headers || payload;
      } finally {
        void cancelBody(input, "log");
      }
    }
    function stringifyHeaders(headers) {
      return Array.from(headers).map(([name2, value]) => `${name2}: ${value}`).join("\n");
    }
    async function stringifyBody(body) {
      try {
        const blob = await body.blob();
        if (blob.type?.startsWith("text/")) {
          const text = await blob.text();
          return JSON.stringify(text);
        }
        if (/application\/(?:\w+\+)?json/.test(blob.type)) {
          const text = await blob.text();
          return text.includes("\n") ? JSON.stringify(JSON.parse(text)) : text;
        }
        return `[Body size: ${blob.size}, type: ${JSON.stringify(blob.type)} ]`;
      } catch {
        return "[Body could not be read]";
      }
    }
    var extractUrl = (input) => typeof input === "string" ? new URL(input) : input instanceof URL ? input : new URL(input.url);
    exports.extractUrl = extractUrl;
  }
});

// node_modules/@atproto-labs/fetch/dist/fetch-request.js
var require_fetch_request = __commonJS({
  "node_modules/@atproto-labs/fetch/dist/fetch-request.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DEFAULT_FORBIDDEN_DOMAIN_NAMES = exports.FetchRequestError = void 0;
    exports.protocolCheckRequestTransform = protocolCheckRequestTransform;
    exports.explicitRedirectCheckRequestTransform = explicitRedirectCheckRequestTransform;
    exports.requireHostHeaderTransform = requireHostHeaderTransform;
    exports.forbiddenDomainNameRequestTransform = forbiddenDomainNameRequestTransform;
    var fetch_error_js_1 = require_fetch_error();
    var fetch_js_1 = require_fetch();
    var util_js_1 = require_util16();
    var FetchRequestError = class _FetchRequestError extends fetch_error_js_1.FetchError {
      constructor(request, statusCode, message2, options) {
        if (statusCode == null || !message2) {
          const info = extractInfo(extractRootCause(options?.cause));
          statusCode ?? (statusCode = info[0]);
          message2 || (message2 = info[1]);
        }
        super(statusCode, message2, options);
        Object.defineProperty(this, "request", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: request
        });
      }
      get expose() {
        return this.statusCode !== 500;
      }
      static from(request, cause) {
        if (cause instanceof _FetchRequestError)
          return cause;
        return new _FetchRequestError(request, void 0, void 0, { cause });
      }
    };
    exports.FetchRequestError = FetchRequestError;
    function extractRootCause(err) {
      if (err instanceof TypeError && err.message === "fetch failed" && err.cause !== void 0) {
        return err.cause;
      }
      return err;
    }
    function extractInfo(err) {
      if (typeof err === "string" && err.length > 0) {
        return [500, err];
      }
      if (!(err instanceof Error)) {
        return [500, "Failed to fetch"];
      }
      switch (err.message) {
        case "failed to fetch the data URL":
          return [400, err.message];
        case "unexpected redirect":
        case "cors failure":
        case "blocked":
        case "proxy authentication required":
          return [502, err.message];
      }
      const code2 = err["code"];
      if (typeof code2 === "string") {
        switch (true) {
          case code2 === "ENOTFOUND":
            return [400, "Invalid hostname"];
          case code2 === "ECONNREFUSED":
            return [502, "Connection refused"];
          case code2 === "DEPTH_ZERO_SELF_SIGNED_CERT":
            return [502, "Self-signed certificate"];
          case code2.startsWith("ERR_TLS"):
            return [502, "TLS error"];
          case code2.startsWith("ECONN"):
            return [502, "Connection error"];
          default:
            return [500, `${code2} error`];
        }
      }
      return [500, err.message];
    }
    function protocolCheckRequestTransform(protocols) {
      return (input, init) => {
        const { protocol, port } = (0, util_js_1.extractUrl)(input);
        const request = (0, fetch_js_1.asRequest)(input, init);
        const config = Object.hasOwn(protocols, protocol) ? protocols[protocol] : void 0;
        if (!config) {
          throw new FetchRequestError(request, 400, `Forbidden protocol "${protocol}"`);
        } else if (config === true) {
        } else if (!config["allowCustomPort"] && port !== "") {
          throw new FetchRequestError(request, 400, `Custom ${protocol} ports not allowed`);
        }
        return request;
      };
    }
    function explicitRedirectCheckRequestTransform() {
      return (input, init) => {
        const request = (0, fetch_js_1.asRequest)(input, init);
        if (init?.redirect != null)
          return request;
        if (request.redirect === "follow") {
          throw new FetchRequestError(request, 500, 'Request redirect must be "error" or "manual"');
        }
        return request;
      };
    }
    function requireHostHeaderTransform() {
      return (input, init) => {
        const { protocol, hostname } = (0, util_js_1.extractUrl)(input);
        const request = (0, fetch_js_1.asRequest)(input, init);
        if (protocol !== "http:" && protocol !== "https:") {
          throw new FetchRequestError(request, 400, `"${protocol}" requests are not allowed`);
        }
        if (!hostname || (0, util_js_1.isIp)(hostname)) {
          throw new FetchRequestError(request, 400, "Invalid hostname");
        }
        return request;
      };
    }
    exports.DEFAULT_FORBIDDEN_DOMAIN_NAMES = [
      "example.com",
      "*.example.com",
      "example.org",
      "*.example.org",
      "example.net",
      "*.example.net",
      "googleusercontent.com",
      "*.googleusercontent.com"
    ];
    function forbiddenDomainNameRequestTransform(denyList = exports.DEFAULT_FORBIDDEN_DOMAIN_NAMES) {
      const denySet = new Set(denyList);
      if (denySet.size === 0) {
        return fetch_js_1.asRequest;
      }
      return async (input, init) => {
        const { hostname } = (0, util_js_1.extractUrl)(input);
        const request = (0, fetch_js_1.asRequest)(input, init);
        if (denySet.has(hostname)) {
          throw new FetchRequestError(request, 403, "Forbidden hostname");
        }
        let curDot = hostname.indexOf(".");
        while (curDot !== -1) {
          const subdomain = hostname.slice(curDot + 1);
          if (denySet.has(`*.${subdomain}`)) {
            throw new FetchRequestError(request, 403, "Forbidden hostname");
          }
          curDot = hostname.indexOf(".", curDot + 1);
        }
        return request;
      };
    }
  }
});

// node_modules/@atproto-labs/pipe/dist/pipe.js
var require_pipe = __commonJS({
  "node_modules/@atproto-labs/pipe/dist/pipe.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.pipe = pipe;
    exports.pipeTwo = pipeTwo;
    function pipe(...pipeline) {
      return pipeline.reduce(pipeTwo);
    }
    function pipeTwo(first, second) {
      return async (...args) => second(await first(...args));
    }
  }
});

// node_modules/@atproto-labs/pipe/dist/index.js
var require_dist18 = __commonJS({
  "node_modules/@atproto-labs/pipe/dist/index.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.pipeTwo = exports.pipe = void 0;
    var pipe_js_1 = require_pipe();
    Object.defineProperty(exports, "pipe", { enumerable: true, get: function() {
      return pipe_js_1.pipe;
    } });
    Object.defineProperty(exports, "pipeTwo", { enumerable: true, get: function() {
      return pipe_js_1.pipeTwo;
    } });
  }
});

// node_modules/@atproto-labs/fetch/dist/transformed-response.js
var require_transformed_response = __commonJS({
  "node_modules/@atproto-labs/fetch/dist/transformed-response.js"(exports) {
    "use strict";
    var __classPrivateFieldSet2 = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
      if (kind === "m") throw new TypeError("Private method is not writable");
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
      return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
    };
    var __classPrivateFieldGet2 = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
      return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
    };
    var _TransformedResponse_response;
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.TransformedResponse = void 0;
    var TransformedResponse = class extends Response {
      constructor(response, transform) {
        if (!response.body) {
          throw new TypeError("Response body is not available");
        }
        if (response.bodyUsed) {
          throw new TypeError("Response body is already used");
        }
        super(response.body.pipeThrough(transform), {
          status: response.status,
          statusText: response.statusText,
          headers: response.headers
        });
        _TransformedResponse_response.set(this, void 0);
        __classPrivateFieldSet2(this, _TransformedResponse_response, response, "f");
      }
      /**
       * Some props can't be set through ResponseInit, so we need to proxy them
       */
      get url() {
        return __classPrivateFieldGet2(this, _TransformedResponse_response, "f").url;
      }
      get redirected() {
        return __classPrivateFieldGet2(this, _TransformedResponse_response, "f").redirected;
      }
      get type() {
        return __classPrivateFieldGet2(this, _TransformedResponse_response, "f").type;
      }
      get statusText() {
        return __classPrivateFieldGet2(this, _TransformedResponse_response, "f").statusText;
      }
    };
    exports.TransformedResponse = TransformedResponse;
    _TransformedResponse_response = /* @__PURE__ */ new WeakMap();
  }
});

// node_modules/@atproto-labs/fetch/dist/fetch-response.js
var require_fetch_response = __commonJS({
  "node_modules/@atproto-labs/fetch/dist/fetch-response.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.fetchJsonZodProcessor = exports.FetchResponseError = void 0;
    exports.peekJson = peekJson;
    exports.checkLength = checkLength;
    exports.extractLength = extractLength;
    exports.extractMime = extractMime;
    exports.cancelBodyOnError = cancelBodyOnError;
    exports.fetchOkProcessor = fetchOkProcessor;
    exports.fetchOkTransformer = fetchOkTransformer;
    exports.fetchMaxSizeProcessor = fetchMaxSizeProcessor;
    exports.fetchResponseMaxSizeChecker = fetchResponseMaxSizeChecker;
    exports.fetchTypeProcessor = fetchTypeProcessor;
    exports.fetchResponseTypeChecker = fetchResponseTypeChecker;
    exports.fetchResponseJsonTransformer = fetchResponseJsonTransformer;
    exports.fetchJsonProcessor = fetchJsonProcessor;
    exports.fetchJsonValidatorProcessor = fetchJsonValidatorProcessor;
    var pipe_1 = require_dist18();
    var fetch_error_js_1 = require_fetch_error();
    var transformed_response_js_1 = require_transformed_response();
    var util_js_1 = require_util16();
    var JSON_MIME = /^application\/(?:[^()<>@,;:/[\]\\?={} \t]+\+)?json$/i;
    var FetchResponseError = class _FetchResponseError extends fetch_error_js_1.FetchError {
      constructor(response, statusCode = response.status, message2 = response.statusText, options) {
        super(statusCode, message2, options);
        Object.defineProperty(this, "response", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: response
        });
      }
      static async from(response, customMessage = extractResponseMessage, statusCode = response.status, options) {
        const message2 = typeof customMessage === "string" ? customMessage : typeof customMessage === "function" ? await customMessage(response) : void 0;
        return new _FetchResponseError(response, statusCode, message2, options);
      }
    };
    exports.FetchResponseError = FetchResponseError;
    var extractResponseMessage = async (response) => {
      const mimeType = extractMime(response);
      if (!mimeType)
        return void 0;
      try {
        if (mimeType === "text/plain") {
          return await response.text();
        } else if (JSON_MIME.test(mimeType)) {
          const json = await response.json();
          if (typeof json === "string")
            return json;
          if (typeof json === "object" && json != null) {
            const errorDescription = (0, util_js_1.ifString)(json["error_description"]);
            if (errorDescription)
              return errorDescription;
            const error = (0, util_js_1.ifString)(json["error"]);
            if (error)
              return error;
            const message2 = (0, util_js_1.ifString)(json["message"]);
            if (message2)
              return message2;
          }
        }
      } catch {
      }
      return void 0;
    };
    async function peekJson(response, maxSize = Infinity) {
      const type = extractMime(response);
      if (type !== "application/json")
        return void 0;
      checkLength(response, maxSize);
      const clonedResponse = response.clone();
      const limitedResponse = response.body && maxSize < Infinity ? new transformed_response_js_1.TransformedResponse(clonedResponse, new util_js_1.MaxBytesTransformStream(maxSize)) : (
        // Note: some runtimes (e.g. react-native) don't expose a body property
        clonedResponse
      );
      return limitedResponse.json();
    }
    function checkLength(response, maxBytes) {
      if (!(maxBytes >= 0)) {
        throw new TypeError("maxBytes must be a non-negative number");
      }
      const length2 = extractLength(response);
      if (length2 != null && length2 > maxBytes) {
        throw new FetchResponseError(response, 502, "Response too large");
      }
      return length2;
    }
    function extractLength(response) {
      const contentLength = response.headers.get("Content-Length");
      if (contentLength == null)
        return void 0;
      if (!/^\d+$/.test(contentLength)) {
        throw new FetchResponseError(response, 502, "Invalid Content-Length");
      }
      const length2 = Number(contentLength);
      if (!Number.isSafeInteger(length2)) {
        throw new FetchResponseError(response, 502, "Content-Length too large");
      }
      return length2;
    }
    function extractMime(response) {
      const contentType = response.headers.get("Content-Type");
      if (contentType == null)
        return void 0;
      return contentType.split(";", 1)[0].trim();
    }
    function cancelBodyOnError(transformer, onCancellationError = util_js_1.logCancellationError) {
      return async (response) => {
        try {
          return await transformer(response);
        } catch (err) {
          await (0, util_js_1.cancelBody)(response, onCancellationError ?? void 0);
          throw err;
        }
      };
    }
    function fetchOkProcessor(customMessage) {
      return cancelBodyOnError((response) => {
        return fetchOkTransformer(response, customMessage);
      });
    }
    async function fetchOkTransformer(response, customMessage) {
      if (response.ok)
        return response;
      throw await FetchResponseError.from(response, customMessage);
    }
    function fetchMaxSizeProcessor(maxBytes) {
      if (maxBytes === Infinity)
        return (response) => response;
      if (!Number.isFinite(maxBytes) || maxBytes < 0) {
        throw new TypeError("maxBytes must be a 0, Infinity or a positive number");
      }
      return cancelBodyOnError((response) => {
        return fetchResponseMaxSizeChecker(response, maxBytes);
      });
    }
    function fetchResponseMaxSizeChecker(response, maxBytes) {
      if (maxBytes === Infinity)
        return response;
      checkLength(response, maxBytes);
      if (!response.body)
        return response;
      const transform = new util_js_1.MaxBytesTransformStream(maxBytes);
      return new transformed_response_js_1.TransformedResponse(response, transform);
    }
    function fetchTypeProcessor(expectedMime, contentTypeRequired = true) {
      const isExpected = typeof expectedMime === "string" ? (mimeType) => mimeType === expectedMime : expectedMime instanceof RegExp ? (mimeType) => expectedMime.test(mimeType) : expectedMime;
      return cancelBodyOnError((response) => {
        return fetchResponseTypeChecker(response, isExpected, contentTypeRequired);
      });
    }
    async function fetchResponseTypeChecker(response, isExpectedMime, contentTypeRequired = true) {
      const mimeType = extractMime(response);
      if (mimeType) {
        if (!isExpectedMime(mimeType.toLowerCase())) {
          throw await FetchResponseError.from(response, `Unexpected response Content-Type (${mimeType})`, 502);
        }
      } else if (contentTypeRequired) {
        throw await FetchResponseError.from(response, "Missing response Content-Type header", 502);
      }
      return response;
    }
    async function fetchResponseJsonTransformer(response) {
      try {
        const json = await response.json();
        return { response, json };
      } catch (cause) {
        throw new FetchResponseError(response, 502, "Unable to parse response as JSON", { cause });
      }
    }
    function fetchJsonProcessor(expectedMime = JSON_MIME, contentTypeRequired = true) {
      return (0, pipe_1.pipe)(fetchTypeProcessor(expectedMime, contentTypeRequired), cancelBodyOnError(fetchResponseJsonTransformer));
    }
    function fetchJsonValidatorProcessor(schema, params) {
      if ("parseAsync" in schema && typeof schema.parseAsync === "function") {
        return async (jsonResponse) => schema.parseAsync(jsonResponse.json, params);
      }
      if ("parse" in schema && typeof schema.parse === "function") {
        return async (jsonResponse) => schema.parse(jsonResponse.json, params);
      }
      throw new TypeError("Invalid schema");
    }
    exports.fetchJsonZodProcessor = fetchJsonValidatorProcessor;
  }
});

// node_modules/@atproto-labs/fetch/dist/fetch-wrap.js
var require_fetch_wrap = __commonJS({
  "node_modules/@atproto-labs/fetch/dist/fetch-wrap.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.timedFetch = void 0;
    exports.loggedFetch = loggedFetch;
    exports.bindFetch = bindFetch;
    var fetch_request_js_1 = require_fetch_request();
    var fetch_js_1 = require_fetch();
    var transformed_response_js_1 = require_transformed_response();
    var util_js_1 = require_util16();
    function loggedFetch({ fetch: fetch2 = globalThis.fetch, logRequest = true, logResponse = true, logError = true }) {
      const onRequest = logRequest === true ? async (request) => {
        const requestMessage = await (0, util_js_1.stringifyMessage)(request);
        console.info(`> ${request.method} ${request.url}
${(0, util_js_1.padLines)(requestMessage, "  ")}`);
      } : logRequest || void 0;
      const onResponse = logResponse === true ? async (response) => {
        const responseMessage = await (0, util_js_1.stringifyMessage)(response.clone());
        console.info(`< HTTP/1.1 ${response.status} ${response.statusText}
${(0, util_js_1.padLines)(responseMessage, "  ")}`);
      } : logResponse || void 0;
      const onError = logError === true ? async (error) => {
        console.error(`< Error:`, error);
      } : logError || void 0;
      if (!onRequest && !onResponse && !onError)
        return fetch2;
      return (0, fetch_js_1.toRequestTransformer)(async function(request) {
        if (onRequest)
          await onRequest(request);
        try {
          const response = await fetch2.call(this, request);
          if (onResponse)
            await onResponse(response, request);
          return response;
        } catch (error) {
          if (onError)
            await onError(error, request);
          throw error;
        }
      });
    }
    var timedFetch = (timeout = 6e4, fetch2 = globalThis.fetch) => {
      if (timeout === Infinity)
        return fetch2;
      if (!Number.isFinite(timeout) || timeout <= 0) {
        throw new TypeError("Timeout must be positive");
      }
      return (0, fetch_js_1.toRequestTransformer)(async function(request) {
        const controller = new AbortController();
        const signal = controller.signal;
        const abort = () => {
          controller.abort();
        };
        const cleanup = () => {
          clearTimeout(timer);
          request.signal?.removeEventListener("abort", abort);
        };
        const timer = setTimeout(abort, timeout);
        if (typeof timer === "object")
          timer.unref?.();
        request.signal?.addEventListener("abort", abort);
        signal.addEventListener("abort", cleanup);
        const response = await fetch2.call(this, request, { signal });
        if (!response.body) {
          cleanup();
          return response;
        } else {
          const transform = new TransformStream({ flush: cleanup });
          return new transformed_response_js_1.TransformedResponse(response, transform);
        }
      });
    };
    exports.timedFetch = timedFetch;
    function bindFetch(fetch2 = globalThis.fetch, context = globalThis) {
      return (0, fetch_js_1.toRequestTransformer)(async (request) => {
        try {
          return await fetch2.call(context, request);
        } catch (err) {
          throw fetch_request_js_1.FetchRequestError.from(request, err);
        }
      });
    }
  }
});

// node_modules/@atproto-labs/fetch/dist/index.js
var require_dist19 = __commonJS({
  "node_modules/@atproto-labs/fetch/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_fetch_error(), exports);
    __exportStar2(require_fetch_request(), exports);
    __exportStar2(require_fetch_response(), exports);
    __exportStar2(require_fetch_wrap(), exports);
    __exportStar2(require_fetch(), exports);
    __exportStar2(require_util16(), exports);
  }
});

// node_modules/@atproto-labs/did-resolver/dist/did-resolver-base.js
var require_did_resolver_base = __commonJS({
  "node_modules/@atproto-labs/did-resolver/dist/did-resolver-base.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DidResolverBase = void 0;
    var zod_1 = require_zod();
    var did_1 = require_dist15();
    var fetch_1 = require_dist19();
    var DidResolverBase = class {
      constructor(methods) {
        Object.defineProperty(this, "methods", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.methods = new Map(Object.entries(methods));
      }
      async resolve(did, options) {
        options?.signal?.throwIfAborted();
        const method = (0, did_1.extractDidMethod)(did);
        const resolver = this.methods.get(method);
        if (!resolver) {
          throw new did_1.DidError(did, `Unsupported DID method`, "did-method-invalid", 400);
        }
        try {
          const document = await resolver.resolve(did, options);
          if (document.id !== did) {
            throw new did_1.DidError(did, `DID document id (${document.id}) does not match DID`, "did-document-id-mismatch", 400);
          }
          return document;
        } catch (err) {
          if (err instanceof fetch_1.FetchResponseError) {
            const status = err.response.status >= 500 ? 502 : err.response.status;
            throw new did_1.DidError(did, err.message, "did-fetch-error", status, err);
          }
          if (err instanceof fetch_1.FetchError) {
            throw new did_1.DidError(did, err.message, "did-fetch-error", 400, err);
          }
          if (err instanceof zod_1.ZodError) {
            throw new did_1.DidError(did, err.message, "did-document-format-error", 503, err);
          }
          throw did_1.DidError.from(err, did);
        }
      }
    };
    exports.DidResolverBase = DidResolverBase;
  }
});

// node_modules/@atproto-labs/did-resolver/dist/methods/plc.js
var require_plc2 = __commonJS({
  "node_modules/@atproto-labs/did-resolver/dist/methods/plc.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DidPlcMethod = void 0;
    var did_1 = require_dist15();
    var fetch_1 = require_dist19();
    var pipe_1 = require_dist18();
    var fetchSuccessHandler = (0, pipe_1.pipe)((0, fetch_1.fetchOkProcessor)(), (0, fetch_1.fetchJsonProcessor)(/^application\/(did\+ld\+)?json$/), (0, fetch_1.fetchJsonZodProcessor)(did_1.didDocumentValidator));
    var DidPlcMethod = class {
      constructor(options) {
        Object.defineProperty(this, "fetch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "plcDirectoryUrl", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.plcDirectoryUrl = new URL(options?.plcDirectoryUrl || "https://plc.directory/");
        this.fetch = (0, fetch_1.bindFetch)(options?.fetch);
      }
      async resolve(did, options) {
        (0, did_1.assertDidPlc)(did);
        const url = new URL(`/${encodeURIComponent(did)}`, this.plcDirectoryUrl);
        return this.fetch(url, {
          redirect: "error",
          headers: { accept: "application/did+ld+json,application/json" },
          signal: options?.signal
        }).then(fetchSuccessHandler);
      }
    };
    exports.DidPlcMethod = DidPlcMethod;
  }
});

// node_modules/@atproto-labs/did-resolver/dist/methods/web.js
var require_web2 = __commonJS({
  "node_modules/@atproto-labs/did-resolver/dist/methods/web.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DidWebMethod = void 0;
    exports.buildDidWebDocumentUrl = buildDidWebDocumentUrl;
    var did_1 = require_dist15();
    var fetch_1 = require_dist19();
    var pipe_1 = require_dist18();
    var fetchSuccessHandler = (0, pipe_1.pipe)((0, fetch_1.fetchOkProcessor)(), (0, fetch_1.fetchJsonProcessor)(/^application\/(did\+ld\+)?json$/), (0, fetch_1.fetchJsonZodProcessor)(did_1.didDocumentValidator));
    var DidWebMethod = class {
      constructor({ fetch: fetch2 = globalThis.fetch, allowHttp = true } = {}) {
        Object.defineProperty(this, "fetch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "allowHttp", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.fetch = (0, fetch_1.bindFetch)(fetch2);
        this.allowHttp = allowHttp;
      }
      async resolve(did, options) {
        const didDocumentUrl = buildDidWebDocumentUrl(did);
        if (!this.allowHttp && didDocumentUrl.protocol === "http:") {
          throw new did_1.DidError(did, 'Resolution of "http" did:web is not allowed', "did-web-http-not-allowed");
        }
        return this.fetch(didDocumentUrl, {
          redirect: "error",
          headers: { accept: "application/did+ld+json,application/json" },
          signal: options?.signal
        }).then(fetchSuccessHandler);
      }
    };
    exports.DidWebMethod = DidWebMethod;
    function buildDidWebDocumentUrl(did) {
      const url = (0, did_1.didWebToUrl)(did);
      if (url.pathname === "/") {
        return new URL(`/.well-known/did.json`, url);
      } else {
        return new URL(`${url.pathname}/did.json`, url);
      }
    }
  }
});

// node_modules/@atproto-labs/did-resolver/dist/did-resolver-common.js
var require_did_resolver_common = __commonJS({
  "node_modules/@atproto-labs/did-resolver/dist/did-resolver-common.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DidResolverCommon = void 0;
    var did_resolver_base_js_1 = require_did_resolver_base();
    var plc_js_1 = require_plc2();
    var web_js_1 = require_web2();
    var DidResolverCommon = class extends did_resolver_base_js_1.DidResolverBase {
      constructor(options) {
        super({
          plc: new plc_js_1.DidPlcMethod(options),
          web: new web_js_1.DidWebMethod(options)
        });
      }
    };
    exports.DidResolverCommon = DidResolverCommon;
  }
});

// node_modules/@atproto-labs/did-resolver/dist/did-resolver.js
var require_did_resolver = __commonJS({
  "node_modules/@atproto-labs/did-resolver/dist/did-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/@atproto-labs/did-resolver/dist/methods.js
var require_methods2 = __commonJS({
  "node_modules/@atproto-labs/did-resolver/dist/methods.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_plc2(), exports);
    __exportStar2(require_web2(), exports);
  }
});

// node_modules/@atproto-labs/did-resolver/dist/index.js
var require_dist20 = __commonJS({
  "node_modules/@atproto-labs/did-resolver/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_dist15(), exports);
    __exportStar2(require_did_cache_memory(), exports);
    __exportStar2(require_did_cache(), exports);
    __exportStar2(require_did_method(), exports);
    __exportStar2(require_did_resolver_common(), exports);
    __exportStar2(require_did_resolver(), exports);
    __exportStar2(require_methods2(), exports);
  }
});

// node_modules/@atproto-labs/handle-resolver/dist/handle-resolver-error.js
var require_handle_resolver_error = __commonJS({
  "node_modules/@atproto-labs/handle-resolver/dist/handle-resolver-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.HandleResolverError = void 0;
    var HandleResolverError = class extends Error {
      constructor() {
        super(...arguments);
        Object.defineProperty(this, "name", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: "HandleResolverError"
        });
      }
    };
    exports.HandleResolverError = HandleResolverError;
  }
});

// node_modules/@atproto-labs/handle-resolver/dist/types.js
var require_types8 = __commonJS({
  "node_modules/@atproto-labs/handle-resolver/dist/types.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.isResolvedHandle = isResolvedHandle;
    exports.asResolvedHandle = asResolvedHandle;
    var did_1 = require_dist15();
    function isResolvedHandle(value) {
      return value === null || (0, did_1.isAtprotoDid)(value);
    }
    function asResolvedHandle(value) {
      return isResolvedHandle(value) ? value : null;
    }
  }
});

// node_modules/@atproto-labs/handle-resolver/dist/xrpc-handle-resolver.js
var require_xrpc_handle_resolver = __commonJS({
  "node_modules/@atproto-labs/handle-resolver/dist/xrpc-handle-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.XrpcHandleResolver = exports.xrpcErrorSchema = void 0;
    var zod_1 = require_zod();
    var handle_resolver_error_js_1 = require_handle_resolver_error();
    var types_js_1 = require_types8();
    exports.xrpcErrorSchema = zod_1.z.object({
      error: zod_1.z.string(),
      message: zod_1.z.string().optional()
    });
    var XrpcHandleResolver = class {
      constructor(service, options) {
        Object.defineProperty(this, "serviceUrl", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "fetch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.serviceUrl = new URL(service);
        this.fetch = options?.fetch ?? globalThis.fetch;
      }
      async resolve(handle, options) {
        const url = new URL("/xrpc/com.atproto.identity.resolveHandle", this.serviceUrl);
        url.searchParams.set("handle", handle);
        const response = await this.fetch.call(null, url, {
          cache: options?.noCache ? "no-cache" : void 0,
          signal: options?.signal,
          redirect: "error"
        });
        const payload = await response.json();
        if (response.status === 400) {
          const { error, data } = exports.xrpcErrorSchema.safeParse(payload);
          if (error) {
            throw new handle_resolver_error_js_1.HandleResolverError(`Invalid response from resolveHandle method: ${error.message}`, { cause: error });
          }
          if (data.error === "InvalidRequest" && data.message === "Unable to resolve handle") {
            return null;
          }
        }
        if (!response.ok) {
          throw new handle_resolver_error_js_1.HandleResolverError("Invalid status code from resolveHandle method");
        }
        const value = payload?.did;
        if (!(0, types_js_1.isResolvedHandle)(value)) {
          throw new handle_resolver_error_js_1.HandleResolverError("Invalid DID returned from resolveHandle method");
        }
        return value;
      }
    };
    exports.XrpcHandleResolver = XrpcHandleResolver;
  }
});

// node_modules/@atproto-labs/handle-resolver/dist/internal-resolvers/dns-handle-resolver.js
var require_dns_handle_resolver = __commonJS({
  "node_modules/@atproto-labs/handle-resolver/dist/internal-resolvers/dns-handle-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DnsHandleResolver = void 0;
    var types_1 = require_types8();
    var SUBDOMAIN = "_atproto";
    var PREFIX = "did=";
    var DnsHandleResolver = class {
      constructor(resolveTxt) {
        Object.defineProperty(this, "resolveTxt", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: resolveTxt
        });
      }
      async resolve(handle) {
        const results = await this.resolveTxt.call(null, `${SUBDOMAIN}.${handle}`);
        if (!results)
          return null;
        for (let i = 0; i < results.length; i++) {
          if (!results[i].startsWith(PREFIX))
            continue;
          for (let j = i + 1; j < results.length; j++) {
            if (results[j].startsWith(PREFIX))
              return null;
          }
          const did = results[i].slice(PREFIX.length);
          return (0, types_1.isResolvedHandle)(did) ? did : null;
        }
        return null;
      }
    };
    exports.DnsHandleResolver = DnsHandleResolver;
  }
});

// node_modules/@atproto-labs/handle-resolver/dist/internal-resolvers/well-known-handler-resolver.js
var require_well_known_handler_resolver = __commonJS({
  "node_modules/@atproto-labs/handle-resolver/dist/internal-resolvers/well-known-handler-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.WellKnownHandleResolver = void 0;
    var types_js_1 = require_types8();
    var WellKnownHandleResolver = class {
      constructor(options) {
        Object.defineProperty(this, "fetch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.fetch = options?.fetch ?? globalThis.fetch;
      }
      async resolve(handle, options) {
        const url = new URL("/.well-known/atproto-did", `https://${handle}`);
        try {
          const response = await this.fetch.call(null, url, {
            cache: options?.noCache ? "no-cache" : void 0,
            signal: options?.signal,
            redirect: "error"
          });
          const text = await response.text();
          const firstLine = text.split("\n")[0].trim();
          if ((0, types_js_1.isResolvedHandle)(firstLine))
            return firstLine;
          return null;
        } catch (err) {
          options?.signal?.throwIfAborted();
          return null;
        }
      }
    };
    exports.WellKnownHandleResolver = WellKnownHandleResolver;
  }
});

// node_modules/@atproto-labs/handle-resolver/dist/atproto-handle-resolver.js
var require_atproto_handle_resolver = __commonJS({
  "node_modules/@atproto-labs/handle-resolver/dist/atproto-handle-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AtprotoHandleResolver = void 0;
    var dns_handle_resolver_js_1 = require_dns_handle_resolver();
    var well_known_handler_resolver_js_1 = require_well_known_handler_resolver();
    var noop = () => {
    };
    var AtprotoHandleResolver = class {
      constructor(options) {
        Object.defineProperty(this, "httpResolver", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "dnsResolver", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "dnsResolverFallback", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.httpResolver = new well_known_handler_resolver_js_1.WellKnownHandleResolver(options);
        this.dnsResolver = new dns_handle_resolver_js_1.DnsHandleResolver(options.resolveTxt);
        this.dnsResolverFallback = options.resolveTxtFallback ? new dns_handle_resolver_js_1.DnsHandleResolver(options.resolveTxtFallback) : void 0;
      }
      async resolve(handle, options) {
        options?.signal?.throwIfAborted();
        const abortController = new AbortController();
        const { signal } = abortController;
        options?.signal?.addEventListener("abort", () => abortController.abort(), {
          signal
        });
        const wrappedOptions = { ...options, signal };
        try {
          const dnsPromise = this.dnsResolver.resolve(handle, wrappedOptions);
          const httpPromise = this.httpResolver.resolve(handle, wrappedOptions);
          httpPromise.catch(noop);
          const dnsRes = await dnsPromise;
          if (dnsRes)
            return dnsRes;
          signal.throwIfAborted();
          const res = await httpPromise;
          if (res)
            return res;
          signal.throwIfAborted();
          return this.dnsResolverFallback?.resolve(handle, wrappedOptions) ?? null;
        } finally {
          abortController.abort();
        }
      }
    };
    exports.AtprotoHandleResolver = AtprotoHandleResolver;
  }
});

// node_modules/@atproto-labs/handle-resolver/dist/atproto-doh-handle-resolver.js
var require_atproto_doh_handle_resolver = __commonJS({
  "node_modules/@atproto-labs/handle-resolver/dist/atproto-doh-handle-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AtprotoDohHandleResolver = void 0;
    var atproto_handle_resolver_js_1 = require_atproto_handle_resolver();
    var handle_resolver_error_js_1 = require_handle_resolver_error();
    var AtprotoDohHandleResolver = class extends atproto_handle_resolver_js_1.AtprotoHandleResolver {
      constructor(options) {
        super({
          ...options,
          resolveTxt: dohResolveTxtFactory(options),
          resolveTxtFallback: void 0
        });
      }
    };
    exports.AtprotoDohHandleResolver = AtprotoDohHandleResolver;
    function dohResolveTxtFactory({ dohEndpoint, fetch: fetch2 = globalThis.fetch }) {
      return async (hostname) => {
        const url = new URL(dohEndpoint);
        url.searchParams.set("type", "TXT");
        url.searchParams.set("name", hostname);
        const response = await fetch2(url, {
          method: "GET",
          headers: { accept: "application/dns-json" },
          redirect: "follow"
        });
        try {
          const contentType = response.headers.get("content-type")?.trim();
          if (!response.ok) {
            const message2 = contentType?.startsWith("text/plain") ? await response.text() : `Failed to resolve ${hostname}`;
            throw new handle_resolver_error_js_1.HandleResolverError(message2);
          } else if (contentType?.match(/application\/(dns-)?json/i) == null) {
            throw new handle_resolver_error_js_1.HandleResolverError("Unexpected response from DoH server");
          }
          const result = asResult(await response.json());
          return result.Answer?.filter(isAnswerTxt).map(extractTxtData) ?? null;
        } finally {
          if (response.bodyUsed === false) {
            void response.body?.cancel().catch(onCancelError);
          }
        }
      };
    }
    function onCancelError(err) {
      if (!(err instanceof DOMException) || err.name !== "AbortError") {
        console.error("An error occurred while cancelling the response body:", err);
      }
    }
    function isResult(result) {
      if (typeof result !== "object" || result === null)
        return false;
      if (!("Status" in result) || typeof result.Status !== "number")
        return false;
      if ("Answer" in result && !isArrayOf(result.Answer, isAnswer))
        return false;
      return true;
    }
    function asResult(result) {
      if (isResult(result))
        return result;
      throw new handle_resolver_error_js_1.HandleResolverError("Invalid DoH response");
    }
    function isArrayOf(value, predicate) {
      return Array.isArray(value) && value.every(predicate);
    }
    function isAnswer(answer) {
      return typeof answer === "object" && answer !== null && "name" in answer && typeof answer.name === "string" && "type" in answer && typeof answer.type === "number" && "data" in answer && typeof answer.data === "string" && "TTL" in answer && typeof answer.TTL === "number";
    }
    function isAnswerTxt(answer) {
      return answer.type === 16;
    }
    function extractTxtData(answer) {
      return answer.data.replace(/^"|"$/g, "").replace(/\\"/g, '"');
    }
  }
});

// node_modules/@atproto-labs/handle-resolver/dist/cached-handle-resolver.js
var require_cached_handle_resolver = __commonJS({
  "node_modules/@atproto-labs/handle-resolver/dist/cached-handle-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.CachedHandleResolver = void 0;
    var simple_store_1 = require_dist17();
    var simple_store_memory_1 = require_dist16();
    var CachedHandleResolver = class {
      constructor(resolver, cache = new simple_store_memory_1.SimpleStoreMemory({
        max: 1e3,
        ttl: 10 * 6e4
      })) {
        Object.defineProperty(this, "getter", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.getter = new simple_store_1.CachedGetter((handle, options) => resolver.resolve(handle, options), cache);
      }
      async resolve(handle, options) {
        return this.getter.get(handle, options);
      }
    };
    exports.CachedHandleResolver = CachedHandleResolver;
  }
});

// node_modules/@atproto-labs/handle-resolver/dist/index.js
var require_dist21 = __commonJS({
  "node_modules/@atproto-labs/handle-resolver/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_handle_resolver_error(), exports);
    __exportStar2(require_types8(), exports);
    __exportStar2(require_xrpc_handle_resolver(), exports);
    __exportStar2(require_atproto_doh_handle_resolver(), exports);
    __exportStar2(require_atproto_handle_resolver(), exports);
    __exportStar2(require_cached_handle_resolver(), exports);
  }
});

// node_modules/@atproto/oauth-types/dist/constants.js
var require_constants = __commonJS({
  "node_modules/@atproto/oauth-types/dist/constants.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.CLIENT_ASSERTION_TYPE_JWT_BEARER = void 0;
    exports.CLIENT_ASSERTION_TYPE_JWT_BEARER = "urn:ietf:params:oauth:client-assertion-type:jwt-bearer";
  }
});

// node_modules/@atproto/oauth-types/dist/util.js
var require_util17 = __commonJS({
  "node_modules/@atproto/oauth-types/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.numberPreprocess = exports.jsonObjectPreprocess = void 0;
    exports.isHostnameIP = isHostnameIP;
    exports.isLoopbackHost = isLoopbackHost;
    exports.isLoopbackUrl = isLoopbackUrl;
    exports.safeUrl = safeUrl;
    exports.extractUrlPath = extractUrlPath;
    function isHostnameIP(hostname) {
      if (hostname.match(/^\d+\.\d+\.\d+\.\d+$/))
        return true;
      if (hostname.startsWith("[") && hostname.endsWith("]"))
        return true;
      return false;
    }
    function isLoopbackHost(host) {
      return host === "localhost" || host === "127.0.0.1" || host === "[::1]";
    }
    function isLoopbackUrl(input) {
      const url = typeof input === "string" ? new URL(input) : input;
      return isLoopbackHost(url.hostname);
    }
    function safeUrl(input) {
      try {
        return new URL(input);
      } catch {
        return null;
      }
    }
    function extractUrlPath(url) {
      const endOfProtocol = url.startsWith("https://") ? 8 : url.startsWith("http://") ? 7 : -1;
      if (endOfProtocol === -1) {
        throw new TypeError('URL must use the "https:" or "http:" protocol');
      }
      const hashIdx = url.indexOf("#", endOfProtocol);
      const questionIdx = url.indexOf("?", endOfProtocol);
      const queryStrIdx = questionIdx !== -1 && (hashIdx === -1 || questionIdx < hashIdx) ? questionIdx : -1;
      const pathEnd = hashIdx === -1 ? queryStrIdx === -1 ? url.length : queryStrIdx : queryStrIdx === -1 ? hashIdx : Math.min(hashIdx, queryStrIdx);
      const slashIdx = url.indexOf("/", endOfProtocol);
      const pathStart = slashIdx === -1 || slashIdx > pathEnd ? pathEnd : slashIdx;
      if (endOfProtocol === pathStart) {
        throw new TypeError("URL must contain a host");
      }
      return url.substring(pathStart, pathEnd);
    }
    var jsonObjectPreprocess = (val) => {
      if (typeof val === "string" && val.startsWith("{") && val.endsWith("}")) {
        try {
          return JSON.parse(val);
        } catch {
          return val;
        }
      }
      return val;
    };
    exports.jsonObjectPreprocess = jsonObjectPreprocess;
    var numberPreprocess = (val) => {
      if (typeof val === "string") {
        const number = Number(val);
        if (!Number.isNaN(number))
          return number;
      }
      return val;
    };
    exports.numberPreprocess = numberPreprocess;
  }
});

// node_modules/@atproto/oauth-types/dist/uri.js
var require_uri5 = __commonJS({
  "node_modules/@atproto/oauth-types/dist/uri.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.privateUseUriSchema = exports.webUriSchema = exports.httpsUriSchema = exports.loopbackUriSchema = exports.dangerousUriSchema = void 0;
    var zod_1 = require_zod();
    var util_js_1 = require_util17();
    var canParseUrl = (
      // eslint-disable-next-line n/no-unsupported-features/node-builtins
      URL.canParse ?? // URL.canParse is not available in Node.js < 18.7.0
      ((urlStr) => {
        try {
          new URL(urlStr);
          return true;
        } catch {
          return false;
        }
      })
    );
    exports.dangerousUriSchema = zod_1.z.string().refine((data) => data.includes(":") && canParseUrl(data), {
      message: "Invalid URL"
    });
    exports.loopbackUriSchema = exports.dangerousUriSchema.superRefine((value, ctx) => {
      if (!value.startsWith("http://")) {
        ctx.addIssue({
          code: zod_1.ZodIssueCode.custom,
          message: 'URL must use the "http:" protocol'
        });
        return false;
      }
      const url = new URL(value);
      if (!(0, util_js_1.isLoopbackHost)(url.hostname)) {
        ctx.addIssue({
          code: zod_1.ZodIssueCode.custom,
          message: 'URL must use "localhost", "127.0.0.1" or "[::1]" as hostname'
        });
        return false;
      }
      return true;
    });
    exports.httpsUriSchema = exports.dangerousUriSchema.superRefine((value, ctx) => {
      if (!value.startsWith("https://")) {
        ctx.addIssue({
          code: zod_1.ZodIssueCode.custom,
          message: 'URL must use the "https:" protocol'
        });
        return false;
      }
      const url = new URL(value);
      if ((0, util_js_1.isLoopbackHost)(url.hostname)) {
        ctx.addIssue({
          code: zod_1.ZodIssueCode.custom,
          message: "https: URL must not use a loopback host"
        });
        return false;
      }
      if ((0, util_js_1.isHostnameIP)(url.hostname)) {
      } else {
        if (!url.hostname.includes(".")) {
          ctx.addIssue({
            code: zod_1.ZodIssueCode.custom,
            message: "Domain name must contain at least two segments"
          });
          return false;
        }
        if (url.hostname.endsWith(".local")) {
          ctx.addIssue({
            code: zod_1.ZodIssueCode.custom,
            message: 'Domain name must not end with ".local"'
          });
          return false;
        }
      }
      return true;
    });
    exports.webUriSchema = zod_1.z.string().superRefine((value, ctx) => {
      if (value.startsWith("http://")) {
        const result = exports.loopbackUriSchema.safeParse(value);
        if (!result.success)
          result.error.issues.forEach(ctx.addIssue, ctx);
        return result.success;
      }
      if (value.startsWith("https://")) {
        const result = exports.httpsUriSchema.safeParse(value);
        if (!result.success)
          result.error.issues.forEach(ctx.addIssue, ctx);
        return result.success;
      }
      ctx.addIssue({
        code: zod_1.ZodIssueCode.custom,
        message: 'URL must use the "http:" or "https:" protocol'
      });
      return false;
    });
    exports.privateUseUriSchema = exports.dangerousUriSchema.superRefine((value, ctx) => {
      const dotIdx = value.indexOf(".");
      const colonIdx = value.indexOf(":");
      if (dotIdx === -1 || colonIdx === -1 || dotIdx > colonIdx) {
        ctx.addIssue({
          code: zod_1.ZodIssueCode.custom,
          message: 'Private-use URI scheme requires a "." as part of the protocol'
        });
        return false;
      }
      const url = new URL(value);
      if (!url.protocol.includes(".")) {
        ctx.addIssue({
          code: zod_1.ZodIssueCode.custom,
          message: "Invalid private-use URI scheme"
        });
        return false;
      }
      if (url.hostname) {
        ctx.addIssue({
          code: zod_1.ZodIssueCode.custom,
          message: 'Private-use URI schemes must not include a hostname (only one "/" is allowed after the protocol, as per RFC 8252)'
        });
        return false;
      }
      return true;
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-client-id.js
var require_oauth_client_id = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-client-id.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthClientIdSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthClientIdSchema = zod_1.z.string().min(1);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-redirect-uri.js
var require_oauth_redirect_uri = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-redirect-uri.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthRedirectUriSchema = exports.oauthPrivateUseRedirectURISchema = exports.oauthHttpsRedirectURISchema = exports.oauthLoopbackRedirectURISchema = void 0;
    var zod_1 = require_zod();
    var uri_js_1 = require_uri5();
    exports.oauthLoopbackRedirectURISchema = uri_js_1.loopbackUriSchema.superRefine((value, ctx) => {
      if (value.startsWith("http://localhost")) {
        ctx.addIssue({
          code: zod_1.ZodIssueCode.custom,
          message: 'Use of "localhost" hostname is not allowed (RFC 8252), use a loopback IP such as "127.0.0.1" instead'
        });
        return false;
      }
      return true;
    });
    exports.oauthHttpsRedirectURISchema = uri_js_1.httpsUriSchema;
    exports.oauthPrivateUseRedirectURISchema = uri_js_1.privateUseUriSchema;
    exports.oauthRedirectUriSchema = zod_1.z.union([
      exports.oauthLoopbackRedirectURISchema,
      exports.oauthHttpsRedirectURISchema,
      exports.oauthPrivateUseRedirectURISchema
    ], {
      message: `URL must use the "https:" or "http:" protocol, or a private-use URI scheme (RFC 8252)`
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-scope.js
var require_oauth_scope = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-scope.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthScopeSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthScopeSchema = zod_1.z.string().regex(/^[\x21\x23-\x5B\x5D-\x7E]+(?: [\x21\x23-\x5B\x5D-\x7E]+)*$/);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-client-id-loopback.js
var require_oauth_client_id_loopback = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-client-id-loopback.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthClientIdLoopbackSchema = void 0;
    exports.isOAuthClientIdLoopback = isOAuthClientIdLoopback;
    exports.assertOAuthLoopbackClientId = assertOAuthLoopbackClientId;
    exports.parseOAuthLoopbackClientId = parseOAuthLoopbackClientId;
    var zod_1 = require_zod();
    var oauth_client_id_js_1 = require_oauth_client_id();
    var oauth_redirect_uri_js_1 = require_oauth_redirect_uri();
    var oauth_scope_js_1 = require_oauth_scope();
    var PREFIX = "http://localhost";
    exports.oauthClientIdLoopbackSchema = oauth_client_id_js_1.oauthClientIdSchema.superRefine((value, ctx) => {
      try {
        assertOAuthLoopbackClientId(value);
        return true;
      } catch (error) {
        ctx.addIssue({
          code: zod_1.ZodIssueCode.custom,
          message: error instanceof TypeError ? error.message : "Invalid loopback client ID"
        });
        return false;
      }
    });
    function isOAuthClientIdLoopback(clientId) {
      try {
        parseOAuthLoopbackClientId(clientId);
        return true;
      } catch {
        return false;
      }
    }
    function assertOAuthLoopbackClientId(clientId) {
      void parseOAuthLoopbackClientId(clientId);
    }
    function parseOAuthLoopbackClientId(clientId) {
      if (!clientId.startsWith(PREFIX)) {
        throw new TypeError(`Loopback ClientID must start with "${PREFIX}"`);
      } else if (clientId.includes("#", PREFIX.length)) {
        throw new TypeError("Loopback ClientID must not contain a hash component");
      }
      const queryStringIdx = clientId.length > PREFIX.length && clientId[PREFIX.length] === "/" ? PREFIX.length + 1 : PREFIX.length;
      if (clientId.length === queryStringIdx) {
        return {};
      }
      if (clientId[queryStringIdx] !== "?") {
        throw new TypeError("Loopback ClientID must not contain a path component");
      }
      const searchParams = new URLSearchParams(clientId.slice(queryStringIdx + 1));
      for (const name2 of searchParams.keys()) {
        if (name2 !== "redirect_uri" && name2 !== "scope") {
          throw new TypeError(`Invalid query parameter "${name2}" in client ID`);
        }
      }
      const scope = searchParams.get("scope") ?? void 0;
      if (scope != null) {
        if (searchParams.getAll("scope").length > 1) {
          throw new TypeError("Loopback ClientID must contain at most one scope query parameter");
        } else if (!oauth_scope_js_1.oauthScopeSchema.safeParse(scope).success) {
          throw new TypeError("Invalid scope query parameter in client ID");
        }
      }
      const redirect_uris = searchParams.has("redirect_uri") ? searchParams.getAll("redirect_uri").map((value) => oauth_redirect_uri_js_1.oauthLoopbackRedirectURISchema.parse(value)) : void 0;
      return {
        scope,
        redirect_uris
      };
    }
  }
});

// node_modules/@atproto/oauth-types/dist/atproto-loopback-client-metadata.js
var require_atproto_loopback_client_metadata = __commonJS({
  "node_modules/@atproto/oauth-types/dist/atproto-loopback-client-metadata.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.atprotoLoopbackClientMetadata = atprotoLoopbackClientMetadata;
    var oauth_client_id_loopback_js_1 = require_oauth_client_id_loopback();
    function atprotoLoopbackClientMetadata(clientId) {
      const { scope = "atproto", redirect_uris = [`http://127.0.0.1/`, `http://[::1]/`] } = (0, oauth_client_id_loopback_js_1.parseOAuthLoopbackClientId)(clientId);
      return {
        client_id: clientId,
        scope,
        redirect_uris,
        response_types: ["code"],
        grant_types: ["authorization_code", "refresh_token"],
        token_endpoint_auth_method: "none",
        application_type: "native",
        dpop_bound_access_tokens: true
      };
    }
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-access-token.js
var require_oauth_access_token = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-access-token.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthAccessTokenSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthAccessTokenSchema = zod_1.z.string().min(1);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-authorization-response-error.js
var require_oauth_authorization_response_error = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-authorization-response-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthAuthorizationResponseErrorSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthAuthorizationResponseErrorSchema = zod_1.z.enum([
      // The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.
      "invalid_request",
      // The client is not authorized to request an authorization code using this method.
      "unauthorized_client",
      // The resource owner or authorization server denied the request.
      "access_denied",
      // The authorization server does not support obtaining an authorization code using this method.
      "unsupported_response_type",
      // The requested scope is invalid, unknown, or malformed.
      "invalid_scope",
      // The authorization server encountered an unexpected condition that prevented it from fulfilling the request. (This error code is needed because a 500 Internal Server Error HTTP status code cannot be returned to the client via an HTTP redirect.)
      "server_error",
      // The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server. (This error code is needed because a 503 Service Unavailable HTTP status code cannot be returned to the client via an HTTP redirect.)
      "temporarily_unavailable"
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-authorization-code-grant-token-request.js
var require_oauth_authorization_code_grant_token_request = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-authorization-code-grant-token-request.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthAuthorizationCodeGrantTokenRequestSchema = void 0;
    var zod_1 = require_zod();
    var oauth_redirect_uri_js_1 = require_oauth_redirect_uri();
    exports.oauthAuthorizationCodeGrantTokenRequestSchema = zod_1.z.object({
      grant_type: zod_1.z.literal("authorization_code"),
      code: zod_1.z.string().min(1),
      redirect_uri: oauth_redirect_uri_js_1.oauthRedirectUriSchema,
      /** @see {@link https://datatracker.ietf.org/doc/html/rfc7636#section-4.1} */
      code_verifier: zod_1.z.string().min(43).max(128).regex(/^[a-zA-Z0-9-._~]+$/).optional()
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-authorization-details.js
var require_oauth_authorization_details = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-authorization-details.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthAuthorizationDetailsSchema = exports.oauthAuthorizationDetailSchema = void 0;
    var zod_1 = require_zod();
    var uri_js_1 = require_uri5();
    exports.oauthAuthorizationDetailSchema = zod_1.z.object({
      type: zod_1.z.string(),
      /**
       * An array of strings representing the location of the resource or RS. These
       * strings are typically URIs identifying the location of the RS.
       */
      locations: zod_1.z.array(uri_js_1.dangerousUriSchema).optional(),
      /**
       * An array of strings representing the kinds of actions to be taken at the
       * resource.
       */
      actions: zod_1.z.array(zod_1.z.string()).optional(),
      /**
       * An array of strings representing the kinds of data being requested from the
       * resource.
       */
      datatypes: zod_1.z.array(zod_1.z.string()).optional(),
      /**
       * A string identifier indicating a specific resource available at the API.
       */
      identifier: zod_1.z.string().optional(),
      /**
       * An array of strings representing the types or levels of privilege being
       * requested at the resource.
       */
      privileges: zod_1.z.array(zod_1.z.string()).optional()
    });
    exports.oauthAuthorizationDetailsSchema = zod_1.z.array(exports.oauthAuthorizationDetailSchema);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-authorization-request-jar.js
var require_oauth_authorization_request_jar = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-authorization-request-jar.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthAuthorizationRequestJarSchema = void 0;
    var zod_1 = require_zod();
    var jwk_1 = require_dist12();
    exports.oauthAuthorizationRequestJarSchema = zod_1.z.object({
      /**
       * AuthorizationRequest inside a JWT:
       * - "iat" is required and **MUST** be less than one minute
       *
       * @see {@link https://datatracker.ietf.org/doc/html/rfc9101}
       */
      request: zod_1.z.union([jwk_1.signedJwtSchema, jwk_1.unsignedJwtSchema])
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-code-challenge-method.js
var require_oauth_code_challenge_method = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-code-challenge-method.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthCodeChallengeMethodSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthCodeChallengeMethodSchema = zod_1.z.enum(["S256", "plain"]);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-response-mode.js
var require_oauth_response_mode = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-response-mode.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthResponseModeSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthResponseModeSchema = zod_1.z.enum([
      "query",
      "fragment",
      "form_post"
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-response-type.js
var require_oauth_response_type = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-response-type.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthResponseTypeSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthResponseTypeSchema = zod_1.z.enum([
      // OAuth2 (https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-10#section-4.1.1)
      "code",
      // Authorization Code Grant
      "token",
      // Implicit Grant
      // OIDC (https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html)
      "none",
      "code id_token token",
      "code id_token",
      "code token",
      "id_token token",
      "id_token"
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oidc-claims-parameter.js
var require_oidc_claims_parameter = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oidc-claims-parameter.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oidcClaimsParameterSchema = void 0;
    var zod_1 = require_zod();
    exports.oidcClaimsParameterSchema = zod_1.z.enum([
      // https://openid.net/specs/openid-provider-authentication-policy-extension-1_0.html#rfc.section.5.2
      // if client metadata "require_auth_time" is true, this *must* be provided
      "auth_time",
      // OIDC
      "nonce",
      "acr",
      // OpenID: "profile" scope
      "name",
      "family_name",
      "given_name",
      "middle_name",
      "nickname",
      "preferred_username",
      "gender",
      "picture",
      "profile",
      "website",
      "birthdate",
      "zoneinfo",
      "locale",
      "updated_at",
      // OpenID: "email" scope
      "email",
      "email_verified",
      // OpenID: "phone" scope
      "phone_number",
      "phone_number_verified",
      // OpenID: "address" scope
      "address"
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oidc-claims-properties.js
var require_oidc_claims_properties = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oidc-claims-properties.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oidcClaimsPropertiesSchema = void 0;
    var zod_1 = require_zod();
    var oidcClaimsValueSchema = zod_1.z.union([zod_1.z.string(), zod_1.z.number(), zod_1.z.boolean()]);
    exports.oidcClaimsPropertiesSchema = zod_1.z.object({
      essential: zod_1.z.boolean().optional(),
      value: oidcClaimsValueSchema.optional(),
      values: zod_1.z.array(oidcClaimsValueSchema).optional()
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oidc-entity-type.js
var require_oidc_entity_type = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oidc-entity-type.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oidcEntityTypeSchema = void 0;
    var zod_1 = require_zod();
    exports.oidcEntityTypeSchema = zod_1.z.enum(["userinfo", "id_token"]);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-authorization-request-parameters.js
var require_oauth_authorization_request_parameters = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-authorization-request-parameters.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthAuthorizationRequestParametersSchema = void 0;
    var zod_1 = require_zod();
    var jwk_1 = require_dist12();
    var oauth_authorization_details_js_1 = require_oauth_authorization_details();
    var oauth_client_id_js_1 = require_oauth_client_id();
    var oauth_code_challenge_method_js_1 = require_oauth_code_challenge_method();
    var oauth_redirect_uri_js_1 = require_oauth_redirect_uri();
    var oauth_response_mode_js_1 = require_oauth_response_mode();
    var oauth_response_type_js_1 = require_oauth_response_type();
    var oauth_scope_js_1 = require_oauth_scope();
    var oidc_claims_parameter_js_1 = require_oidc_claims_parameter();
    var oidc_claims_properties_js_1 = require_oidc_claims_properties();
    var oidc_entity_type_js_1 = require_oidc_entity_type();
    var util_js_1 = require_util17();
    exports.oauthAuthorizationRequestParametersSchema = zod_1.z.object({
      client_id: oauth_client_id_js_1.oauthClientIdSchema,
      state: zod_1.z.string().optional(),
      redirect_uri: oauth_redirect_uri_js_1.oauthRedirectUriSchema.optional(),
      scope: oauth_scope_js_1.oauthScopeSchema.optional(),
      response_type: oauth_response_type_js_1.oauthResponseTypeSchema,
      // PKCE
      // https://datatracker.ietf.org/doc/html/rfc7636#section-4.3
      code_challenge: zod_1.z.string().optional(),
      code_challenge_method: oauth_code_challenge_method_js_1.oauthCodeChallengeMethodSchema.optional(),
      // DPOP
      // https://datatracker.ietf.org/doc/html/rfc9449#section-12.3
      dpop_jkt: zod_1.z.string().optional(),
      // OIDC
      // Default depend on response_type
      response_mode: oauth_response_mode_js_1.oauthResponseModeSchema.optional(),
      nonce: zod_1.z.string().optional(),
      // Specifies the allowable elapsed time in seconds since the last time the
      // End-User was actively authenticated by the OP. If the elapsed time is
      // greater than this value, the OP MUST attempt to actively re-authenticate
      // the End-User. (The max_age request parameter corresponds to the OpenID 2.0
      // PAPE [OpenID.PAPE] max_auth_age request parameter.) When max_age is used,
      // the ID Token returned MUST include an auth_time Claim Value. Note that
      // max_age=0 is equivalent to prompt=login.
      max_age: zod_1.z.preprocess(util_js_1.numberPreprocess, zod_1.z.number().int().min(0)).optional(),
      claims: zod_1.z.preprocess(util_js_1.jsonObjectPreprocess, zod_1.z.record(oidc_entity_type_js_1.oidcEntityTypeSchema, zod_1.z.record(oidc_claims_parameter_js_1.oidcClaimsParameterSchema, zod_1.z.union([zod_1.z.literal(null), oidc_claims_properties_js_1.oidcClaimsPropertiesSchema])))).optional(),
      // https://openid.net/specs/openid-connect-core-1_0.html#RegistrationParameter
      // Not supported by this library (yet?)
      // registration: clientMetadataSchema.optional(),
      login_hint: zod_1.z.string().min(1).optional(),
      ui_locales: zod_1.z.string().regex(/^[a-z]{2,3}(-[A-Z]{2})?( [a-z]{2,3}(-[A-Z]{2})?)*$/).optional(),
      // Previous ID Token, should be provided when prompt=none is used
      id_token_hint: jwk_1.signedJwtSchema.optional(),
      // Type of UI the AS is displayed on
      display: zod_1.z.enum(["page", "popup", "touch", "wap"]).optional(),
      /**
       * - "none" will only be allowed if the user already allowed the client on the same device
       * - "login" will force the user to login again, unless he very recently logged in
       * - "consent" will force the user to consent again
       * - "select_account" will force the user to select an account
       */
      prompt: zod_1.z.enum(["none", "login", "consent", "select_account"]).optional(),
      // https://datatracker.ietf.org/doc/html/rfc9396
      authorization_details: zod_1.z.preprocess(util_js_1.jsonObjectPreprocess, oauth_authorization_details_js_1.oauthAuthorizationDetailsSchema).optional()
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-authorization-request-par.js
var require_oauth_authorization_request_par = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-authorization-request-par.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthAuthorizationRequestParSchema = void 0;
    var zod_1 = require_zod();
    var oauth_authorization_request_jar_js_1 = require_oauth_authorization_request_jar();
    var oauth_authorization_request_parameters_js_1 = require_oauth_authorization_request_parameters();
    exports.oauthAuthorizationRequestParSchema = zod_1.z.union([
      oauth_authorization_request_parameters_js_1.oauthAuthorizationRequestParametersSchema,
      oauth_authorization_request_jar_js_1.oauthAuthorizationRequestJarSchema
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-request-uri.js
var require_oauth_request_uri = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-request-uri.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthRequestUriSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthRequestUriSchema = zod_1.z.string();
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-authorization-request-uri.js
var require_oauth_authorization_request_uri = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-authorization-request-uri.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthAuthorizationRequestUriSchema = void 0;
    var zod_1 = require_zod();
    var oauth_request_uri_js_1 = require_oauth_request_uri();
    exports.oauthAuthorizationRequestUriSchema = zod_1.z.object({
      request_uri: oauth_request_uri_js_1.oauthRequestUriSchema
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-authorization-request-query.js
var require_oauth_authorization_request_query = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-authorization-request-query.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthAuthorizationRequestQuerySchema = void 0;
    var zod_1 = require_zod();
    var oauth_authorization_request_jar_js_1 = require_oauth_authorization_request_jar();
    var oauth_authorization_request_parameters_js_1 = require_oauth_authorization_request_parameters();
    var oauth_authorization_request_uri_js_1 = require_oauth_authorization_request_uri();
    exports.oauthAuthorizationRequestQuerySchema = zod_1.z.union([
      oauth_authorization_request_parameters_js_1.oauthAuthorizationRequestParametersSchema,
      oauth_authorization_request_jar_js_1.oauthAuthorizationRequestJarSchema,
      oauth_authorization_request_uri_js_1.oauthAuthorizationRequestUriSchema
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-issuer-identifier.js
var require_oauth_issuer_identifier = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-issuer-identifier.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthIssuerIdentifierSchema = void 0;
    var zod_1 = require_zod();
    var uri_js_1 = require_uri5();
    exports.oauthIssuerIdentifierSchema = uri_js_1.webUriSchema.superRefine((value, ctx) => {
      if (value.endsWith("/")) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: "Issuer URL must not end with a slash"
        });
        return false;
      }
      const url = new URL(value);
      if (url.username || url.password) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: "Issuer URL must not contain a username or password"
        });
        return false;
      }
      if (url.hash || url.search) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: "Issuer URL must not contain a query or fragment"
        });
        return false;
      }
      const canonicalValue = url.pathname === "/" ? url.origin : url.href;
      if (value !== canonicalValue) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: "Issuer URL must be in the canonical form"
        });
        return false;
      }
      return true;
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-authorization-server-metadata.js
var require_oauth_authorization_server_metadata = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-authorization-server-metadata.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthAuthorizationServerMetadataValidator = exports.oauthAuthorizationServerMetadataSchema = void 0;
    var zod_1 = require_zod();
    var oauth_code_challenge_method_js_1 = require_oauth_code_challenge_method();
    var oauth_issuer_identifier_js_1 = require_oauth_issuer_identifier();
    var uri_js_1 = require_uri5();
    exports.oauthAuthorizationServerMetadataSchema = zod_1.z.object({
      issuer: oauth_issuer_identifier_js_1.oauthIssuerIdentifierSchema,
      claims_supported: zod_1.z.array(zod_1.z.string()).optional(),
      claims_locales_supported: zod_1.z.array(zod_1.z.string()).optional(),
      claims_parameter_supported: zod_1.z.boolean().optional(),
      request_parameter_supported: zod_1.z.boolean().optional(),
      request_uri_parameter_supported: zod_1.z.boolean().optional(),
      require_request_uri_registration: zod_1.z.boolean().optional(),
      scopes_supported: zod_1.z.array(zod_1.z.string()).optional(),
      subject_types_supported: zod_1.z.array(zod_1.z.string()).optional(),
      response_types_supported: zod_1.z.array(zod_1.z.string()).optional(),
      response_modes_supported: zod_1.z.array(zod_1.z.string()).optional(),
      grant_types_supported: zod_1.z.array(zod_1.z.string()).optional(),
      code_challenge_methods_supported: zod_1.z.array(oauth_code_challenge_method_js_1.oauthCodeChallengeMethodSchema).min(1).optional(),
      ui_locales_supported: zod_1.z.array(zod_1.z.string()).optional(),
      id_token_signing_alg_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
      display_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
      request_object_signing_alg_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
      authorization_response_iss_parameter_supported: zod_1.z.boolean().optional(),
      authorization_details_types_supported: zod_1.z.array(zod_1.z.string()).optional(),
      request_object_encryption_alg_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
      request_object_encryption_enc_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
      jwks_uri: uri_js_1.webUriSchema.optional(),
      authorization_endpoint: uri_js_1.webUriSchema,
      // .optional(),
      token_endpoint: uri_js_1.webUriSchema,
      // .optional(),
      // https://www.rfc-editor.org/rfc/rfc8414.html#section-2
      token_endpoint_auth_methods_supported: zod_1.z.array(zod_1.z.string()).default(["client_secret_basic"]),
      token_endpoint_auth_signing_alg_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
      revocation_endpoint: uri_js_1.webUriSchema.optional(),
      introspection_endpoint: uri_js_1.webUriSchema.optional(),
      pushed_authorization_request_endpoint: uri_js_1.webUriSchema.optional(),
      require_pushed_authorization_requests: zod_1.z.boolean().optional(),
      userinfo_endpoint: uri_js_1.webUriSchema.optional(),
      end_session_endpoint: uri_js_1.webUriSchema.optional(),
      registration_endpoint: uri_js_1.webUriSchema.optional(),
      // https://datatracker.ietf.org/doc/html/rfc9449#section-5.1
      dpop_signing_alg_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
      // https://datatracker.ietf.org/doc/html/draft-ietf-oauth-resource-metadata-05#section-4
      protected_resources: zod_1.z.array(uri_js_1.webUriSchema).optional(),
      // https://drafts.aaronpk.com/draft-parecki-oauth-client-id-metadata-document/draft-parecki-oauth-client-id-metadata-document.html
      client_id_metadata_document_supported: zod_1.z.boolean().optional()
    });
    exports.oauthAuthorizationServerMetadataValidator = exports.oauthAuthorizationServerMetadataSchema.superRefine((data, ctx) => {
      if (data.require_pushed_authorization_requests && !data.pushed_authorization_request_endpoint) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: '"pushed_authorization_request_endpoint" required when "require_pushed_authorization_requests" is true'
        });
      }
    }).superRefine((data, ctx) => {
      if (data.response_types_supported) {
        if (!data.response_types_supported.includes("code")) {
          ctx.addIssue({
            code: zod_1.z.ZodIssueCode.custom,
            message: 'Response type "code" is required'
          });
        }
      }
    }).superRefine((data, ctx) => {
      if (data.token_endpoint_auth_signing_alg_values_supported?.includes("none")) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: 'Client authentication method "none" is not allowed'
        });
      }
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-client-credentials-grant-token-request.js
var require_oauth_client_credentials_grant_token_request = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-client-credentials-grant-token-request.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthClientCredentialsGrantTokenRequestSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthClientCredentialsGrantTokenRequestSchema = zod_1.z.object({
      grant_type: zod_1.z.literal("client_credentials")
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-client-credentials.js
var require_oauth_client_credentials = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-client-credentials.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthClientCredentialsSchema = exports.oauthClientCredentialsNoneSchema = exports.oauthClientCredentialsSecretPostSchema = exports.oauthClientCredentialsJwtBearerSchema = void 0;
    var zod_1 = require_zod();
    var jwk_1 = require_dist12();
    var constants_js_1 = require_constants();
    var oauth_client_id_js_1 = require_oauth_client_id();
    exports.oauthClientCredentialsJwtBearerSchema = zod_1.z.object({
      client_id: oauth_client_id_js_1.oauthClientIdSchema,
      client_assertion_type: zod_1.z.literal(constants_js_1.CLIENT_ASSERTION_TYPE_JWT_BEARER),
      /**
       * - "sub" the subject MUST be the "client_id" of the OAuth client
       * - "iat" is required and MUST be less than one minute
       * - "aud" must containing a value that identifies the authorization server
       * - The JWT MAY contain a "jti" (JWT ID) claim that provides a unique identifier for the token.
       * - Note that the authorization server may reject JWTs with an "exp" claim value that is unreasonably far in the future.
       *
       * @see {@link https://datatracker.ietf.org/doc/html/rfc7523#section-3}
       */
      client_assertion: jwk_1.signedJwtSchema
    });
    exports.oauthClientCredentialsSecretPostSchema = zod_1.z.object({
      client_id: oauth_client_id_js_1.oauthClientIdSchema,
      client_secret: zod_1.z.string()
    });
    exports.oauthClientCredentialsNoneSchema = zod_1.z.object({
      client_id: oauth_client_id_js_1.oauthClientIdSchema
    });
    exports.oauthClientCredentialsSchema = zod_1.z.union([
      exports.oauthClientCredentialsJwtBearerSchema,
      exports.oauthClientCredentialsSecretPostSchema,
      // Must be last since it is less specific
      exports.oauthClientCredentialsNoneSchema
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-client-id-discoverable.js
var require_oauth_client_id_discoverable = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-client-id-discoverable.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.conventionalOAuthClientIdSchema = exports.oauthClientIdDiscoverableSchema = void 0;
    exports.isOAuthClientIdDiscoverable = isOAuthClientIdDiscoverable;
    exports.isConventionalOAuthClientId = isConventionalOAuthClientId;
    exports.assertOAuthDiscoverableClientId = assertOAuthDiscoverableClientId;
    exports.parseOAuthDiscoverableClientId = parseOAuthDiscoverableClientId;
    var zod_1 = require_zod();
    var oauth_client_id_js_1 = require_oauth_client_id();
    var uri_js_1 = require_uri5();
    var util_js_1 = require_util17();
    exports.oauthClientIdDiscoverableSchema = zod_1.z.intersection(oauth_client_id_js_1.oauthClientIdSchema, uri_js_1.httpsUriSchema).superRefine((value, ctx) => {
      const url = new URL(value);
      if (url.username || url.password) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: "ClientID must not contain credentials"
        });
        return false;
      }
      if (url.hash) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: "ClientID must not contain a fragment"
        });
        return false;
      }
      if (url.pathname === "/") {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: 'ClientID must contain a path component (e.g. "/client-metadata.json")'
        });
        return false;
      }
      if (url.pathname.endsWith("/")) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: "ClientID path must not end with a trailing slash"
        });
        return false;
      }
      if ((0, util_js_1.isHostnameIP)(url.hostname)) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: "ClientID hostname must not be an IP address"
        });
        return false;
      }
      if ((0, util_js_1.extractUrlPath)(value) !== url.pathname) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: `ClientID must be in canonical form ("${url.href}", got "${value}")`
        });
        return false;
      }
      return true;
    });
    function isOAuthClientIdDiscoverable(clientId) {
      return exports.oauthClientIdDiscoverableSchema.safeParse(clientId).success;
    }
    exports.conventionalOAuthClientIdSchema = exports.oauthClientIdDiscoverableSchema.superRefine((value, ctx) => {
      const url = new URL(value);
      if (url.port) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: "ClientID must not contain a port"
        });
        return false;
      }
      if (url.search) {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: "ClientID must not contain a query string"
        });
        return false;
      }
      if (url.pathname !== "/oauth-client-metadata.json") {
        ctx.addIssue({
          code: zod_1.z.ZodIssueCode.custom,
          message: 'ClientID must be "/oauth-client-metadata.json"'
        });
        return false;
      }
      return true;
    });
    function isConventionalOAuthClientId(clientId) {
      return exports.conventionalOAuthClientIdSchema.safeParse(clientId).success;
    }
    function assertOAuthDiscoverableClientId(value) {
      void exports.oauthClientIdDiscoverableSchema.parse(value);
    }
    function parseOAuthDiscoverableClientId(clientId) {
      return new URL(exports.oauthClientIdDiscoverableSchema.parse(clientId));
    }
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-endpoint-auth-method.js
var require_oauth_endpoint_auth_method = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-endpoint-auth-method.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthEndpointAuthMethod = void 0;
    var zod_1 = require_zod();
    exports.oauthEndpointAuthMethod = zod_1.z.enum([
      "client_secret_basic",
      "client_secret_jwt",
      "client_secret_post",
      "none",
      "private_key_jwt",
      "self_signed_tls_client_auth",
      "tls_client_auth"
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-grant-type.js
var require_oauth_grant_type = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-grant-type.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthGrantTypeSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthGrantTypeSchema = zod_1.z.enum([
      "authorization_code",
      "implicit",
      "refresh_token",
      "password",
      // Not part of OAuth 2.1
      "client_credentials",
      "urn:ietf:params:oauth:grant-type:jwt-bearer",
      "urn:ietf:params:oauth:grant-type:saml2-bearer"
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-client-metadata.js
var require_oauth_client_metadata = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-client-metadata.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthClientMetadataSchema = void 0;
    var zod_1 = require_zod();
    var jwk_1 = require_dist12();
    var oauth_client_id_js_1 = require_oauth_client_id();
    var oauth_endpoint_auth_method_js_1 = require_oauth_endpoint_auth_method();
    var oauth_grant_type_js_1 = require_oauth_grant_type();
    var oauth_redirect_uri_js_1 = require_oauth_redirect_uri();
    var oauth_response_type_js_1 = require_oauth_response_type();
    var oauth_scope_js_1 = require_oauth_scope();
    var uri_js_1 = require_uri5();
    exports.oauthClientMetadataSchema = zod_1.z.object({
      /**
       * @note redirect_uris require additional validation
       */
      // https://www.rfc-editor.org/rfc/rfc7591.html#section-2
      redirect_uris: zod_1.z.array(oauth_redirect_uri_js_1.oauthRedirectUriSchema).nonempty(),
      response_types: zod_1.z.array(oauth_response_type_js_1.oauthResponseTypeSchema).nonempty().default(["code"]),
      grant_types: zod_1.z.array(oauth_grant_type_js_1.oauthGrantTypeSchema).nonempty().default(["authorization_code"]),
      scope: oauth_scope_js_1.oauthScopeSchema.optional(),
      // https://www.rfc-editor.org/rfc/rfc7591.html#section-2
      token_endpoint_auth_method: oauth_endpoint_auth_method_js_1.oauthEndpointAuthMethod.default("client_secret_basic"),
      token_endpoint_auth_signing_alg: zod_1.z.string().optional(),
      userinfo_signed_response_alg: zod_1.z.string().optional(),
      userinfo_encrypted_response_alg: zod_1.z.string().optional(),
      jwks_uri: uri_js_1.webUriSchema.optional(),
      jwks: jwk_1.jwksPubSchema.optional(),
      application_type: zod_1.z.enum(["web", "native"]).default("web"),
      // default, per spec, is "web"
      subject_type: zod_1.z.enum(["public", "pairwise"]).default("public"),
      request_object_signing_alg: zod_1.z.string().optional(),
      id_token_signed_response_alg: zod_1.z.string().optional(),
      authorization_signed_response_alg: zod_1.z.string().default("RS256"),
      authorization_encrypted_response_enc: zod_1.z.enum(["A128CBC-HS256"]).optional(),
      authorization_encrypted_response_alg: zod_1.z.string().optional(),
      client_id: oauth_client_id_js_1.oauthClientIdSchema.optional(),
      client_name: zod_1.z.string().optional(),
      client_uri: uri_js_1.webUriSchema.optional(),
      policy_uri: uri_js_1.webUriSchema.optional(),
      tos_uri: uri_js_1.webUriSchema.optional(),
      logo_uri: uri_js_1.webUriSchema.optional(),
      // @TODO: allow data: uri ?
      /**
       * Default Maximum Authentication Age. Specifies that the End-User MUST be
       * actively authenticated if the End-User was authenticated longer ago than
       * the specified number of seconds. The max_age request parameter overrides
       * this default value. If omitted, no default Maximum Authentication Age is
       * specified.
       */
      default_max_age: zod_1.z.number().optional(),
      require_auth_time: zod_1.z.boolean().optional(),
      contacts: zod_1.z.array(zod_1.z.string().email()).optional(),
      tls_client_certificate_bound_access_tokens: zod_1.z.boolean().optional(),
      // https://datatracker.ietf.org/doc/html/rfc9449#section-5.2
      dpop_bound_access_tokens: zod_1.z.boolean().optional(),
      // https://datatracker.ietf.org/doc/html/rfc9396#section-14.5
      authorization_details_types: zod_1.z.array(zod_1.z.string()).optional()
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-endpoint-name.js
var require_oauth_endpoint_name = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-endpoint-name.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.OAUTH_ENDPOINT_NAMES = void 0;
    exports.OAUTH_ENDPOINT_NAMES = [
      "token",
      "revocation",
      "introspection",
      "pushed_authorization_request"
    ];
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-introspection-response.js
var require_oauth_introspection_response = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-introspection-response.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-par-response.js
var require_oauth_par_response = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-par-response.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthParResponseSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthParResponseSchema = zod_1.z.object({
      request_uri: zod_1.z.string(),
      expires_in: zod_1.z.number().int().positive()
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-password-grant-token-request.js
var require_oauth_password_grant_token_request = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-password-grant-token-request.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthPasswordGrantTokenRequestSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthPasswordGrantTokenRequestSchema = zod_1.z.object({
      grant_type: zod_1.z.literal("password"),
      username: zod_1.z.string(),
      password: zod_1.z.string()
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-protected-resource-metadata.js
var require_oauth_protected_resource_metadata = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-protected-resource-metadata.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthProtectedResourceMetadataSchema = void 0;
    var zod_1 = require_zod();
    var oauth_issuer_identifier_js_1 = require_oauth_issuer_identifier();
    var uri_js_1 = require_uri5();
    exports.oauthProtectedResourceMetadataSchema = zod_1.z.object({
      /**
       * REQUIRED. The protected resource's resource identifier, which is a URL that
       * uses the https scheme and has no query or fragment components. Using these
       * well-known resources is described in Section 3.
       *
       * @note This schema allows non https URLs for testing & development purposes.
       * Make sure to validate the URL before using it in a production environment.
       */
      resource: uri_js_1.webUriSchema.refine((url) => !url.includes("?"), {
        message: "Resource URL must not contain query parameters"
      }).refine((url) => !url.includes("#"), {
        message: "Resource URL must not contain a fragment"
      }),
      /**
       * OPTIONAL. JSON array containing a list of OAuth authorization server issuer
       * identifiers, as defined in [RFC8414], for authorization servers that can be
       * used with this protected resource. Protected resources MAY choose not to
       * advertise some supported authorization servers even when this parameter is
       * used. In some use cases, the set of authorization servers will not be
       * enumerable, in which case this metadata parameter would not be used.
       */
      authorization_servers: zod_1.z.array(oauth_issuer_identifier_js_1.oauthIssuerIdentifierSchema).optional(),
      /**
       * OPTIONAL. URL of the protected resource's JWK Set [JWK] document. This
       * contains public keys belonging to the protected resource, such as signing
       * key(s) that the resource server uses to sign resource responses. This URL
       * MUST use the https scheme. When both signing and encryption keys are made
       * available, a use (public key use) parameter value is REQUIRED for all keys
       * in the referenced JWK Set to indicate each key's intended usage.
       */
      jwks_uri: uri_js_1.webUriSchema.optional(),
      /**
       * RECOMMENDED. JSON array containing a list of the OAuth 2.0 [RFC6749] scope
       * values that are used in authorization requests to request access to this
       * protected resource. Protected resources MAY choose not to advertise some
       * scope values supported even when this parameter is used.
       */
      scopes_supported: zod_1.z.array(zod_1.z.string()).optional(),
      /**
       * OPTIONAL. JSON array containing a list of the supported methods of sending
       * an OAuth 2.0 Bearer Token [RFC6750] to the protected resource. Defined
       * values are ["header", "body", "query"], corresponding to Sections 2.1, 2.2,
       * and 2.3 of RFC 6750.
       */
      bearer_methods_supported: zod_1.z.array(zod_1.z.enum(["header", "body", "query"])).optional(),
      /**
       * OPTIONAL. JSON array containing a list of the JWS [JWS] signing algorithms
       * (alg values) [JWA] supported by the protected resource for signing resource
       * responses, for instance, as described in [FAPI.MessageSigning]. No default
       * algorithms are implied if this entry is omitted. The value none MUST NOT be
       * used.
       */
      resource_signing_alg_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
      /**
       * OPTIONAL. URL of a page containing human-readable information that
       * developers might want or need to know when using the protected resource
       */
      resource_documentation: uri_js_1.webUriSchema.optional(),
      /**
       * OPTIONAL. URL that the protected resource provides to read about the
       * protected resource's requirements on how the client can use the data
       * provided by the protected resource
       */
      resource_policy_uri: uri_js_1.webUriSchema.optional(),
      /**
       * OPTIONAL. URL that the protected resource provides to read about the
       * protected resource's terms of service
       */
      resource_tos_uri: uri_js_1.webUriSchema.optional()
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-refresh-token.js
var require_oauth_refresh_token = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-refresh-token.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthRefreshTokenSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthRefreshTokenSchema = zod_1.z.string().min(1);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-refresh-token-grant-token-request.js
var require_oauth_refresh_token_grant_token_request = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-refresh-token-grant-token-request.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthRefreshTokenGrantTokenRequestSchema = void 0;
    var zod_1 = require_zod();
    var oauth_refresh_token_js_1 = require_oauth_refresh_token();
    exports.oauthRefreshTokenGrantTokenRequestSchema = zod_1.z.object({
      grant_type: zod_1.z.literal("refresh_token"),
      refresh_token: oauth_refresh_token_js_1.oauthRefreshTokenSchema
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-token-identification.js
var require_oauth_token_identification = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-token-identification.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthTokenIdentificationSchema = void 0;
    var zod_1 = require_zod();
    var oauth_access_token_js_1 = require_oauth_access_token();
    var oauth_refresh_token_js_1 = require_oauth_refresh_token();
    exports.oauthTokenIdentificationSchema = zod_1.z.object({
      token: zod_1.z.union([oauth_access_token_js_1.oauthAccessTokenSchema, oauth_refresh_token_js_1.oauthRefreshTokenSchema]),
      token_type_hint: zod_1.z.enum(["access_token", "refresh_token"]).optional()
    });
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-token-request.js
var require_oauth_token_request = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-token-request.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthTokenRequestSchema = void 0;
    var zod_1 = require_zod();
    var oauth_authorization_code_grant_token_request_js_1 = require_oauth_authorization_code_grant_token_request();
    var oauth_client_credentials_grant_token_request_js_1 = require_oauth_client_credentials_grant_token_request();
    var oauth_password_grant_token_request_js_1 = require_oauth_password_grant_token_request();
    var oauth_refresh_token_grant_token_request_js_1 = require_oauth_refresh_token_grant_token_request();
    exports.oauthTokenRequestSchema = zod_1.z.discriminatedUnion("grant_type", [
      oauth_authorization_code_grant_token_request_js_1.oauthAuthorizationCodeGrantTokenRequestSchema,
      oauth_refresh_token_grant_token_request_js_1.oauthRefreshTokenGrantTokenRequestSchema,
      oauth_password_grant_token_request_js_1.oauthPasswordGrantTokenRequestSchema,
      oauth_client_credentials_grant_token_request_js_1.oauthClientCredentialsGrantTokenRequestSchema
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-token-type.js
var require_oauth_token_type = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-token-type.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthTokenTypeSchema = void 0;
    var zod_1 = require_zod();
    exports.oauthTokenTypeSchema = zod_1.z.union([
      zod_1.z.string().regex(/^DPoP$/i).transform(() => "DPoP"),
      zod_1.z.string().regex(/^Bearer$/i).transform(() => "Bearer")
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oauth-token-response.js
var require_oauth_token_response = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oauth-token-response.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oauthTokenResponseSchema = void 0;
    var zod_1 = require_zod();
    var jwk_1 = require_dist12();
    var oauth_authorization_details_js_1 = require_oauth_authorization_details();
    var oauth_token_type_js_1 = require_oauth_token_type();
    exports.oauthTokenResponseSchema = zod_1.z.object({
      // https://www.rfc-editor.org/rfc/rfc6749.html#section-5.1
      access_token: zod_1.z.string(),
      token_type: oauth_token_type_js_1.oauthTokenTypeSchema,
      scope: zod_1.z.string().optional(),
      refresh_token: zod_1.z.string().optional(),
      expires_in: zod_1.z.number().optional(),
      // https://openid.net/specs/openid-connect-core-1_0.html#TokenResponse
      id_token: jwk_1.signedJwtSchema.optional(),
      // https://datatracker.ietf.org/doc/html/rfc9396#name-enriched-authorization-deta
      authorization_details: oauth_authorization_details_js_1.oauthAuthorizationDetailsSchema.optional()
    }).passthrough();
  }
});

// node_modules/@atproto/oauth-types/dist/oidc-authorization-error-response.js
var require_oidc_authorization_error_response = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oidc-authorization-error-response.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oidcAuthorizationResponseErrorSchema = void 0;
    var zod_1 = require_zod();
    exports.oidcAuthorizationResponseErrorSchema = zod_1.z.enum([
      // The Authorization Server requires End-User interaction of some form to proceed. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User interaction.
      "interaction_required",
      // The Authorization Server requires End-User authentication. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User authentication.
      "login_required",
      // The End-User is REQUIRED to select a session at the Authorization Server. The End-User MAY be authenticated at the Authorization Server with different associated accounts, but the End-User did not select a session. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface to prompt for a session to use.
      "account_selection_required",
      // The Authorization Server requires End-User consent. This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User consent.
      "consent_required",
      // The request_uri in the Authorization Request returns an error or contains invalid data.
      "invalid_request_uri",
      // The request parameter contains an invalid Request Object.
      "invalid_request_object",
      // The OP does not support use of the request parameter defined in Section 6.
      "request_not_supported",
      // The OP does not support use of the request_uri parameter defined in Section 6.
      "request_uri_not_supported",
      // The OP does not support use of the registration parameter defined in Section 7.2.1.
      "registration_not_supported"
    ]);
  }
});

// node_modules/@atproto/oauth-types/dist/oidc-userinfo.js
var require_oidc_userinfo = __commonJS({
  "node_modules/@atproto/oauth-types/dist/oidc-userinfo.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.oidcUserinfoSchema = void 0;
    var zod_1 = require_zod();
    exports.oidcUserinfoSchema = zod_1.z.object({
      sub: zod_1.z.string(),
      iss: zod_1.z.string().url().optional(),
      aud: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string()).min(1)]).optional(),
      email: zod_1.z.string().email().optional(),
      email_verified: zod_1.z.boolean().optional(),
      name: zod_1.z.string().optional(),
      preferred_username: zod_1.z.string().optional(),
      picture: zod_1.z.string().url().optional()
    });
  }
});

// node_modules/@atproto/oauth-types/dist/index.js
var require_dist22 = __commonJS({
  "node_modules/@atproto/oauth-types/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_constants(), exports);
    __exportStar2(require_uri5(), exports);
    __exportStar2(require_util17(), exports);
    __exportStar2(require_atproto_loopback_client_metadata(), exports);
    __exportStar2(require_oauth_access_token(), exports);
    __exportStar2(require_oauth_authorization_response_error(), exports);
    __exportStar2(require_oauth_authorization_code_grant_token_request(), exports);
    __exportStar2(require_oauth_authorization_details(), exports);
    __exportStar2(require_oauth_authorization_request_jar(), exports);
    __exportStar2(require_oauth_authorization_request_par(), exports);
    __exportStar2(require_oauth_authorization_request_parameters(), exports);
    __exportStar2(require_oauth_authorization_request_query(), exports);
    __exportStar2(require_oauth_authorization_request_uri(), exports);
    __exportStar2(require_oauth_authorization_server_metadata(), exports);
    __exportStar2(require_oauth_client_credentials_grant_token_request(), exports);
    __exportStar2(require_oauth_client_credentials(), exports);
    __exportStar2(require_oauth_client_id_discoverable(), exports);
    __exportStar2(require_oauth_client_id_loopback(), exports);
    __exportStar2(require_oauth_client_id(), exports);
    __exportStar2(require_oauth_client_metadata(), exports);
    __exportStar2(require_oauth_endpoint_auth_method(), exports);
    __exportStar2(require_oauth_endpoint_name(), exports);
    __exportStar2(require_oauth_grant_type(), exports);
    __exportStar2(require_oauth_introspection_response(), exports);
    __exportStar2(require_oauth_issuer_identifier(), exports);
    __exportStar2(require_oauth_par_response(), exports);
    __exportStar2(require_oauth_password_grant_token_request(), exports);
    __exportStar2(require_oauth_protected_resource_metadata(), exports);
    __exportStar2(require_oauth_redirect_uri(), exports);
    __exportStar2(require_oauth_refresh_token_grant_token_request(), exports);
    __exportStar2(require_oauth_refresh_token(), exports);
    __exportStar2(require_oauth_request_uri(), exports);
    __exportStar2(require_oauth_response_mode(), exports);
    __exportStar2(require_oauth_response_type(), exports);
    __exportStar2(require_oauth_scope(), exports);
    __exportStar2(require_oauth_token_identification(), exports);
    __exportStar2(require_oauth_token_request(), exports);
    __exportStar2(require_oauth_token_response(), exports);
    __exportStar2(require_oauth_token_type(), exports);
    __exportStar2(require_oidc_authorization_error_response(), exports);
    __exportStar2(require_oidc_claims_parameter(), exports);
    __exportStar2(require_oidc_claims_properties(), exports);
    __exportStar2(require_oidc_entity_type(), exports);
    __exportStar2(require_oidc_userinfo(), exports);
  }
});

// node_modules/@atproto/oauth-client/dist/lock.js
var require_lock = __commonJS({
  "node_modules/@atproto/oauth-client/dist/lock.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.requestLocalLock = void 0;
    var locks = /* @__PURE__ */ new Map();
    function acquireLocalLock(name2) {
      return new Promise((resolveAcquire) => {
        const prev = locks.get(name2) ?? Promise.resolve();
        const next = prev.then(() => {
          return new Promise((resolveRelease) => {
            const release = () => {
              if (locks.get(name2) === next)
                locks.delete(name2);
              resolveRelease();
            };
            resolveAcquire(release);
          });
        });
        locks.set(name2, next);
      });
    }
    var requestLocalLock = (name2, fn) => {
      return acquireLocalLock(name2).then(async (release) => {
        try {
          return await fn();
        } finally {
          release();
        }
      });
    };
    exports.requestLocalLock = requestLocalLock;
  }
});

// node_modules/@atproto/oauth-client/dist/util.js
var require_util18 = __commonJS({
  "node_modules/@atproto/oauth-client/dist/util.js"(exports) {
    "use strict";
    var __classPrivateFieldSet2 = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
      if (kind === "m") throw new TypeError("Private method is not writable");
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
      return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
    };
    var __classPrivateFieldGet2 = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
      return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.includesSpaceSeparatedValue = exports.CustomEventTarget = exports.CustomEvent = exports.timeoutSignal = exports.ifString = void 0;
    exports.contentMime = contentMime;
    exports.combineSignals = combineSignals;
    Symbol.dispose ?? (Symbol.dispose = Symbol("@@dispose"));
    var ifString = (v) => typeof v === "string" ? v : void 0;
    exports.ifString = ifString;
    var timeoutSignal = (timeout, options) => {
      if (!Number.isInteger(timeout) || timeout < 0) {
        throw new TypeError("Expected a positive integer");
      }
      options?.signal?.throwIfAborted();
      const controller = new AbortController();
      const { signal } = controller;
      options?.signal?.addEventListener("abort", (reason) => controller.abort(reason), { once: true, signal });
      const timeoutId = setTimeout(
        (err) => controller.abort(err),
        timeout,
        // create Error here to keep original stack trace
        new Error("Timeout")
      );
      timeoutId?.unref?.();
      signal.addEventListener("abort", () => clearTimeout(timeoutId), {
        once: true,
        signal
      });
      Object.defineProperty(signal, Symbol.dispose, {
        value: () => controller.abort()
      });
      return signal;
    };
    exports.timeoutSignal = timeoutSignal;
    function contentMime(headers) {
      return headers.get("content-type")?.split(";")[0].trim();
    }
    exports.CustomEvent = globalThis.CustomEvent ?? (() => {
      var _CustomEvent_detail;
      class CustomEvent extends Event {
        constructor(type, options) {
          if (!arguments.length)
            throw new TypeError("type argument is required");
          super(type, options);
          _CustomEvent_detail.set(this, void 0);
          __classPrivateFieldSet2(this, _CustomEvent_detail, options?.detail ?? null, "f");
        }
        get detail() {
          return __classPrivateFieldGet2(this, _CustomEvent_detail, "f");
        }
      }
      _CustomEvent_detail = /* @__PURE__ */ new WeakMap();
      Object.defineProperties(CustomEvent.prototype, {
        [Symbol.toStringTag]: {
          writable: false,
          enumerable: false,
          configurable: true,
          value: "CustomEvent"
        },
        detail: {
          enumerable: true
        }
      });
      return CustomEvent;
    })();
    var CustomEventTarget = class {
      constructor() {
        Object.defineProperty(this, "eventTarget", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: new EventTarget()
        });
      }
      addEventListener(type, callback, options) {
        this.eventTarget.addEventListener(type, callback, options);
      }
      removeEventListener(type, callback, options) {
        this.eventTarget.removeEventListener(type, callback, options);
      }
      dispatchCustomEvent(type, detail, init) {
        return this.eventTarget.dispatchEvent(new exports.CustomEvent(type, { ...init, detail }));
      }
    };
    exports.CustomEventTarget = CustomEventTarget;
    var includesSpaceSeparatedValue = (input, value) => {
      if (value.length === 0)
        throw new TypeError("Value cannot be empty");
      if (value.includes(" "))
        throw new TypeError("Value cannot contain spaces");
      const inputLength = input.length;
      const valueLength = value.length;
      if (inputLength < valueLength)
        return false;
      let idx = input.indexOf(value);
      let idxEnd;
      while (idx !== -1) {
        idxEnd = idx + valueLength;
        if (
          // at beginning or preceded by space
          (idx === 0 || input[idx - 1] === " ") && // at end or followed by space
          (idxEnd === inputLength || input[idxEnd] === " ")
        ) {
          return true;
        }
        idx = input.indexOf(value, idxEnd + 1);
      }
      return false;
    };
    exports.includesSpaceSeparatedValue = includesSpaceSeparatedValue;
    function combineSignals(signals) {
      const controller = new AbortController();
      const onAbort = function(_event) {
        const reason = new Error("This operation was aborted", {
          cause: this.reason
        });
        controller.abort(reason);
      };
      for (const sig of signals) {
        if (!sig)
          continue;
        if (sig.aborted) {
          controller.abort();
          throw new Error("One of the signals is already aborted", {
            cause: sig.reason
          });
        }
        sig.addEventListener("abort", onAbort, { signal: controller.signal });
      }
      controller[Symbol.dispose] = () => {
        const reason = new Error("AbortController was disposed");
        controller.abort(reason);
      };
      return controller;
    }
  }
});

// node_modules/@atproto/oauth-client/dist/oauth-authorization-server-metadata-resolver.js
var require_oauth_authorization_server_metadata_resolver = __commonJS({
  "node_modules/@atproto/oauth-client/dist/oauth-authorization-server-metadata-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.OAuthAuthorizationServerMetadataResolver = void 0;
    var oauth_types_1 = require_dist22();
    var fetch_1 = require_dist19();
    var simple_store_1 = require_dist17();
    var util_js_1 = require_util18();
    var OAuthAuthorizationServerMetadataResolver = class extends simple_store_1.CachedGetter {
      constructor(cache, fetch2, config) {
        super(async (issuer, options) => this.fetchMetadata(issuer, options), cache);
        Object.defineProperty(this, "fetch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "allowHttpIssuer", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.fetch = (0, fetch_1.bindFetch)(fetch2);
        this.allowHttpIssuer = config?.allowHttpIssuer === true;
      }
      async get(input, options) {
        const issuer = oauth_types_1.oauthIssuerIdentifierSchema.parse(input);
        if (!this.allowHttpIssuer && issuer.startsWith("http:")) {
          throw new TypeError("Unsecure issuer URL protocol only allowed in development and test environments");
        }
        return super.get(issuer, options);
      }
      async fetchMetadata(issuer, options) {
        const url = new URL(`/.well-known/oauth-authorization-server`, issuer);
        const request = new Request(url, {
          headers: { accept: "application/json" },
          cache: options?.noCache ? "no-cache" : void 0,
          signal: options?.signal,
          redirect: "manual"
          // response must be 200 OK
        });
        const response = await this.fetch(request);
        if (response.status !== 200) {
          await (0, fetch_1.cancelBody)(response, "log");
          throw await fetch_1.FetchResponseError.from(response, `Unexpected status code ${response.status} for "${url}"`, void 0, { cause: request });
        }
        if ((0, util_js_1.contentMime)(response.headers) !== "application/json") {
          await (0, fetch_1.cancelBody)(response, "log");
          throw await fetch_1.FetchResponseError.from(response, `Unexpected content type for "${url}"`, void 0, { cause: request });
        }
        const metadata = oauth_types_1.oauthAuthorizationServerMetadataValidator.parse(await response.json());
        if (metadata.issuer !== issuer) {
          throw new TypeError(`Invalid issuer ${metadata.issuer}`);
        }
        if (metadata.client_id_metadata_document_supported !== true) {
          throw new TypeError(`Authorization server "${issuer}" does not support client_id_metadata_document`);
        }
        return metadata;
      }
    };
    exports.OAuthAuthorizationServerMetadataResolver = OAuthAuthorizationServerMetadataResolver;
  }
});

// node_modules/@atproto/oauth-client/dist/oauth-callback-error.js
var require_oauth_callback_error = __commonJS({
  "node_modules/@atproto/oauth-client/dist/oauth-callback-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.OAuthCallbackError = void 0;
    var OAuthCallbackError = class _OAuthCallbackError extends Error {
      static from(err, params, state) {
        if (err instanceof _OAuthCallbackError)
          return err;
        const message2 = err instanceof Error ? err.message : void 0;
        return new _OAuthCallbackError(params, message2, state, err);
      }
      constructor(params, message2 = params.get("error_description") || "OAuth callback error", state, cause) {
        super(message2, { cause });
        Object.defineProperty(this, "params", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: params
        });
        Object.defineProperty(this, "state", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: state
        });
      }
    };
    exports.OAuthCallbackError = OAuthCallbackError;
  }
});

// node_modules/@atproto-labs/identity-resolver/dist/constants.js
var require_constants2 = __commonJS({
  "node_modules/@atproto-labs/identity-resolver/dist/constants.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.HANDLE_INVALID = void 0;
    exports.HANDLE_INVALID = "handle.invalid";
  }
});

// node_modules/@atproto-labs/identity-resolver/dist/identity-resolver-error.js
var require_identity_resolver_error = __commonJS({
  "node_modules/@atproto-labs/identity-resolver/dist/identity-resolver-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.IdentityResolverError = void 0;
    var IdentityResolverError = class extends Error {
      constructor() {
        super(...arguments);
        Object.defineProperty(this, "name", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: "IdentityResolverError"
        });
      }
    };
    exports.IdentityResolverError = IdentityResolverError;
  }
});

// node_modules/@atproto-labs/identity-resolver/dist/util.js
var require_util19 = __commonJS({
  "node_modules/@atproto-labs/identity-resolver/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.extractAtprotoHandle = extractAtprotoHandle;
    exports.extractNormalizedHandle = extractNormalizedHandle;
    exports.asNormalizedHandle = asNormalizedHandle;
    exports.normalizeHandle = normalizeHandle;
    exports.isValidHandle = isValidHandle;
    function extractAtprotoHandle(document) {
      if (document.alsoKnownAs) {
        for (const h of document.alsoKnownAs) {
          if (h.startsWith("at://")) {
            return h.slice(5);
          }
        }
      }
      return void 0;
    }
    function extractNormalizedHandle(document) {
      const handle = extractAtprotoHandle(document);
      if (!handle)
        return void 0;
      return asNormalizedHandle(handle);
    }
    function asNormalizedHandle(input) {
      const handle = normalizeHandle(input);
      return isValidHandle(handle) ? handle : void 0;
    }
    function normalizeHandle(handle) {
      return handle.toLowerCase();
    }
    function isValidHandle(handle) {
      return handle.length > 0 && handle.length < 254 && /^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?$/.test(handle);
    }
  }
});

// node_modules/@atproto-labs/identity-resolver/dist/atproto-identity-resolver.js
var require_atproto_identity_resolver = __commonJS({
  "node_modules/@atproto-labs/identity-resolver/dist/atproto-identity-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AtprotoIdentityResolver = void 0;
    var did_resolver_1 = require_dist20();
    var constants_js_1 = require_constants2();
    var identity_resolver_error_js_1 = require_identity_resolver_error();
    var util_js_1 = require_util19();
    var AtprotoIdentityResolver = class {
      constructor(didResolver, handleResolver) {
        Object.defineProperty(this, "didResolver", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: didResolver
        });
        Object.defineProperty(this, "handleResolver", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: handleResolver
        });
      }
      async resolve(input, options) {
        return (0, did_resolver_1.isAtprotoDid)(input) ? this.resolveFromDid(input, options) : this.resolveFromHandle(input, options);
      }
      async resolveFromDid(did, options) {
        const document = await this.getDocumentFromDid(did, options);
        options?.signal?.throwIfAborted();
        const handle = (0, util_js_1.extractNormalizedHandle)(document);
        const resolvedDid = handle ? await this.handleResolver.resolve(handle, options).catch(() => void 0) : void 0;
        return {
          did: document.id,
          didDoc: document,
          handle: handle && resolvedDid === did ? handle : constants_js_1.HANDLE_INVALID
        };
      }
      async resolveFromHandle(handle, options) {
        const document = await this.getDocumentFromHandle(handle, options);
        return {
          did: document.id,
          didDoc: document,
          handle: (0, util_js_1.extractNormalizedHandle)(document) || constants_js_1.HANDLE_INVALID
        };
      }
      async getDocumentFromDid(did, options) {
        return this.didResolver.resolve(did, options);
      }
      async getDocumentFromHandle(input, options) {
        const handle = (0, util_js_1.asNormalizedHandle)(input);
        if (!handle) {
          throw new identity_resolver_error_js_1.IdentityResolverError(`Invalid handle "${input}" provided.`);
        }
        const did = await this.handleResolver.resolve(handle, options);
        if (!did) {
          throw new identity_resolver_error_js_1.IdentityResolverError(`Handle "${handle}" does not resolve to a DID`);
        }
        options?.signal?.throwIfAborted();
        const document = await this.didResolver.resolve(did, options);
        if (handle !== (0, util_js_1.extractNormalizedHandle)(document)) {
          throw new identity_resolver_error_js_1.IdentityResolverError(`Did document for "${did}" does not include the handle "${handle}"`);
        }
        return document;
      }
    };
    exports.AtprotoIdentityResolver = AtprotoIdentityResolver;
  }
});

// node_modules/@atproto-labs/identity-resolver/dist/identity-resolver.js
var require_identity_resolver = __commonJS({
  "node_modules/@atproto-labs/identity-resolver/dist/identity-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/@atproto-labs/identity-resolver/dist/index.js
var require_dist23 = __commonJS({
  "node_modules/@atproto-labs/identity-resolver/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    __exportStar2(require_atproto_identity_resolver(), exports);
    __exportStar2(require_constants2(), exports);
    __exportStar2(require_identity_resolver_error(), exports);
    __exportStar2(require_identity_resolver(), exports);
    __exportStar2(require_util19(), exports);
  }
});

// node_modules/@atproto/oauth-client/dist/constants.js
var require_constants3 = __commonJS({
  "node_modules/@atproto/oauth-client/dist/constants.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.FALLBACK_ALG = void 0;
    exports.FALLBACK_ALG = "ES256";
  }
});

// node_modules/@atproto/oauth-client/dist/errors/auth-method-unsatisfiable-error.js
var require_auth_method_unsatisfiable_error = __commonJS({
  "node_modules/@atproto/oauth-client/dist/errors/auth-method-unsatisfiable-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.AuthMethodUnsatisfiableError = void 0;
    var AuthMethodUnsatisfiableError = class extends Error {
    };
    exports.AuthMethodUnsatisfiableError = AuthMethodUnsatisfiableError;
  }
});

// node_modules/@atproto/oauth-client/dist/errors/token-revoked-error.js
var require_token_revoked_error = __commonJS({
  "node_modules/@atproto/oauth-client/dist/errors/token-revoked-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.TokenRevokedError = void 0;
    var TokenRevokedError = class extends Error {
      constructor(sub, message2 = `The session for "${sub}" was successfully revoked`, options) {
        super(message2, options);
        Object.defineProperty(this, "sub", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: sub
        });
      }
    };
    exports.TokenRevokedError = TokenRevokedError;
  }
});

// node_modules/@atproto/oauth-client/dist/identity-resolver.js
var require_identity_resolver2 = __commonJS({
  "node_modules/@atproto/oauth-client/dist/identity-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.createIdentityResolver = createIdentityResolver;
    var did_resolver_1 = require_dist20();
    var handle_resolver_1 = require_dist21();
    var identity_resolver_1 = require_dist23();
    function createIdentityResolver(options) {
      const { identityResolver } = options;
      if (identityResolver != null)
        return identityResolver;
      const didResolver = createDidResolver(options);
      const handleResolver = createHandleResolver(options);
      return new identity_resolver_1.AtprotoIdentityResolver(didResolver, handleResolver);
    }
    function createDidResolver(options) {
      const { didResolver, didCache } = options;
      if (didResolver instanceof did_resolver_1.DidResolverCached && !didCache) {
        return didResolver;
      }
      return new did_resolver_1.DidResolverCached(didResolver ?? new did_resolver_1.DidResolverCommon(options), didCache);
    }
    function createHandleResolver(options) {
      const { handleResolver, handleCache } = options;
      if (handleResolver == null) {
        throw new TypeError("handleResolver is required");
      }
      if (handleResolver instanceof handle_resolver_1.CachedHandleResolver && !handleCache) {
        return handleResolver;
      }
      return new handle_resolver_1.CachedHandleResolver(typeof handleResolver === "string" || handleResolver instanceof URL ? new handle_resolver_1.XrpcHandleResolver(handleResolver, options) : handleResolver, handleCache);
    }
  }
});

// node_modules/@atproto/oauth-client/dist/oauth-client-auth.js
var require_oauth_client_auth = __commonJS({
  "node_modules/@atproto/oauth-client/dist/oauth-client-auth.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.negotiateClientAuthMethod = negotiateClientAuthMethod;
    exports.createClientCredentialsFactory = createClientCredentialsFactory;
    var oauth_types_1 = require_dist22();
    var constants_js_1 = require_constants3();
    var auth_method_unsatisfiable_error_js_1 = require_auth_method_unsatisfiable_error();
    function negotiateClientAuthMethod(serverMetadata, clientMetadata, keyset) {
      const method = clientMetadata.token_endpoint_auth_method;
      const methods = supportedMethods(serverMetadata);
      if (!methods.includes(method)) {
        throw new Error(`The server does not support "${method}" authentication. Supported methods are: ${methods.join(", ")}.`);
      }
      if (method === "private_key_jwt") {
        if (!keyset)
          throw new Error("A keyset is required for private_key_jwt");
        const alg = supportedAlgs(serverMetadata);
        for (const key of keyset.list({ use: "sig", alg })) {
          if (key.isPrivate && key.kid) {
            return { method: "private_key_jwt", kid: key.kid };
          }
        }
        throw new Error(alg.includes(constants_js_1.FALLBACK_ALG) ? `Client authentication method "${method}" requires at least one "${constants_js_1.FALLBACK_ALG}" signing key with a "kid" property` : (
          // AS is not compliant with the ATproto OAuth spec.
          `Authorization server requires "${method}" authentication method, but does not support "${constants_js_1.FALLBACK_ALG}" algorithm.`
        ));
      }
      if (method === "none") {
        return { method: "none" };
      }
      throw new Error(`The ATProto OAuth spec requires that client use either "none" or "private_key_jwt" authentication method.` + (method === "client_secret_basic" ? ' You might want to explicitly set "token_endpoint_auth_method" to one of those values in the client metadata document.' : ` You set "${method}" which is not allowed.`));
    }
    function createClientCredentialsFactory(authMethod, serverMetadata, clientMetadata, runtime, keyset) {
      if (!supportedMethods(serverMetadata).includes(authMethod.method)) {
        throw new auth_method_unsatisfiable_error_js_1.AuthMethodUnsatisfiableError(`Client authentication method "${authMethod.method}" no longer supported`);
      }
      if (authMethod.method === "none") {
        return () => ({
          payload: {
            client_id: clientMetadata.client_id
          }
        });
      }
      if (authMethod.method === "private_key_jwt") {
        try {
          if (!keyset)
            throw new Error("A keyset is required for private_key_jwt");
          const { key, alg } = keyset.findPrivateKey({
            use: "sig",
            kid: authMethod.kid,
            alg: supportedAlgs(serverMetadata)
          });
          return async () => ({
            payload: {
              client_id: clientMetadata.client_id,
              client_assertion_type: oauth_types_1.CLIENT_ASSERTION_TYPE_JWT_BEARER,
              client_assertion: await key.createJwt({ alg }, {
                // > The JWT MUST contain an "iss" (issuer) claim that contains a
                // > unique identifier for the entity that issued the JWT.
                iss: clientMetadata.client_id,
                // > For client authentication, the subject MUST be the
                // > "client_id" of the OAuth client.
                sub: clientMetadata.client_id,
                // > The JWT MUST contain an "aud" (audience) claim containing a value
                // > that identifies the authorization server as an intended audience.
                // > The token endpoint URL of the authorization server MAY be used as a
                // > value for an "aud" element to identify the authorization server as an
                // > intended audience of the JWT.
                aud: serverMetadata.issuer,
                // > The JWT MAY contain a "jti" (JWT ID) claim that provides a
                // > unique identifier for the token.
                jti: await runtime.generateNonce(),
                // > The JWT MAY contain an "iat" (issued at) claim that
                // > identifies the time at which the JWT was issued.
                iat: Math.floor(Date.now() / 1e3),
                // > The JWT MUST contain an "exp" (expiration time) claim that
                // > limits the time window during which the JWT can be used.
                exp: Math.floor(Date.now() / 1e3) + 60
                // 1 minute
              })
            }
          });
        } catch (cause) {
          throw new auth_method_unsatisfiable_error_js_1.AuthMethodUnsatisfiableError("Failed to load private key", {
            cause
          });
        }
      }
      throw new auth_method_unsatisfiable_error_js_1.AuthMethodUnsatisfiableError(
        // @ts-expect-error
        `Unsupported auth method ${authMethod.method}`
      );
    }
    function supportedMethods(serverMetadata) {
      return serverMetadata["token_endpoint_auth_methods_supported"];
    }
    function supportedAlgs(serverMetadata) {
      return serverMetadata["token_endpoint_auth_signing_alg_values_supported"] ?? [
        // @NOTE If not specified, assume that the server supports the ES256
        // algorithm, as prescribed by the spec:
        //
        // > Clients and Authorization Servers currently must support the ES256
        // > cryptographic system [for client authentication].
        //
        // https://atproto.com/specs/oauth#confidential-client-authentication
        constants_js_1.FALLBACK_ALG
      ];
    }
  }
});

// node_modules/@atproto/oauth-client/dist/oauth-protected-resource-metadata-resolver.js
var require_oauth_protected_resource_metadata_resolver = __commonJS({
  "node_modules/@atproto/oauth-client/dist/oauth-protected-resource-metadata-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.OAuthProtectedResourceMetadataResolver = void 0;
    var oauth_types_1 = require_dist22();
    var fetch_1 = require_dist19();
    var simple_store_1 = require_dist17();
    var util_js_1 = require_util18();
    var OAuthProtectedResourceMetadataResolver = class extends simple_store_1.CachedGetter {
      constructor(cache, fetch2 = globalThis.fetch, config) {
        super(async (origin, options) => this.fetchMetadata(origin, options), cache);
        Object.defineProperty(this, "fetch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "allowHttpResource", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.fetch = (0, fetch_1.bindFetch)(fetch2);
        this.allowHttpResource = config?.allowHttpResource === true;
      }
      async get(resource, options) {
        const { protocol, origin } = new URL(resource);
        if (protocol !== "https:" && protocol !== "http:") {
          throw new TypeError(`Invalid protected resource metadata URL protocol: ${protocol}`);
        }
        if (protocol === "http:" && !this.allowHttpResource) {
          throw new TypeError(`Unsecure resource metadata URL (${protocol}) only allowed in development and test environments`);
        }
        return super.get(origin, options);
      }
      async fetchMetadata(origin, options) {
        const url = new URL(`/.well-known/oauth-protected-resource`, origin);
        const request = new Request(url, {
          signal: options?.signal,
          headers: { accept: "application/json" },
          cache: options?.noCache ? "no-cache" : void 0,
          redirect: "manual"
          // response must be 200 OK
        });
        const response = await this.fetch(request);
        if (response.status !== 200) {
          await (0, fetch_1.cancelBody)(response, "log");
          throw await fetch_1.FetchResponseError.from(response, `Unexpected status code ${response.status} for "${url}"`, void 0, { cause: request });
        }
        if ((0, util_js_1.contentMime)(response.headers) !== "application/json") {
          await (0, fetch_1.cancelBody)(response, "log");
          throw await fetch_1.FetchResponseError.from(response, `Unexpected content type for "${url}"`, void 0, { cause: request });
        }
        const metadata = oauth_types_1.oauthProtectedResourceMetadataSchema.parse(await response.json());
        if (metadata.resource !== origin) {
          throw new TypeError(`Invalid issuer ${metadata.resource}`);
        }
        return metadata;
      }
    };
    exports.OAuthProtectedResourceMetadataResolver = OAuthProtectedResourceMetadataResolver;
  }
});

// node_modules/@atproto/oauth-client/dist/oauth-resolver-error.js
var require_oauth_resolver_error = __commonJS({
  "node_modules/@atproto/oauth-client/dist/oauth-resolver-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.OAuthResolverError = void 0;
    var zod_1 = require_zod();
    var OAuthResolverError = class _OAuthResolverError extends Error {
      constructor(message2, options) {
        super(message2, options);
      }
      static from(cause, message2) {
        if (cause instanceof _OAuthResolverError)
          return cause;
        const validationReason = cause instanceof zod_1.ZodError ? `${cause.errors[0].path} ${cause.errors[0].message}` : null;
        const fullMessage = (message2 ?? `Unable to resolve identity`) + (validationReason ? ` (${validationReason})` : "");
        return new _OAuthResolverError(fullMessage, {
          cause
        });
      }
    };
    exports.OAuthResolverError = OAuthResolverError;
  }
});

// node_modules/@atproto/oauth-client/dist/oauth-resolver.js
var require_oauth_resolver = __commonJS({
  "node_modules/@atproto/oauth-client/dist/oauth-resolver.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.OAuthResolver = void 0;
    var oauth_types_1 = require_dist22();
    var oauth_resolver_error_js_1 = require_oauth_resolver_error();
    var OAuthResolver = class {
      constructor(identityResolver, protectedResourceMetadataResolver, authorizationServerMetadataResolver) {
        Object.defineProperty(this, "identityResolver", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: identityResolver
        });
        Object.defineProperty(this, "protectedResourceMetadataResolver", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: protectedResourceMetadataResolver
        });
        Object.defineProperty(this, "authorizationServerMetadataResolver", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: authorizationServerMetadataResolver
        });
      }
      /**
       * @param input - A handle, DID, PDS URL or Entryway URL
       */
      async resolve(input, options) {
        return /^https?:\/\//.test(input) ? this.resolveFromService(input, options) : this.resolveFromIdentity(input, options);
      }
      /**
       * @note this method can be used to verify if a particular uri supports OAuth
       * based sign-in (for compatibility with legacy implementation).
       */
      async resolveFromService(input, options) {
        try {
          const metadata = await this.getResourceServerMetadata(input, options);
          return { metadata };
        } catch (err) {
          if (!options?.signal?.aborted && err instanceof oauth_resolver_error_js_1.OAuthResolverError) {
            try {
              const result = oauth_types_1.oauthIssuerIdentifierSchema.safeParse(input);
              if (result.success) {
                const metadata = await this.getAuthorizationServerMetadata(result.data, options);
                return { metadata };
              }
            } catch {
            }
          }
          throw err;
        }
      }
      async resolveFromIdentity(input, options) {
        const identityInfo = await this.resolveIdentity(input, options);
        options?.signal?.throwIfAborted();
        const pds = extractPdsUrl(identityInfo.didDoc);
        const metadata = await this.getResourceServerMetadata(pds, options);
        return { identityInfo, metadata, pds };
      }
      async resolveIdentity(input, options) {
        try {
          return await this.identityResolver.resolve(input, options);
        } catch (cause) {
          throw oauth_resolver_error_js_1.OAuthResolverError.from(cause, `Failed to resolve identity: ${input}`);
        }
      }
      async getAuthorizationServerMetadata(issuer, options) {
        try {
          return await this.authorizationServerMetadataResolver.get(issuer, options);
        } catch (cause) {
          throw oauth_resolver_error_js_1.OAuthResolverError.from(cause, `Failed to resolve OAuth server metadata for issuer: ${issuer}`);
        }
      }
      async getResourceServerMetadata(pdsUrl, options) {
        try {
          const rsMetadata = await this.protectedResourceMetadataResolver.get(pdsUrl, options);
          if (rsMetadata.authorization_servers?.length !== 1) {
            throw new oauth_resolver_error_js_1.OAuthResolverError(rsMetadata.authorization_servers?.length ? `Unable to determine authorization server for PDS: ${pdsUrl}` : `No authorization servers found for PDS: ${pdsUrl}`);
          }
          const issuer = rsMetadata.authorization_servers[0];
          options?.signal?.throwIfAborted();
          const asMetadata = await this.getAuthorizationServerMetadata(issuer, options);
          if (asMetadata.protected_resources) {
            if (!asMetadata.protected_resources.includes(rsMetadata.resource)) {
              throw new oauth_resolver_error_js_1.OAuthResolverError(`PDS "${pdsUrl}" not protected by issuer "${issuer}"`);
            }
          }
          return asMetadata;
        } catch (cause) {
          throw oauth_resolver_error_js_1.OAuthResolverError.from(cause, `Failed to resolve OAuth server metadata for resource: ${pdsUrl}`);
        }
      }
    };
    exports.OAuthResolver = OAuthResolver;
    function isAtprotoPersonalDataServerService(s) {
      return typeof s.serviceEndpoint === "string" && s.type === "AtprotoPersonalDataServer" && (s.id.startsWith("#") ? s.id === "#atproto_pds" : s.id === `${this.id}#atproto_pds`);
    }
    function extractPdsUrl(document) {
      const service = document.service?.find(isAtprotoPersonalDataServerService, document);
      if (!service) {
        throw new oauth_resolver_error_js_1.OAuthResolverError(`Identity "${document.id}" does not have a PDS URL`);
      }
      try {
        return new URL(service.serviceEndpoint);
      } catch (cause) {
        throw new oauth_resolver_error_js_1.OAuthResolverError(`Invalid PDS URL in DID document: ${service.serviceEndpoint}`, { cause });
      }
    }
  }
});

// node_modules/@atproto/oauth-client/dist/atproto-token-response.js
var require_atproto_token_response = __commonJS({
  "node_modules/@atproto/oauth-client/dist/atproto-token-response.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.atprotoTokenResponseSchema = exports.atprotoScopeSchema = exports.isAtprotoScope = void 0;
    var zod_1 = require_zod();
    var did_1 = require_dist15();
    var oauth_types_1 = require_dist22();
    var util_1 = require_util18();
    var isAtprotoScope = (input) => (0, util_1.includesSpaceSeparatedValue)(input, "atproto");
    exports.isAtprotoScope = isAtprotoScope;
    exports.atprotoScopeSchema = zod_1.z.string().refine(exports.isAtprotoScope, 'The "atproto" scope is required');
    exports.atprotoTokenResponseSchema = oauth_types_1.oauthTokenResponseSchema.extend({
      token_type: zod_1.z.literal("DPoP"),
      sub: did_1.atprotoDidSchema,
      scope: exports.atprotoScopeSchema,
      // OpenID is not compatible with atproto identities
      id_token: zod_1.z.never().optional()
    });
  }
});

// node_modules/@atproto/oauth-client/dist/errors/token-refresh-error.js
var require_token_refresh_error = __commonJS({
  "node_modules/@atproto/oauth-client/dist/errors/token-refresh-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.TokenRefreshError = void 0;
    var TokenRefreshError = class extends Error {
      constructor(sub, message2, options) {
        super(message2, options);
        Object.defineProperty(this, "sub", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: sub
        });
      }
    };
    exports.TokenRefreshError = TokenRefreshError;
  }
});

// node_modules/@atproto/oauth-client/dist/fetch-dpop.js
var require_fetch_dpop = __commonJS({
  "node_modules/@atproto/oauth-client/dist/fetch-dpop.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.dpopFetchWrapper = dpopFetchWrapper;
    var base64_1 = (init_base64(), __toCommonJS(base64_exports));
    var fetch_1 = require_dist19();
    var subtle = globalThis.crypto?.subtle;
    var ReadableStream = globalThis.ReadableStream;
    function dpopFetchWrapper({
      key,
      // @TODO we should provide a default based on specs
      supportedAlgs,
      nonces,
      sha256: sha2562 = typeof subtle !== "undefined" ? subtleSha256 : void 0,
      isAuthServer,
      fetch: fetch2 = globalThis.fetch
    }) {
      if (!sha2562) {
        throw new TypeError(`crypto.subtle is not available in this environment. Please provide a sha256 function.`);
      }
      const alg = negotiateAlg(key, supportedAlgs);
      return async function(input, init) {
        const request = init == null && input instanceof Request ? input : new Request(input, init);
        const authorizationHeader = request.headers.get("Authorization");
        const ath = authorizationHeader?.startsWith("DPoP ") ? await sha2562(authorizationHeader.slice(5)) : void 0;
        const { origin } = new URL(request.url);
        const htm = request.method;
        const htu = buildHtu(request.url);
        let initNonce;
        try {
          initNonce = await nonces.get(origin);
        } catch {
        }
        const initProof = await buildProof(key, alg, htm, htu, initNonce, ath);
        request.headers.set("DPoP", initProof);
        const initResponse = await fetch2.call(this, request);
        const nextNonce = initResponse.headers.get("DPoP-Nonce");
        if (!nextNonce || nextNonce === initNonce) {
          return initResponse;
        }
        try {
          await nonces.set(origin, nextNonce);
        } catch {
        }
        const shouldRetry = await isUseDpopNonceError(initResponse, isAuthServer);
        if (!shouldRetry) {
          return initResponse;
        }
        if (input === request) {
          return initResponse;
        }
        if (ReadableStream && init?.body instanceof ReadableStream) {
          return initResponse;
        }
        await (0, fetch_1.cancelBody)(initResponse, "log");
        const nextProof = await buildProof(key, alg, htm, htu, nextNonce, ath);
        const nextRequest = new Request(input, init);
        nextRequest.headers.set("DPoP", nextProof);
        const retryRequest = await fetch2.call(this, nextRequest);
        const retryNonce = retryRequest.headers.get("DPoP-Nonce");
        if (!retryNonce || retryNonce === initNonce) {
          return retryRequest;
        }
        try {
          await nonces.set(origin, retryNonce);
        } catch {
        }
        return retryRequest;
      };
    }
    function buildHtu(url) {
      const fragmentIndex = url.indexOf("#");
      const queryIndex = url.indexOf("?");
      const end = fragmentIndex === -1 ? queryIndex : queryIndex === -1 ? fragmentIndex : Math.min(fragmentIndex, queryIndex);
      return end === -1 ? url : url.slice(0, end);
    }
    async function buildProof(key, alg, htm, htu, nonce, ath) {
      const jwk = key.bareJwk;
      if (!jwk) {
        throw new Error("Only asymmetric keys can be used as DPoP proofs");
      }
      const now = Math.floor(Date.now() / 1e3);
      return key.createJwt(
        // https://datatracker.ietf.org/doc/html/rfc9449#section-4.2
        {
          alg,
          typ: "dpop+jwt",
          jwk
        },
        {
          iat: now,
          // Any collision will cause the request to be rejected by the server. no biggie.
          jti: Math.random().toString(36).slice(2),
          htm,
          htu,
          nonce,
          ath
        }
      );
    }
    async function isUseDpopNonceError(response, isAuthServer) {
      if (isAuthServer === void 0 || isAuthServer === false) {
        if (response.status === 401) {
          const wwwAuth = response.headers.get("WWW-Authenticate");
          if (wwwAuth?.startsWith("DPoP")) {
            return wwwAuth.includes('error="use_dpop_nonce"');
          }
        }
      }
      if (isAuthServer === void 0 || isAuthServer === true) {
        if (response.status === 400) {
          try {
            const json = await (0, fetch_1.peekJson)(response, 10 * 1024);
            return typeof json === "object" && json?.["error"] === "use_dpop_nonce";
          } catch {
            return false;
          }
        }
      }
      return false;
    }
    function negotiateAlg(key, supportedAlgs) {
      if (supportedAlgs) {
        const alg = supportedAlgs.find((a) => key.algorithms.includes(a));
        if (alg)
          return alg;
      } else {
        const [alg] = key.algorithms;
        if (alg)
          return alg;
      }
      throw new Error("Key does not match any alg supported by the server");
    }
    async function subtleSha256(input) {
      if (subtle == null) {
        throw new Error(`crypto.subtle is not available in this environment. Please provide a sha256 function.`);
      }
      const bytes = new TextEncoder().encode(input);
      const digest3 = await subtle.digest("SHA-256", bytes);
      const digestBytes = new Uint8Array(digest3);
      return base64_1.base64url.baseEncode(digestBytes);
    }
  }
});

// node_modules/@atproto/oauth-client/dist/oauth-response-error.js
var require_oauth_response_error = __commonJS({
  "node_modules/@atproto/oauth-client/dist/oauth-response-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.OAuthResponseError = void 0;
    var util_js_1 = require_util18();
    var OAuthResponseError = class extends Error {
      constructor(response, payload) {
        const objPayload = typeof payload === "object" ? payload : void 0;
        const error = (0, util_js_1.ifString)(objPayload?.["error"]);
        const errorDescription = (0, util_js_1.ifString)(objPayload?.["error_description"]);
        const messageError = error ? `"${error}"` : "unknown";
        const messageDesc = errorDescription ? `: ${errorDescription}` : "";
        const message2 = `OAuth ${messageError} error${messageDesc}`;
        super(message2);
        Object.defineProperty(this, "response", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: response
        });
        Object.defineProperty(this, "payload", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: payload
        });
        Object.defineProperty(this, "error", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "errorDescription", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.error = error;
        this.errorDescription = errorDescription;
      }
      get status() {
        return this.response.status;
      }
      get headers() {
        return this.response.headers;
      }
    };
    exports.OAuthResponseError = OAuthResponseError;
  }
});

// node_modules/@atproto/oauth-client/dist/oauth-server-agent.js
var require_oauth_server_agent = __commonJS({
  "node_modules/@atproto/oauth-client/dist/oauth-server-agent.js"(exports) {
    "use strict";
    var __addDisposableResource2 = exports && exports.__addDisposableResource || function(env, value, async) {
      if (value !== null && value !== void 0) {
        if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
        var dispose, inner;
        if (async) {
          if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
          dispose = value[Symbol.asyncDispose];
        }
        if (dispose === void 0) {
          if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
          dispose = value[Symbol.dispose];
          if (async) inner = dispose;
        }
        if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
        if (inner) dispose = function() {
          try {
            inner.call(this);
          } catch (e) {
            return Promise.reject(e);
          }
        };
        env.stack.push({ value, dispose, async });
      } else if (async) {
        env.stack.push({ async: true });
      }
      return value;
    };
    var __disposeResources2 = exports && exports.__disposeResources || /* @__PURE__ */ function(SuppressedError2) {
      return function(env) {
        function fail(e) {
          env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
          env.hasError = true;
        }
        var r, s = 0;
        function next() {
          while (r = env.stack.pop()) {
            try {
              if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
              if (r.dispose) {
                var result = r.dispose.call(r.value);
                if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
                  fail(e);
                  return next();
                });
              } else s |= 1;
            } catch (e) {
              fail(e);
            }
          }
          if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
          if (env.hasError) throw env.error;
        }
        return next();
      };
    }(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message2) {
      var e = new Error(message2);
      return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
    });
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.OAuthServerAgent = void 0;
    var oauth_types_1 = require_dist22();
    var fetch_1 = require_dist19();
    var atproto_token_response_js_1 = require_atproto_token_response();
    var token_refresh_error_js_1 = require_token_refresh_error();
    var fetch_dpop_js_1 = require_fetch_dpop();
    var oauth_client_auth_js_1 = require_oauth_client_auth();
    var oauth_response_error_js_1 = require_oauth_response_error();
    var util_js_1 = require_util18();
    var OAuthServerAgent = class {
      /**
       * @throws see {@link createClientCredentialsFactory}
       */
      constructor(authMethod, dpopKey, serverMetadata, clientMetadata, dpopNonces, oauthResolver, runtime, keyset, fetch2) {
        Object.defineProperty(this, "authMethod", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: authMethod
        });
        Object.defineProperty(this, "dpopKey", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: dpopKey
        });
        Object.defineProperty(this, "serverMetadata", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: serverMetadata
        });
        Object.defineProperty(this, "clientMetadata", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: clientMetadata
        });
        Object.defineProperty(this, "dpopNonces", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: dpopNonces
        });
        Object.defineProperty(this, "oauthResolver", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: oauthResolver
        });
        Object.defineProperty(this, "runtime", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: runtime
        });
        Object.defineProperty(this, "keyset", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: keyset
        });
        Object.defineProperty(this, "dpopFetch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "clientCredentialsFactory", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.clientCredentialsFactory = (0, oauth_client_auth_js_1.createClientCredentialsFactory)(authMethod, serverMetadata, clientMetadata, runtime, keyset);
        this.dpopFetch = (0, fetch_dpop_js_1.dpopFetchWrapper)({
          fetch: (0, fetch_1.bindFetch)(fetch2),
          key: dpopKey,
          supportedAlgs: serverMetadata.dpop_signing_alg_values_supported,
          sha256: async (v) => runtime.sha256(v),
          nonces: dpopNonces,
          isAuthServer: true
        });
      }
      get issuer() {
        return this.serverMetadata.issuer;
      }
      async revoke(token) {
        try {
          await this.request("revocation", { token });
        } catch {
        }
      }
      async exchangeCode(code2, codeVerifier, redirectUri) {
        const now = Date.now();
        const tokenResponse = await this.request("token", {
          grant_type: "authorization_code",
          // redirectUri should always be passed by the calling code, but if it is
          // not, default to the first redirect_uri registered for the client:
          redirect_uri: redirectUri ?? this.clientMetadata.redirect_uris[0],
          code: code2,
          code_verifier: codeVerifier
        });
        try {
          const aud = await this.verifyIssuer(tokenResponse.sub);
          return {
            aud,
            sub: tokenResponse.sub,
            iss: this.issuer,
            scope: tokenResponse.scope,
            refresh_token: tokenResponse.refresh_token,
            access_token: tokenResponse.access_token,
            token_type: tokenResponse.token_type,
            expires_at: typeof tokenResponse.expires_in === "number" ? new Date(now + tokenResponse.expires_in * 1e3).toISOString() : void 0
          };
        } catch (err) {
          await this.revoke(tokenResponse.access_token);
          throw err;
        }
      }
      async refresh(tokenSet) {
        if (!tokenSet.refresh_token) {
          throw new token_refresh_error_js_1.TokenRefreshError(tokenSet.sub, "No refresh token available");
        }
        const aud = await this.verifyIssuer(tokenSet.sub);
        const now = Date.now();
        const tokenResponse = await this.request("token", {
          grant_type: "refresh_token",
          refresh_token: tokenSet.refresh_token
        });
        return {
          aud,
          sub: tokenSet.sub,
          iss: this.issuer,
          scope: tokenResponse.scope,
          refresh_token: tokenResponse.refresh_token,
          access_token: tokenResponse.access_token,
          token_type: tokenResponse.token_type,
          expires_at: typeof tokenResponse.expires_in === "number" ? new Date(now + tokenResponse.expires_in * 1e3).toISOString() : void 0
        };
      }
      /**
       * VERY IMPORTANT ! Always call this to process token responses.
       *
       * Whenever an OAuth token response is received, we **MUST** verify that the
       * "sub" is a DID, whose issuer authority is indeed the server we just
       * obtained credentials from. This check is a critical step to actually be
       * able to use the "sub" (DID) as being the actual user's identifier.
       *
       * @returns The user's PDS URL (the resource server for the user)
       */
      async verifyIssuer(sub) {
        const env_1 = { stack: [], error: void 0, hasError: false };
        try {
          const signal = __addDisposableResource2(env_1, (0, util_js_1.timeoutSignal)(1e4), false);
          const resolved = await this.oauthResolver.resolveFromIdentity(sub, {
            noCache: true,
            allowStale: false,
            signal
          });
          if (this.issuer !== resolved.metadata.issuer) {
            throw new TypeError("Issuer mismatch");
          }
          return resolved.pds.href;
        } catch (e_1) {
          env_1.error = e_1;
          env_1.hasError = true;
        } finally {
          __disposeResources2(env_1);
        }
      }
      async request(endpoint, payload) {
        const url = this.serverMetadata[`${endpoint}_endpoint`];
        if (!url)
          throw new Error(`No ${endpoint} endpoint available`);
        const auth = await this.clientCredentialsFactory();
        const { response, json } = await this.dpopFetch(url, {
          method: "POST",
          headers: {
            ...auth.headers,
            "Content-Type": "application/x-www-form-urlencoded"
          },
          body: wwwFormUrlEncode({ ...payload, ...auth.payload })
        }).then((0, fetch_1.fetchJsonProcessor)());
        if (response.ok) {
          switch (endpoint) {
            case "token":
              return atproto_token_response_js_1.atprotoTokenResponseSchema.parse(json);
            case "pushed_authorization_request":
              return oauth_types_1.oauthParResponseSchema.parse(json);
            default:
              return json;
          }
        } else {
          throw new oauth_response_error_js_1.OAuthResponseError(response, json);
        }
      }
    };
    exports.OAuthServerAgent = OAuthServerAgent;
    function wwwFormUrlEncode(payload) {
      return new URLSearchParams(Object.entries(payload).filter(entryHasDefinedValue).map(stringifyEntryValue)).toString();
    }
    function entryHasDefinedValue(entry) {
      return entry[1] !== void 0;
    }
    function stringifyEntryValue(entry) {
      const name2 = entry[0];
      const value = entry[1];
      switch (typeof value) {
        case "string":
          return [name2, value];
        case "number":
        case "boolean":
          return [name2, String(value)];
        default: {
          const enc = JSON.stringify(value);
          if (enc === void 0) {
            throw new Error(`Unsupported value type for ${name2}: ${String(value)}`);
          }
          return [name2, enc];
        }
      }
    }
  }
});

// node_modules/@atproto/oauth-client/dist/oauth-server-factory.js
var require_oauth_server_factory = __commonJS({
  "node_modules/@atproto/oauth-client/dist/oauth-server-factory.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.OAuthServerFactory = void 0;
    var oauth_client_auth_js_1 = require_oauth_client_auth();
    var oauth_server_agent_js_1 = require_oauth_server_agent();
    var OAuthServerFactory = class {
      constructor(clientMetadata, runtime, resolver, fetch2, keyset, dpopNonceCache) {
        Object.defineProperty(this, "clientMetadata", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: clientMetadata
        });
        Object.defineProperty(this, "runtime", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: runtime
        });
        Object.defineProperty(this, "resolver", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: resolver
        });
        Object.defineProperty(this, "fetch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: fetch2
        });
        Object.defineProperty(this, "keyset", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: keyset
        });
        Object.defineProperty(this, "dpopNonceCache", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: dpopNonceCache
        });
      }
      /**
       * @param authMethod `undefined` means that we are restoring a session that
       * was created before we started storing the `authMethod` in the session. In
       * that case, we will use the first key from the keyset.
       *
       * Support for this might be removed in the future.
       *
       * @throws see {@link OAuthServerFactory.fromMetadata}
       */
      async fromIssuer(issuer, authMethod, dpopKey, options) {
        const serverMetadata = await this.resolver.getAuthorizationServerMetadata(issuer, options);
        if (authMethod === "legacy") {
          authMethod = (0, oauth_client_auth_js_1.negotiateClientAuthMethod)(serverMetadata, this.clientMetadata, this.keyset);
        }
        return this.fromMetadata(serverMetadata, authMethod, dpopKey);
      }
      /**
       * @throws see {@link OAuthServerAgent}
       */
      async fromMetadata(serverMetadata, authMethod, dpopKey) {
        return new oauth_server_agent_js_1.OAuthServerAgent(authMethod, dpopKey, serverMetadata, this.clientMetadata, this.dpopNonceCache, this.resolver, this.runtime, this.keyset, this.fetch);
      }
    };
    exports.OAuthServerFactory = OAuthServerFactory;
  }
});

// node_modules/@atproto/oauth-client/dist/errors/token-invalid-error.js
var require_token_invalid_error = __commonJS({
  "node_modules/@atproto/oauth-client/dist/errors/token-invalid-error.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.TokenInvalidError = void 0;
    var TokenInvalidError = class extends Error {
      constructor(sub, message2 = `The session for "${sub}" is invalid`, options) {
        super(message2, options);
        Object.defineProperty(this, "sub", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: sub
        });
      }
    };
    exports.TokenInvalidError = TokenInvalidError;
  }
});

// node_modules/@atproto/oauth-client/dist/oauth-session.js
var require_oauth_session = __commonJS({
  "node_modules/@atproto/oauth-client/dist/oauth-session.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.OAuthSession = void 0;
    var fetch_1 = require_dist19();
    var token_invalid_error_js_1 = require_token_invalid_error();
    var token_revoked_error_js_1 = require_token_revoked_error();
    var fetch_dpop_js_1 = require_fetch_dpop();
    var ReadableStream = globalThis.ReadableStream;
    var OAuthSession = class {
      constructor(server, sub, sessionGetter, fetch2 = globalThis.fetch) {
        Object.defineProperty(this, "server", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: server
        });
        Object.defineProperty(this, "sub", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: sub
        });
        Object.defineProperty(this, "sessionGetter", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: sessionGetter
        });
        Object.defineProperty(this, "dpopFetch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.dpopFetch = (0, fetch_dpop_js_1.dpopFetchWrapper)({
          fetch: (0, fetch_1.bindFetch)(fetch2),
          key: server.dpopKey,
          supportedAlgs: server.serverMetadata.dpop_signing_alg_values_supported,
          sha256: async (v) => server.runtime.sha256(v),
          nonces: server.dpopNonces,
          isAuthServer: false
        });
      }
      get did() {
        return this.sub;
      }
      get serverMetadata() {
        return this.server.serverMetadata;
      }
      /**
       * @param refresh When `true`, the credentials will be refreshed even if they
       * are not expired. When `false`, the credentials will not be refreshed even
       * if they are expired. When `undefined`, the credentials will be refreshed
       * if, and only if, they are (about to be) expired. Defaults to `undefined`.
       */
      async getTokenSet(refresh) {
        const { tokenSet } = await this.sessionGetter.get(this.sub, {
          noCache: refresh === true,
          allowStale: refresh === false
        });
        return tokenSet;
      }
      async getTokenInfo(refresh = "auto") {
        const tokenSet = await this.getTokenSet(refresh);
        const expiresAt = tokenSet.expires_at == null ? void 0 : new Date(tokenSet.expires_at);
        return {
          expiresAt,
          get expired() {
            return expiresAt == null ? void 0 : expiresAt.getTime() < Date.now() - 5e3;
          },
          scope: tokenSet.scope,
          iss: tokenSet.iss,
          aud: tokenSet.aud,
          sub: tokenSet.sub
        };
      }
      async signOut() {
        try {
          const tokenSet = await this.getTokenSet(false);
          await this.server.revoke(tokenSet.access_token);
        } finally {
          await this.sessionGetter.delStored(this.sub, new token_revoked_error_js_1.TokenRevokedError(this.sub));
        }
      }
      async fetchHandler(pathname, init) {
        const tokenSet = await this.getTokenSet("auto");
        const initialUrl = new URL(pathname, tokenSet.aud);
        const initialAuth = `${tokenSet.token_type} ${tokenSet.access_token}`;
        const headers = new Headers(init?.headers);
        headers.set("Authorization", initialAuth);
        const initialResponse = await this.dpopFetch(initialUrl, {
          ...init,
          headers
        });
        if (!isInvalidTokenResponse(initialResponse)) {
          return initialResponse;
        }
        let tokenSetFresh;
        try {
          tokenSetFresh = await this.getTokenSet(true);
        } catch (err) {
          return initialResponse;
        }
        if (ReadableStream && init?.body instanceof ReadableStream) {
          return initialResponse;
        }
        const finalAuth = `${tokenSetFresh.token_type} ${tokenSetFresh.access_token}`;
        const finalUrl = new URL(pathname, tokenSetFresh.aud);
        headers.set("Authorization", finalAuth);
        const finalResponse = await this.dpopFetch(finalUrl, { ...init, headers });
        if (isInvalidTokenResponse(finalResponse)) {
          await this.sessionGetter.delStored(this.sub, new token_invalid_error_js_1.TokenInvalidError(this.sub));
        }
        return finalResponse;
      }
    };
    exports.OAuthSession = OAuthSession;
    function isInvalidTokenResponse(response) {
      if (response.status !== 401)
        return false;
      const wwwAuth = response.headers.get("WWW-Authenticate");
      return wwwAuth != null && (wwwAuth.startsWith("Bearer ") || wwwAuth.startsWith("DPoP ")) && wwwAuth.includes('error="invalid_token"');
    }
  }
});

// node_modules/@atproto/oauth-client/dist/runtime.js
var require_runtime = __commonJS({
  "node_modules/@atproto/oauth-client/dist/runtime.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.Runtime = void 0;
    var base64_1 = (init_base64(), __toCommonJS(base64_exports));
    var lock_js_1 = require_lock();
    var Runtime = class {
      constructor(implementation) {
        Object.defineProperty(this, "implementation", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: implementation
        });
        Object.defineProperty(this, "hasImplementationLock", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "usingLock", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        const { requestLock } = implementation;
        this.hasImplementationLock = requestLock != null;
        this.usingLock = requestLock?.bind(implementation) || // Falling back to a local lock
        lock_js_1.requestLocalLock;
      }
      async generateKey(algs) {
        const algsSorted = Array.from(algs).sort(compareAlgos);
        return this.implementation.createKey(algsSorted);
      }
      async sha256(text) {
        const bytes = new TextEncoder().encode(text);
        const digest3 = await this.implementation.digest(bytes, { name: "sha256" });
        return base64_1.base64url.baseEncode(digest3);
      }
      async generateNonce(length2 = 16) {
        const bytes = await this.implementation.getRandomValues(length2);
        return base64_1.base64url.baseEncode(bytes);
      }
      async generatePKCE(byteLength) {
        const verifier = await this.generateVerifier(byteLength);
        return {
          verifier,
          challenge: await this.sha256(verifier),
          method: "S256"
        };
      }
      async calculateJwkThumbprint(jwk) {
        const components = extractJktComponents(jwk);
        const data = JSON.stringify(components);
        return this.sha256(data);
      }
      /**
       * @see {@link https://datatracker.ietf.org/doc/html/rfc7636#section-4.1}
       * @note It is RECOMMENDED that the output of a suitable random number generator
       * be used to create a 32-octet sequence. The octet sequence is then
       * base64url-encoded to produce a 43-octet URL safe string to use as the code
       * verifier.
       */
      async generateVerifier(byteLength = 32) {
        if (byteLength < 32 || byteLength > 96) {
          throw new TypeError("Invalid code_verifier length");
        }
        const bytes = await this.implementation.getRandomValues(byteLength);
        return base64_1.base64url.baseEncode(bytes);
      }
    };
    exports.Runtime = Runtime;
    function extractJktComponents(jwk) {
      const get = (field) => {
        const value = jwk[field];
        if (typeof value !== "string" || !value) {
          throw new TypeError(`"${field}" Parameter missing or invalid`);
        }
        return value;
      };
      switch (jwk.kty) {
        case "EC":
          return { crv: get("crv"), kty: get("kty"), x: get("x"), y: get("y") };
        case "OKP":
          return { crv: get("crv"), kty: get("kty"), x: get("x") };
        case "RSA":
          return { e: get("e"), kty: get("kty"), n: get("n") };
        case "oct":
          return { k: get("k"), kty: get("kty") };
        default:
          throw new TypeError('"kty" (Key Type) Parameter missing or unsupported');
      }
    }
    function compareAlgos(a, b) {
      if (a === "ES256K")
        return -1;
      if (b === "ES256K")
        return 1;
      for (const prefix of ["ES", "PS", "RS"]) {
        if (a.startsWith(prefix)) {
          if (b.startsWith(prefix)) {
            const aLen = parseInt(a.slice(2, 5));
            const bLen = parseInt(b.slice(2, 5));
            return aLen - bLen;
          }
          return -1;
        } else if (b.startsWith(prefix)) {
          return 1;
        }
      }
      return 0;
    }
  }
});

// node_modules/@atproto/oauth-client/dist/session-getter.js
var require_session_getter = __commonJS({
  "node_modules/@atproto/oauth-client/dist/session-getter.js"(exports) {
    "use strict";
    var __addDisposableResource2 = exports && exports.__addDisposableResource || function(env, value, async) {
      if (value !== null && value !== void 0) {
        if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
        var dispose, inner;
        if (async) {
          if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
          dispose = value[Symbol.asyncDispose];
        }
        if (dispose === void 0) {
          if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
          dispose = value[Symbol.dispose];
          if (async) inner = dispose;
        }
        if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
        if (inner) dispose = function() {
          try {
            inner.call(this);
          } catch (e) {
            return Promise.reject(e);
          }
        };
        env.stack.push({ value, dispose, async });
      } else if (async) {
        env.stack.push({ async: true });
      }
      return value;
    };
    var __disposeResources2 = exports && exports.__disposeResources || /* @__PURE__ */ function(SuppressedError2) {
      return function(env) {
        function fail(e) {
          env.error = env.hasError ? new SuppressedError2(e, env.error, "An error was suppressed during disposal.") : e;
          env.hasError = true;
        }
        var r, s = 0;
        function next() {
          while (r = env.stack.pop()) {
            try {
              if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
              if (r.dispose) {
                var result = r.dispose.call(r.value);
                if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) {
                  fail(e);
                  return next();
                });
              } else s |= 1;
            } catch (e) {
              fail(e);
            }
          }
          if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
          if (env.hasError) throw env.error;
        }
        return next();
      };
    }(typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message2) {
      var e = new Error(message2);
      return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
    });
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.SessionGetter = void 0;
    var simple_store_1 = require_dist17();
    var auth_method_unsatisfiable_error_js_1 = require_auth_method_unsatisfiable_error();
    var token_invalid_error_js_1 = require_token_invalid_error();
    var token_refresh_error_js_1 = require_token_refresh_error();
    var token_revoked_error_js_1 = require_token_revoked_error();
    var oauth_response_error_js_1 = require_oauth_response_error();
    var util_js_1 = require_util18();
    var SessionGetter = class extends simple_store_1.CachedGetter {
      constructor(sessionStore, serverFactory, runtime) {
        super(async (sub, options, storedSession) => {
          if (storedSession === void 0) {
            const msg = "The session was deleted by another process";
            const cause = new token_refresh_error_js_1.TokenRefreshError(sub, msg);
            this.dispatchEvent("deleted", { sub, cause });
            throw cause;
          }
          const { dpopKey, authMethod = "legacy", tokenSet } = storedSession;
          if (sub !== tokenSet.sub) {
            throw new token_refresh_error_js_1.TokenRefreshError(sub, "Stored session sub mismatch");
          }
          if (!tokenSet.refresh_token) {
            throw new token_refresh_error_js_1.TokenRefreshError(sub, "No refresh token available");
          }
          const server = await serverFactory.fromIssuer(tokenSet.iss, authMethod, dpopKey);
          options?.signal?.throwIfAborted();
          try {
            const newTokenSet = await server.refresh(tokenSet);
            if (sub !== newTokenSet.sub) {
              throw new token_refresh_error_js_1.TokenRefreshError(sub, "Token set sub mismatch");
            }
            return {
              dpopKey,
              tokenSet: newTokenSet,
              authMethod: server.authMethod
            };
          } catch (cause) {
            if (cause instanceof oauth_response_error_js_1.OAuthResponseError && cause.status === 400 && cause.error === "invalid_grant") {
              if (!runtime.hasImplementationLock) {
                await new Promise((r) => setTimeout(r, 1e3));
                const stored = await this.getStored(sub);
                if (stored === void 0) {
                  const msg2 = "The session was deleted by another process";
                  throw new token_refresh_error_js_1.TokenRefreshError(sub, msg2, { cause });
                } else if (stored.tokenSet.access_token !== tokenSet.access_token || stored.tokenSet.refresh_token !== tokenSet.refresh_token) {
                  return stored;
                } else {
                }
              }
              const msg = cause.errorDescription ?? "The session was revoked";
              throw new token_refresh_error_js_1.TokenRefreshError(sub, msg, { cause });
            }
            throw cause;
          }
        }, sessionStore, {
          isStale: (sub, { tokenSet }) => {
            return tokenSet.expires_at != null && new Date(tokenSet.expires_at).getTime() < Date.now() + // Add some lee way to ensure the token is not expired when it
            // reaches the server.
            1e4 + // Add some randomness to reduce the chances of multiple
            // instances trying to refresh the token at the same.
            3e4 * Math.random();
          },
          onStoreError: async (err, sub, { tokenSet, dpopKey, authMethod = "legacy" }) => {
            if (!(err instanceof auth_method_unsatisfiable_error_js_1.AuthMethodUnsatisfiableError)) {
              try {
                const server = await serverFactory.fromIssuer(tokenSet.iss, authMethod, dpopKey);
                await server.revoke(tokenSet.refresh_token ?? tokenSet.access_token);
              } catch {
              }
            }
            throw err;
          },
          deleteOnError: async (err) => err instanceof token_refresh_error_js_1.TokenRefreshError || err instanceof token_revoked_error_js_1.TokenRevokedError || err instanceof token_invalid_error_js_1.TokenInvalidError || err instanceof auth_method_unsatisfiable_error_js_1.AuthMethodUnsatisfiableError
        });
        Object.defineProperty(this, "runtime", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: runtime
        });
        Object.defineProperty(this, "eventTarget", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: new util_js_1.CustomEventTarget()
        });
      }
      addEventListener(type, callback, options) {
        this.eventTarget.addEventListener(type, callback, options);
      }
      removeEventListener(type, callback, options) {
        this.eventTarget.removeEventListener(type, callback, options);
      }
      dispatchEvent(type, detail) {
        return this.eventTarget.dispatchCustomEvent(type, detail);
      }
      async setStored(sub, session) {
        if (sub !== session.tokenSet.sub) {
          throw new TypeError("Token set does not match the expected sub");
        }
        await super.setStored(sub, session);
        this.dispatchEvent("updated", { sub, ...session });
      }
      async delStored(sub, cause) {
        await super.delStored(sub, cause);
        this.dispatchEvent("deleted", { sub, cause });
      }
      /**
       * @param refresh When `true`, the credentials will be refreshed even if they
       * are not expired. When `false`, the credentials will not be refreshed even
       * if they are expired. When `undefined`, the credentials will be refreshed
       * if, and only if, they are (about to be) expired. Defaults to `undefined`.
       */
      async getSession(sub, refresh) {
        return this.get(sub, {
          noCache: refresh === true,
          allowStale: refresh === false
        });
      }
      async get(sub, options) {
        const session = await this.runtime.usingLock(`@atproto-oauth-client-${sub}`, async () => {
          const env_1 = { stack: [], error: void 0, hasError: false };
          try {
            const signal = __addDisposableResource2(env_1, (0, util_js_1.timeoutSignal)(3e4, options), false);
            const abortController = __addDisposableResource2(env_1, (0, util_js_1.combineSignals)([options?.signal, signal]), false);
            return await super.get(sub, {
              ...options,
              signal: abortController.signal
            });
          } catch (e_1) {
            env_1.error = e_1;
            env_1.hasError = true;
          } finally {
            __disposeResources2(env_1);
          }
        });
        if (sub !== session.tokenSet.sub) {
          throw new Error("Token set does not match the expected sub");
        }
        return session;
      }
    };
    exports.SessionGetter = SessionGetter;
  }
});

// node_modules/@atproto/oauth-client/dist/types.js
var require_types9 = __commonJS({
  "node_modules/@atproto/oauth-client/dist/types.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.clientMetadataSchema = void 0;
    var zod_1 = require_zod();
    var oauth_types_1 = require_dist22();
    exports.clientMetadataSchema = oauth_types_1.oauthClientMetadataSchema.extend({
      client_id: zod_1.z.union([
        oauth_types_1.oauthClientIdDiscoverableSchema,
        oauth_types_1.oauthClientIdLoopbackSchema
      ])
    });
  }
});

// node_modules/@atproto/oauth-client/dist/validate-client-metadata.js
var require_validate_client_metadata = __commonJS({
  "node_modules/@atproto/oauth-client/dist/validate-client-metadata.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.validateClientMetadata = validateClientMetadata;
    var oauth_types_1 = require_dist22();
    var constants_js_1 = require_constants3();
    var types_js_1 = require_types9();
    function validateClientMetadata(input, keyset) {
      if (!input.jwks && !input.jwks_uri && keyset?.size) {
        input = { ...input, jwks: keyset.toJSON() };
      }
      const metadata = types_js_1.clientMetadataSchema.parse(input);
      if (metadata.client_id.startsWith("http:")) {
        (0, oauth_types_1.assertOAuthLoopbackClientId)(metadata.client_id);
      } else {
        (0, oauth_types_1.assertOAuthDiscoverableClientId)(metadata.client_id);
      }
      const scopes = metadata.scope?.split(" ");
      if (!scopes?.includes("atproto")) {
        throw new TypeError(`Client metadata must include the "atproto" scope`);
      }
      if (!metadata.response_types.includes("code")) {
        throw new TypeError(`"response_types" must include "code"`);
      }
      if (!metadata.grant_types.includes("authorization_code")) {
        throw new TypeError(`"grant_types" must include "authorization_code"`);
      }
      const method = metadata.token_endpoint_auth_method;
      const methodAlg = metadata.token_endpoint_auth_signing_alg;
      switch (method) {
        case "none":
          if (methodAlg) {
            throw new TypeError(`"token_endpoint_auth_signing_alg" must not be provided when "token_endpoint_auth_method" is "${method}"`);
          }
          break;
        case "private_key_jwt": {
          if (!methodAlg) {
            throw new TypeError(`"token_endpoint_auth_signing_alg" must be provided when "token_endpoint_auth_method" is "${method}"`);
          }
          const signingKeys = keyset ? Array.from(keyset.list({ use: "sig" })).filter((key) => key.isPrivate && key.kid) : null;
          if (!signingKeys?.some((key) => key.algorithms.includes(constants_js_1.FALLBACK_ALG))) {
            throw new TypeError(`Client authentication method "${method}" requires at least one "${constants_js_1.FALLBACK_ALG}" signing key with a "kid" property`);
          }
          if (metadata.jwks) {
            for (const key of signingKeys) {
              if (!metadata.jwks.keys.some((k) => k.kid === key.kid)) {
                throw new TypeError(`Key with kid "${key.kid}" not found in jwks`);
              }
            }
          } else if (metadata.jwks_uri) {
          } else {
            throw new TypeError(`Client authentication method "${method}" requires a JWKS`);
          }
          break;
        }
        default:
          throw new TypeError(`Unsupported "token_endpoint_auth_method" value: ${method}`);
      }
      return metadata;
    }
  }
});

// node_modules/@atproto/oauth-client/dist/oauth-client.js
var require_oauth_client = __commonJS({
  "node_modules/@atproto/oauth-client/dist/oauth-client.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.OAuthClient = exports.Keyset = exports.Key = void 0;
    var jwk_1 = require_dist12();
    Object.defineProperty(exports, "Key", { enumerable: true, get: function() {
      return jwk_1.Key;
    } });
    Object.defineProperty(exports, "Keyset", { enumerable: true, get: function() {
      return jwk_1.Keyset;
    } });
    var oauth_types_1 = require_dist22();
    var did_resolver_1 = require_dist20();
    var identity_resolver_1 = require_dist23();
    var simple_store_memory_1 = require_dist16();
    var constants_js_1 = require_constants3();
    var auth_method_unsatisfiable_error_js_1 = require_auth_method_unsatisfiable_error();
    var token_revoked_error_js_1 = require_token_revoked_error();
    var identity_resolver_js_1 = require_identity_resolver2();
    var oauth_authorization_server_metadata_resolver_js_1 = require_oauth_authorization_server_metadata_resolver();
    var oauth_callback_error_js_1 = require_oauth_callback_error();
    var oauth_client_auth_js_1 = require_oauth_client_auth();
    var oauth_protected_resource_metadata_resolver_js_1 = require_oauth_protected_resource_metadata_resolver();
    var oauth_resolver_js_1 = require_oauth_resolver();
    var oauth_server_factory_js_1 = require_oauth_server_factory();
    var oauth_session_js_1 = require_oauth_session();
    var runtime_js_1 = require_runtime();
    var session_getter_js_1 = require_session_getter();
    var util_js_1 = require_util18();
    var validate_client_metadata_js_1 = require_validate_client_metadata();
    var OAuthClient = class extends util_js_1.CustomEventTarget {
      static async fetchMetadata({ clientId, fetch: fetch2 = globalThis.fetch, signal }) {
        signal?.throwIfAborted();
        const request = new Request(clientId, {
          redirect: "error",
          signal
        });
        const response = await fetch2(request);
        if (response.status !== 200) {
          response.body?.cancel?.();
          throw new TypeError(`Failed to fetch client metadata: ${response.status}`);
        }
        const mime = response.headers.get("content-type")?.split(";")[0].trim();
        if (mime !== "application/json") {
          response.body?.cancel?.();
          throw new TypeError(`Invalid client metadata content type: ${mime}`);
        }
        const json = await response.json();
        signal?.throwIfAborted();
        return oauth_types_1.oauthClientMetadataSchema.parse(json);
      }
      constructor(options) {
        const { stateStore, sessionStore, dpopNonceCache = new simple_store_memory_1.SimpleStoreMemory({ ttl: 6e4, max: 100 }), authorizationServerMetadataCache = new simple_store_memory_1.SimpleStoreMemory({
          ttl: 6e4,
          max: 100
        }), protectedResourceMetadataCache = new simple_store_memory_1.SimpleStoreMemory({
          ttl: 6e4,
          max: 100
        }), responseMode, clientMetadata, runtimeImplementation, keyset } = options;
        super();
        Object.defineProperty(this, "clientMetadata", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "responseMode", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "keyset", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "runtime", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "fetch", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "oauthResolver", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "serverFactory", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "sessionGetter", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        Object.defineProperty(this, "stateStore", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        this.keyset = keyset ? keyset instanceof jwk_1.Keyset ? keyset : new jwk_1.Keyset(keyset) : void 0;
        this.clientMetadata = (0, validate_client_metadata_js_1.validateClientMetadata)(clientMetadata, this.keyset);
        this.responseMode = responseMode;
        this.runtime = new runtime_js_1.Runtime(runtimeImplementation);
        this.fetch = options.fetch ?? globalThis.fetch;
        this.oauthResolver = new oauth_resolver_js_1.OAuthResolver((0, identity_resolver_js_1.createIdentityResolver)(options), new oauth_protected_resource_metadata_resolver_js_1.OAuthProtectedResourceMetadataResolver(protectedResourceMetadataCache, this.fetch, { allowHttpResource: options.allowHttp }), new oauth_authorization_server_metadata_resolver_js_1.OAuthAuthorizationServerMetadataResolver(authorizationServerMetadataCache, this.fetch, { allowHttpIssuer: options.allowHttp }));
        this.serverFactory = new oauth_server_factory_js_1.OAuthServerFactory(this.clientMetadata, this.runtime, this.oauthResolver, this.fetch, this.keyset, dpopNonceCache);
        this.sessionGetter = new session_getter_js_1.SessionGetter(sessionStore, this.serverFactory, this.runtime);
        this.stateStore = stateStore;
        for (const type of ["deleted", "updated"]) {
          this.sessionGetter.addEventListener(type, (event) => {
            if (!this.dispatchCustomEvent(type, event.detail)) {
              event.preventDefault();
            }
          });
        }
      }
      // Exposed as public API for convenience
      get identityResolver() {
        return this.oauthResolver.identityResolver;
      }
      get jwks() {
        return this.keyset?.publicJwks ?? { keys: [] };
      }
      async authorize(input, { signal, ...options } = {}) {
        const redirectUri = options?.redirect_uri ?? this.clientMetadata.redirect_uris[0];
        if (!this.clientMetadata.redirect_uris.includes(redirectUri)) {
          throw new TypeError("Invalid redirect_uri");
        }
        const { identityInfo, metadata } = await this.oauthResolver.resolve(input, {
          signal
        });
        const pkce = await this.runtime.generatePKCE();
        const dpopKey = await this.runtime.generateKey(metadata.dpop_signing_alg_values_supported || [constants_js_1.FALLBACK_ALG]);
        const authMethod = (0, oauth_client_auth_js_1.negotiateClientAuthMethod)(metadata, this.clientMetadata, this.keyset);
        const state = await this.runtime.generateNonce();
        await this.stateStore.set(state, {
          iss: metadata.issuer,
          dpopKey,
          authMethod,
          verifier: pkce.verifier,
          appState: options?.state
        });
        const parameters = {
          ...options,
          client_id: this.clientMetadata.client_id,
          redirect_uri: redirectUri,
          code_challenge: pkce.challenge,
          code_challenge_method: pkce.method,
          state,
          login_hint: identityInfo ? identityInfo.handle !== identity_resolver_1.HANDLE_INVALID ? identityInfo.handle : identityInfo.did : void 0,
          response_mode: this.responseMode,
          response_type: "code",
          scope: options?.scope ?? this.clientMetadata.scope
        };
        const authorizationUrl = new URL(metadata.authorization_endpoint);
        if (authorizationUrl.protocol !== "https:" && authorizationUrl.protocol !== "http:") {
          throw new TypeError(`Invalid authorization endpoint protocol: ${authorizationUrl.protocol}`);
        }
        if (metadata.pushed_authorization_request_endpoint) {
          const server = await this.serverFactory.fromMetadata(metadata, authMethod, dpopKey);
          const parResponse = await server.request("pushed_authorization_request", parameters);
          authorizationUrl.searchParams.set("client_id", this.clientMetadata.client_id);
          authorizationUrl.searchParams.set("request_uri", parResponse.request_uri);
          return authorizationUrl;
        } else if (metadata.require_pushed_authorization_requests) {
          throw new Error("Server requires pushed authorization requests (PAR) but no PAR endpoint is available");
        } else {
          for (const [key, value] of Object.entries(parameters)) {
            if (value)
              authorizationUrl.searchParams.set(key, String(value));
          }
          const urlLength = authorizationUrl.pathname.length + authorizationUrl.search.length;
          if (urlLength < 2048) {
            return authorizationUrl;
          } else if (!metadata.pushed_authorization_request_endpoint) {
            throw new Error("Login URL too long");
          }
        }
        throw new Error("Server does not support pushed authorization requests (PAR)");
      }
      /**
       * This method allows the client to proactively revoke the request_uri it
       * created through PAR.
       */
      async abortRequest(authorizeUrl) {
        const requestUri = authorizeUrl.searchParams.get("request_uri");
        if (!requestUri)
          return;
      }
      async callback(params, options = {}) {
        const responseJwt = params.get("response");
        if (responseJwt != null) {
          throw new oauth_callback_error_js_1.OAuthCallbackError(params, "JARM not supported");
        }
        const issuerParam = params.get("iss");
        const stateParam = params.get("state");
        const errorParam = params.get("error");
        const codeParam = params.get("code");
        if (!stateParam) {
          throw new oauth_callback_error_js_1.OAuthCallbackError(params, 'Missing "state" parameter');
        }
        const stateData = await this.stateStore.get(stateParam);
        if (stateData) {
          await this.stateStore.del(stateParam);
        } else {
          throw new oauth_callback_error_js_1.OAuthCallbackError(params, `Unknown authorization session "${stateParam}"`);
        }
        try {
          if (errorParam != null) {
            throw new oauth_callback_error_js_1.OAuthCallbackError(params, void 0, stateData.appState);
          }
          if (!codeParam) {
            throw new oauth_callback_error_js_1.OAuthCallbackError(params, 'Missing "code" query param', stateData.appState);
          }
          const server = await this.serverFactory.fromIssuer(
            stateData.iss,
            // Using the literal 'legacy' if the authMethod is not defined (because stateData was created through an old version of this lib)
            stateData.authMethod ?? "legacy",
            stateData.dpopKey
          );
          if (issuerParam != null) {
            if (!server.issuer) {
              throw new oauth_callback_error_js_1.OAuthCallbackError(params, "Issuer not found in metadata", stateData.appState);
            }
            if (server.issuer !== issuerParam) {
              throw new oauth_callback_error_js_1.OAuthCallbackError(params, "Issuer mismatch", stateData.appState);
            }
          } else if (server.serverMetadata.authorization_response_iss_parameter_supported) {
            throw new oauth_callback_error_js_1.OAuthCallbackError(params, "iss missing from the response", stateData.appState);
          }
          const tokenSet = await server.exchangeCode(codeParam, stateData.verifier, options?.redirect_uri ?? server.clientMetadata.redirect_uris[0]);
          try {
            await this.sessionGetter.setStored(tokenSet.sub, {
              dpopKey: stateData.dpopKey,
              authMethod: server.authMethod,
              tokenSet
            });
            const session = this.createSession(server, tokenSet.sub);
            return { session, state: stateData.appState ?? null };
          } catch (err) {
            await server.revoke(tokenSet.refresh_token || tokenSet.access_token);
            throw err;
          }
        } catch (err) {
          throw oauth_callback_error_js_1.OAuthCallbackError.from(err, params, stateData.appState);
        }
      }
      /**
       * Load a stored session. This will refresh the token only if needed (about to
       * expire) by default.
       *
       * @param refresh See {@link SessionGetter.getSession}
       */
      async restore(sub, refresh = "auto") {
        (0, did_resolver_1.assertAtprotoDid)(sub);
        const { dpopKey, authMethod = "legacy", tokenSet } = await this.sessionGetter.get(sub, {
          noCache: refresh === true,
          allowStale: refresh === false
        });
        try {
          const server = await this.serverFactory.fromIssuer(tokenSet.iss, authMethod, dpopKey, {
            noCache: refresh === true,
            allowStale: refresh === false
          });
          return this.createSession(server, sub);
        } catch (err) {
          if (err instanceof auth_method_unsatisfiable_error_js_1.AuthMethodUnsatisfiableError) {
            await this.sessionGetter.delStored(sub, err);
          }
          throw err;
        }
      }
      async revoke(sub) {
        (0, did_resolver_1.assertAtprotoDid)(sub);
        const { dpopKey, authMethod = "legacy", tokenSet } = await this.sessionGetter.get(sub, {
          allowStale: true
        });
        try {
          const server = await this.serverFactory.fromIssuer(tokenSet.iss, authMethod, dpopKey);
          await server.revoke(tokenSet.access_token);
        } finally {
          await this.sessionGetter.delStored(sub, new token_revoked_error_js_1.TokenRevokedError(sub));
        }
      }
      createSession(server, sub) {
        return new oauth_session_js_1.OAuthSession(server, sub, this.sessionGetter, this.fetch);
      }
    };
    exports.OAuthClient = OAuthClient;
  }
});

// node_modules/@atproto/oauth-client/dist/runtime-implementation.js
var require_runtime_implementation = __commonJS({
  "node_modules/@atproto/oauth-client/dist/runtime-implementation.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/@atproto/oauth-client/dist/state-store.js
var require_state_store = __commonJS({
  "node_modules/@atproto/oauth-client/dist/state-store.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
  }
});

// node_modules/@atproto/oauth-client/dist/index.js
var require_dist24 = __commonJS({
  "node_modules/@atproto/oauth-client/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.FetchResponseError = exports.FetchRequestError = exports.FetchError = void 0;
    __exportStar2(require_dist20(), exports);
    var fetch_1 = require_dist19();
    Object.defineProperty(exports, "FetchError", { enumerable: true, get: function() {
      return fetch_1.FetchError;
    } });
    Object.defineProperty(exports, "FetchRequestError", { enumerable: true, get: function() {
      return fetch_1.FetchRequestError;
    } });
    Object.defineProperty(exports, "FetchResponseError", { enumerable: true, get: function() {
      return fetch_1.FetchResponseError;
    } });
    __exportStar2(require_dist21(), exports);
    __exportStar2(require_dist15(), exports);
    __exportStar2(require_dist12(), exports);
    __exportStar2(require_dist22(), exports);
    __exportStar2(require_lock(), exports);
    __exportStar2(require_oauth_authorization_server_metadata_resolver(), exports);
    __exportStar2(require_oauth_callback_error(), exports);
    __exportStar2(require_oauth_client(), exports);
    __exportStar2(require_oauth_protected_resource_metadata_resolver(), exports);
    __exportStar2(require_oauth_resolver_error(), exports);
    __exportStar2(require_oauth_response_error(), exports);
    __exportStar2(require_oauth_server_agent(), exports);
    __exportStar2(require_oauth_server_factory(), exports);
    __exportStar2(require_oauth_session(), exports);
    __exportStar2(require_runtime_implementation(), exports);
    __exportStar2(require_session_getter(), exports);
    __exportStar2(require_state_store(), exports);
    __exportStar2(require_types9(), exports);
    __exportStar2(require_token_invalid_error(), exports);
    __exportStar2(require_token_refresh_error(), exports);
    __exportStar2(require_token_revoked_error(), exports);
  }
});

// node_modules/@atproto/oauth-client-browser/dist/indexed-db/util.js
var require_util20 = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/indexed-db/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.handleRequest = handleRequest;
    exports.promisify = promisify;
    function handleRequest(request, onSuccess, onError) {
      const cleanup = () => {
        request.removeEventListener("success", success);
        request.removeEventListener("error", error);
      };
      const success = () => {
        onSuccess(request.result);
        cleanup();
      };
      const error = () => {
        onError(request.error || new Error("Unknown error"));
        cleanup();
      };
      request.addEventListener("success", success);
      request.addEventListener("error", error);
    }
    function promisify(request) {
      return new Promise((resolve, reject) => {
        handleRequest(request, resolve, reject);
      });
    }
  }
});

// node_modules/@atproto/oauth-client-browser/dist/indexed-db/db-index.js
var require_db_index = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/indexed-db/db-index.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DBIndex = void 0;
    var util_js_1 = require_util20();
    var DBIndex = class {
      constructor(idbIndex) {
        Object.defineProperty(this, "idbIndex", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: idbIndex
        });
      }
      count(query) {
        return (0, util_js_1.promisify)(this.idbIndex.count(query));
      }
      get(query) {
        return (0, util_js_1.promisify)(this.idbIndex.get(query));
      }
      getKey(query) {
        return (0, util_js_1.promisify)(this.idbIndex.getKey(query));
      }
      getAll(query, count) {
        return (0, util_js_1.promisify)(this.idbIndex.getAll(query, count));
      }
      getAllKeys(query, count) {
        return (0, util_js_1.promisify)(this.idbIndex.getAllKeys(query, count));
      }
      deleteAll(query) {
        return new Promise((resolve, reject) => {
          const result = this.idbIndex.openCursor(query);
          result.onsuccess = function(event) {
            const cursor = event.target.result;
            if (cursor) {
              cursor.delete();
              cursor.continue();
            } else {
              resolve();
            }
          };
          result.onerror = function(event) {
            reject(event.target?.error || new Error("Unexpected error"));
          };
        });
      }
    };
    exports.DBIndex = DBIndex;
  }
});

// node_modules/@atproto/oauth-client-browser/dist/indexed-db/db-object-store.js
var require_db_object_store = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/indexed-db/db-object-store.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DBObjectStore = void 0;
    var db_index_js_1 = require_db_index();
    var util_js_1 = require_util20();
    var DBObjectStore = class {
      constructor(idbObjStore) {
        Object.defineProperty(this, "idbObjStore", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: idbObjStore
        });
      }
      get name() {
        return this.idbObjStore.name;
      }
      index(name2) {
        return new db_index_js_1.DBIndex(this.idbObjStore.index(name2));
      }
      get(key) {
        return (0, util_js_1.promisify)(this.idbObjStore.get(key));
      }
      getKey(query) {
        return (0, util_js_1.promisify)(this.idbObjStore.getKey(query));
      }
      getAll(query, count) {
        return (0, util_js_1.promisify)(this.idbObjStore.getAll(query, count));
      }
      getAllKeys(query, count) {
        return (0, util_js_1.promisify)(this.idbObjStore.getAllKeys(query, count));
      }
      add(value, key) {
        return (0, util_js_1.promisify)(this.idbObjStore.add(value, key));
      }
      put(value, key) {
        return (0, util_js_1.promisify)(this.idbObjStore.put(value, key));
      }
      delete(key) {
        return (0, util_js_1.promisify)(this.idbObjStore.delete(key));
      }
      clear() {
        return (0, util_js_1.promisify)(this.idbObjStore.clear());
      }
    };
    exports.DBObjectStore = DBObjectStore;
  }
});

// node_modules/@atproto/oauth-client-browser/dist/indexed-db/db-transaction.js
var require_db_transaction = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/indexed-db/db-transaction.js"(exports) {
    "use strict";
    var __classPrivateFieldSet2 = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
      if (kind === "m") throw new TypeError("Private method is not writable");
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
      return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
    };
    var __classPrivateFieldGet2 = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
      return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
    };
    var _DBTransaction_tx;
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DBTransaction = void 0;
    var db_object_store_js_1 = require_db_object_store();
    var DBTransaction = class {
      constructor(tx) {
        _DBTransaction_tx.set(this, void 0);
        __classPrivateFieldSet2(this, _DBTransaction_tx, tx, "f");
        const onAbort = () => {
          cleanup();
        };
        const onComplete = () => {
          cleanup();
        };
        const cleanup = () => {
          __classPrivateFieldSet2(this, _DBTransaction_tx, null, "f");
          tx.removeEventListener("abort", onAbort);
          tx.removeEventListener("complete", onComplete);
        };
        tx.addEventListener("abort", onAbort);
        tx.addEventListener("complete", onComplete);
      }
      get tx() {
        if (!__classPrivateFieldGet2(this, _DBTransaction_tx, "f"))
          throw new Error("Transaction already ended");
        return __classPrivateFieldGet2(this, _DBTransaction_tx, "f");
      }
      async abort() {
        const { tx } = this;
        __classPrivateFieldSet2(this, _DBTransaction_tx, null, "f");
        tx.abort();
      }
      async commit() {
        const { tx } = this;
        __classPrivateFieldSet2(this, _DBTransaction_tx, null, "f");
        tx.commit?.();
      }
      objectStore(name2) {
        const store = this.tx.objectStore(name2);
        return new db_object_store_js_1.DBObjectStore(store);
      }
      [(_DBTransaction_tx = /* @__PURE__ */ new WeakMap(), Symbol.dispose)]() {
        if (__classPrivateFieldGet2(this, _DBTransaction_tx, "f"))
          this.commit();
      }
    };
    exports.DBTransaction = DBTransaction;
  }
});

// node_modules/@atproto/oauth-client-browser/dist/indexed-db/db.js
var require_db = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/indexed-db/db.js"(exports) {
    "use strict";
    var __classPrivateFieldSet2 = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
      if (kind === "m") throw new TypeError("Private method is not writable");
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
      return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
    };
    var __classPrivateFieldGet2 = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
      return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
    };
    var _DB_db;
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.DB = void 0;
    var db_transaction_js_1 = require_db_transaction();
    var DB = class _DB {
      static async open(dbName, migrations, txOptions) {
        const db = await new Promise((resolve, reject) => {
          const request = indexedDB.open(dbName, migrations.length);
          request.onerror = () => reject(request.error);
          request.onsuccess = () => resolve(request.result);
          request.onupgradeneeded = ({ oldVersion, newVersion }) => {
            const db2 = request.result;
            try {
              for (let version2 = oldVersion; version2 < (newVersion ?? migrations.length); ++version2) {
                const migration = migrations[version2];
                if (migration)
                  migration(db2);
                else
                  throw new Error(`Missing migration for version ${version2}`);
              }
            } catch (err) {
              db2.close();
              reject(err);
            }
          };
        });
        return new _DB(db, txOptions);
      }
      constructor(db, txOptions) {
        Object.defineProperty(this, "txOptions", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: txOptions
        });
        _DB_db.set(this, void 0);
        __classPrivateFieldSet2(this, _DB_db, db, "f");
        const cleanup = () => {
          __classPrivateFieldSet2(this, _DB_db, null, "f");
          db.removeEventListener("versionchange", cleanup);
          db.removeEventListener("close", cleanup);
          db.close();
        };
        db.addEventListener("versionchange", cleanup);
        db.addEventListener("close", cleanup);
      }
      get db() {
        if (!__classPrivateFieldGet2(this, _DB_db, "f"))
          throw new Error("Database closed");
        return __classPrivateFieldGet2(this, _DB_db, "f");
      }
      get name() {
        return this.db.name;
      }
      get objectStoreNames() {
        return this.db.objectStoreNames;
      }
      get version() {
        return this.db.version;
      }
      async transaction(storeNames, mode, run) {
        return new Promise(async (resolve, reject) => {
          try {
            const tx = this.db.transaction(storeNames, mode, this.txOptions);
            let result = { done: false };
            tx.oncomplete = () => {
              if (result.done)
                resolve(result.value);
              else
                reject(new Error("Transaction completed without result"));
            };
            tx.onerror = () => reject(tx.error);
            tx.onabort = () => reject(tx.error || new Error("Transaction aborted"));
            try {
              const value = await run(new db_transaction_js_1.DBTransaction(tx));
              result = { done: true, value };
              tx.commit();
            } catch (err) {
              tx.abort();
              throw err;
            }
          } catch (err) {
            reject(err);
          }
        });
      }
      close() {
        const { db } = this;
        __classPrivateFieldSet2(this, _DB_db, null, "f");
        db.close();
      }
      [(_DB_db = /* @__PURE__ */ new WeakMap(), Symbol.dispose)]() {
        if (__classPrivateFieldGet2(this, _DB_db, "f"))
          return this.close();
      }
    };
    exports.DB = DB;
  }
});

// node_modules/@atproto/oauth-client-browser/dist/indexed-db/index.js
var require_indexed_db = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/indexed-db/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    require_disposable_polyfill();
    __exportStar2(require_db(), exports);
    __exportStar2(require_db_index(), exports);
    __exportStar2(require_db_object_store(), exports);
    __exportStar2(require_db_transaction(), exports);
  }
});

// node_modules/@atproto/oauth-client-browser/dist/browser-oauth-database.js
var require_browser_oauth_database = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/browser-oauth-database.js"(exports) {
    "use strict";
    var __classPrivateFieldSet2 = exports && exports.__classPrivateFieldSet || function(receiver, state, value, kind, f) {
      if (kind === "m") throw new TypeError("Private method is not writable");
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
      return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
    };
    var __classPrivateFieldGet2 = exports && exports.__classPrivateFieldGet || function(receiver, state, kind, f) {
      if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
      if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
      return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
    };
    var _BrowserOAuthDatabase_dbPromise;
    var _BrowserOAuthDatabase_cleanupInterval;
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BrowserOAuthDatabase = void 0;
    var jwk_webcrypto_1 = require_dist14();
    var index_js_1 = require_indexed_db();
    function encodeKey(key) {
      if (!(key instanceof jwk_webcrypto_1.WebcryptoKey) || !key.kid) {
        throw new Error("Invalid key object");
      }
      return {
        keyId: key.kid,
        keyPair: key.cryptoKeyPair
      };
    }
    async function decodeKey(encoded) {
      return jwk_webcrypto_1.WebcryptoKey.fromKeypair(encoded.keyPair, encoded.keyId);
    }
    var STORES = [
      "state",
      "session",
      "didCache",
      "dpopNonceCache",
      "handleCache",
      "authorizationServerMetadataCache",
      "protectedResourceMetadataCache"
    ];
    var BrowserOAuthDatabase = class {
      constructor(options) {
        _BrowserOAuthDatabase_dbPromise.set(this, void 0);
        _BrowserOAuthDatabase_cleanupInterval.set(this, void 0);
        __classPrivateFieldSet2(this, _BrowserOAuthDatabase_dbPromise, index_js_1.DB.open(options?.name ?? "@atproto-oauth-client", [
          (db) => {
            for (const name2 of STORES) {
              const store = db.createObjectStore(name2, { autoIncrement: true });
              store.createIndex("expiresAt", "expiresAt", { unique: false });
            }
          }
        ], { durability: options?.durability ?? "strict" }), "f");
        __classPrivateFieldSet2(this, _BrowserOAuthDatabase_cleanupInterval, setInterval(() => {
          void this.cleanup();
        }, options?.cleanupInterval ?? 3e4), "f");
      }
      async run(storeName, mode, fn) {
        const db = await __classPrivateFieldGet2(this, _BrowserOAuthDatabase_dbPromise, "f");
        return await db.transaction([storeName], mode, (tx) => fn(tx.objectStore(storeName)));
      }
      createStore(name2, { encode: encode7, decode: decode8, expiresAt }) {
        return {
          get: async (key) => {
            const item = await this.run(name2, "readonly", (store) => store.get(key));
            if (item === void 0)
              return void 0;
            if (item.expiresAt != null && new Date(item.expiresAt) < /* @__PURE__ */ new Date()) {
              await this.run(name2, "readwrite", (store) => store.delete(key));
              return void 0;
            }
            return decode8(item.value);
          },
          set: async (key, value) => {
            const item = {
              value: await encode7(value),
              expiresAt: expiresAt(value)?.toISOString()
            };
            await this.run(name2, "readwrite", (store) => store.put(item, key));
          },
          del: async (key) => {
            await this.run(name2, "readwrite", (store) => store.delete(key));
          }
        };
      }
      getSessionStore() {
        return this.createStore("session", {
          expiresAt: ({ tokenSet }) => tokenSet.refresh_token || tokenSet.expires_at == null ? null : new Date(tokenSet.expires_at),
          encode: ({ dpopKey, ...session }) => ({
            ...session,
            dpopKey: encodeKey(dpopKey)
          }),
          decode: async ({ dpopKey, ...encoded }) => ({
            ...encoded,
            dpopKey: await decodeKey(dpopKey)
          })
        });
      }
      getStateStore() {
        return this.createStore("state", {
          expiresAt: (_value) => new Date(Date.now() + 10 * 6e4),
          encode: ({ dpopKey, ...session }) => ({
            ...session,
            dpopKey: encodeKey(dpopKey)
          }),
          decode: async ({ dpopKey, ...encoded }) => ({
            ...encoded,
            dpopKey: await decodeKey(dpopKey)
          })
        });
      }
      getDpopNonceCache() {
        return this.createStore("dpopNonceCache", {
          expiresAt: (_value) => new Date(Date.now() + 6e5),
          encode: (value) => value,
          decode: (encoded) => encoded
        });
      }
      getDidCache() {
        return this.createStore("didCache", {
          expiresAt: (_value) => new Date(Date.now() + 6e4),
          encode: (value) => value,
          decode: (encoded) => encoded
        });
      }
      getHandleCache() {
        return this.createStore("handleCache", {
          expiresAt: (_value) => new Date(Date.now() + 6e4),
          encode: (value) => value,
          decode: (encoded) => encoded
        });
      }
      getAuthorizationServerMetadataCache() {
        return this.createStore("authorizationServerMetadataCache", {
          expiresAt: (_value) => new Date(Date.now() + 6e4),
          encode: (value) => value,
          decode: (encoded) => encoded
        });
      }
      getProtectedResourceMetadataCache() {
        return this.createStore("protectedResourceMetadataCache", {
          expiresAt: (_value) => new Date(Date.now() + 6e4),
          encode: (value) => value,
          decode: (encoded) => encoded
        });
      }
      async cleanup() {
        const db = await __classPrivateFieldGet2(this, _BrowserOAuthDatabase_dbPromise, "f");
        for (const name2 of STORES) {
          await db.transaction([name2], "readwrite", (tx) => tx.objectStore(name2).index("expiresAt").deleteAll(IDBKeyRange.upperBound(Date.now())));
        }
      }
      async [(_BrowserOAuthDatabase_dbPromise = /* @__PURE__ */ new WeakMap(), _BrowserOAuthDatabase_cleanupInterval = /* @__PURE__ */ new WeakMap(), Symbol.asyncDispose)]() {
        clearInterval(__classPrivateFieldGet2(this, _BrowserOAuthDatabase_cleanupInterval, "f"));
        __classPrivateFieldSet2(this, _BrowserOAuthDatabase_cleanupInterval, void 0, "f");
        const dbPromise = __classPrivateFieldGet2(this, _BrowserOAuthDatabase_dbPromise, "f");
        __classPrivateFieldSet2(this, _BrowserOAuthDatabase_dbPromise, Promise.reject(new Error("Database has been disposed")), "f");
        __classPrivateFieldGet2(this, _BrowserOAuthDatabase_dbPromise, "f").catch(() => null);
        const db = await dbPromise.catch(() => null);
        if (db)
          await (db[Symbol.asyncDispose] || db[Symbol.dispose]).call(db);
      }
    };
    exports.BrowserOAuthDatabase = BrowserOAuthDatabase;
  }
});

// node_modules/@atproto/oauth-client-browser/dist/browser-runtime-implementation.js
var require_browser_runtime_implementation = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/browser-runtime-implementation.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BrowserRuntimeImplementation = void 0;
    var jwk_webcrypto_1 = require_dist14();
    var nativeRequestLock = navigator.locks?.request ? (name2, fn) => navigator.locks.request(name2, { mode: "exclusive" }, async () => fn()) : void 0;
    var BrowserRuntimeImplementation = class {
      constructor() {
        Object.defineProperty(this, "requestLock", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: nativeRequestLock
        });
        if (typeof crypto !== "object" || !crypto?.subtle) {
          throw new Error("Crypto with CryptoSubtle is required. If running in a browser, make sure the current page is loaded over HTTPS.");
        }
        if (!this.requestLock) {
          console.warn("Locks API not available. You should consider using a more recent browser.");
        }
      }
      async createKey(algs) {
        return jwk_webcrypto_1.WebcryptoKey.generate(algs);
      }
      getRandomValues(byteLength) {
        return crypto.getRandomValues(new Uint8Array(byteLength));
      }
      async digest(data, { name: name2 }) {
        switch (name2) {
          case "sha256":
          case "sha384":
          case "sha512": {
            const buf = await crypto.subtle.digest(`SHA-${name2.slice(3)}`, data);
            return new Uint8Array(buf);
          }
          default:
            throw new Error(`Unsupported digest algorithm: ${name2}`);
        }
      }
    };
    exports.BrowserRuntimeImplementation = BrowserRuntimeImplementation;
  }
});

// node_modules/@atproto/oauth-client-browser/dist/errors.js
var require_errors3 = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/errors.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.LoginContinuedInParentWindowError = void 0;
    var LoginContinuedInParentWindowError = class extends Error {
      constructor() {
        super("Login complete, please close the popup window.");
        Object.defineProperty(this, "code", {
          enumerable: true,
          configurable: true,
          writable: true,
          value: "LOGIN_CONTINUED_IN_PARENT_WINDOW"
        });
      }
    };
    exports.LoginContinuedInParentWindowError = LoginContinuedInParentWindowError;
  }
});

// node_modules/@atproto/oauth-client-browser/dist/util.js
var require_util21 = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/util.js"(exports) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.buildLoopbackClientId = buildLoopbackClientId;
    var oauth_types_1 = require_dist22();
    function buildLoopbackClientId(location2, localhost = "127.0.0.1") {
      if (!(0, oauth_types_1.isLoopbackHost)(location2.hostname)) {
        throw new TypeError(`Expected a loopback host, got ${location2.hostname}`);
      }
      const redirectUri = `http://${location2.hostname === "localhost" ? localhost : location2.hostname}${location2.port && !location2.port.startsWith(":") ? `:${location2.port}` : location2.port}${location2.pathname}`;
      return `http://localhost${location2.pathname === "/" ? "" : location2.pathname}?redirect_uri=${encodeURIComponent(redirectUri)}`;
    }
  }
});

// node_modules/@atproto/oauth-client-browser/dist/browser-oauth-client.js
var require_browser_oauth_client = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/browser-oauth-client.js"(exports) {
    "use strict";
    var _a;
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.BrowserOAuthClient = void 0;
    var oauth_client_1 = require_dist24();
    var oauth_types_1 = require_dist22();
    var browser_oauth_database_js_1 = require_browser_oauth_database();
    var browser_runtime_implementation_js_1 = require_browser_runtime_implementation();
    var errors_js_1 = require_errors3();
    var util_js_1 = require_util21();
    var NAMESPACE = `@@atproto/oauth-client-browser`;
    var POPUP_CHANNEL_NAME = `${NAMESPACE}(popup-channel)`;
    var POPUP_STATE_PREFIX = `${NAMESPACE}(popup-state):`;
    var syncChannel = new BroadcastChannel(`${NAMESPACE}(synchronization-channel)`);
    var BrowserOAuthClient2 = class _BrowserOAuthClient extends oauth_client_1.OAuthClient {
      static async load({ clientId, ...options }) {
        if (clientId.startsWith("http:")) {
          const clientMetadata = (0, oauth_types_1.atprotoLoopbackClientMetadata)(clientId);
          return new _BrowserOAuthClient({ clientMetadata, ...options });
        } else if (clientId.startsWith("https:")) {
          (0, oauth_types_1.assertOAuthDiscoverableClientId)(clientId);
          const clientMetadata = await oauth_client_1.OAuthClient.fetchMetadata({
            clientId,
            ...options
          });
          return new _BrowserOAuthClient({ clientMetadata, ...options });
        } else {
          throw new TypeError(`Invalid client id: ${clientId}`);
        }
      }
      constructor({
        clientMetadata = (0, oauth_types_1.atprotoLoopbackClientMetadata)((0, util_js_1.buildLoopbackClientId)(window.location)),
        // "fragment" is a safer default as the query params will not be sent to the server
        responseMode = "fragment",
        ...options
      }) {
        if (!globalThis.crypto?.subtle) {
          throw new Error("WebCrypto API is required");
        }
        if (!["query", "fragment"].includes(responseMode)) {
          throw new TypeError(`Invalid response mode: ${responseMode}`);
        }
        const database = new browser_oauth_database_js_1.BrowserOAuthDatabase();
        super({
          ...options,
          clientMetadata,
          responseMode,
          keyset: void 0,
          runtimeImplementation: new browser_runtime_implementation_js_1.BrowserRuntimeImplementation(),
          sessionStore: database.getSessionStore(),
          stateStore: database.getStateStore(),
          didCache: database.getDidCache(),
          handleCache: database.getHandleCache(),
          dpopNonceCache: database.getDpopNonceCache(),
          authorizationServerMetadataCache: database.getAuthorizationServerMetadataCache(),
          protectedResourceMetadataCache: database.getProtectedResourceMetadataCache()
        });
        Object.defineProperty(this, _a, {
          enumerable: true,
          configurable: true,
          writable: true,
          value: void 0
        });
        const ac = new AbortController();
        const { signal } = ac;
        this[Symbol.dispose] = () => ac.abort();
        signal.addEventListener("abort", () => database[Symbol.asyncDispose](), {
          once: true
        });
        this.addEventListener("deleted", ({ detail: { sub } }) => {
          if (localStorage.getItem(`${NAMESPACE}(sub)`) === sub) {
            localStorage.removeItem(`${NAMESPACE}(sub)`);
          }
        });
        for (const type of ["deleted", "updated"]) {
          this.sessionGetter.addEventListener(type, ({ detail }) => {
            syncChannel.postMessage([type, detail]);
          });
        }
        syncChannel.addEventListener(
          "message",
          (event) => {
            if (event.source !== window) {
              const [type, detail] = event.data;
              this.dispatchCustomEvent(type, detail);
            }
          },
          // Remove the listener when the client is disposed
          { signal }
        );
      }
      /**
       * This method will automatically restore any existing session, or attempt to
       * process login callback if the URL contains oauth parameters.
       *
       * Use {@link BrowserOAuthClient.initCallback} instead of this method if you
       * want to force a login callback. This can be esp. useful if you are using
       * this lib from a framework that has some kind of URL manipulation (like a
       * client side router).
       *
       * Use {@link BrowserOAuthClient.initRestore} instead of this method if you
       * want to only restore existing sessions, and bypass the automatic processing
       * of login callbacks.
       */
      async init(refresh) {
        const params = this.readCallbackParams();
        if (params)
          return this.initCallback(params);
        return this.initRestore(refresh);
      }
      async initRestore(refresh) {
        await fixLocation(this.clientMetadata);
        const sub = localStorage.getItem(`${NAMESPACE}(sub)`);
        if (sub) {
          try {
            const session = await this.restore(sub, refresh);
            return { session };
          } catch (err) {
            localStorage.removeItem(`${NAMESPACE}(sub)`);
            throw err;
          }
        }
      }
      async restore(sub, refresh) {
        const session = await super.restore(sub, refresh);
        localStorage.setItem(`${NAMESPACE}(sub)`, session.sub);
        return session;
      }
      async revoke(sub) {
        localStorage.removeItem(`${NAMESPACE}(sub)`);
        return super.revoke(sub);
      }
      async signIn(input, options) {
        if (options?.display === "popup") {
          return this.signInPopup(input, options);
        } else {
          return this.signInRedirect(input, options);
        }
      }
      async signInRedirect(input, options) {
        const url = await this.authorize(input, options);
        window.location.href = url.href;
        return new Promise((resolve, reject) => {
          setTimeout((err) => {
            this.abortRequest(url).then(() => reject(err), (reason) => reject(new AggregateError([err, reason])));
          }, 5e3, new Error("User navigated back"));
        });
      }
      async signInPopup(input, options) {
        const popupFeatures = "width=600,height=600,menubar=no,toolbar=no";
        let popup = window.open("about:blank", "_blank", popupFeatures);
        const stateKey = `${Math.random().toString(36).slice(2)}`;
        const url = await this.authorize(input, {
          ...options,
          state: `${POPUP_STATE_PREFIX}${stateKey}`,
          display: options?.display ?? "popup"
        });
        options?.signal?.throwIfAborted();
        if (popup) {
          popup.window.location.href = url.href;
        } else {
          popup = window.open(url.href, "_blank", popupFeatures);
        }
        popup?.focus();
        return new Promise((resolve, reject) => {
          const popupChannel = new BroadcastChannel(POPUP_CHANNEL_NAME);
          const cleanup = () => {
            clearTimeout(timeout);
            popupChannel.removeEventListener("message", onMessage);
            popupChannel.close();
            options?.signal?.removeEventListener("abort", cancel);
            popup?.close();
          };
          const cancel = () => {
            reject(new Error(options?.signal?.aborted ? "Aborted" : "Timeout"));
            cleanup();
          };
          options?.signal?.addEventListener("abort", cancel);
          const timeout = setTimeout(cancel, 5 * 6e4);
          const onMessage = async ({ data }) => {
            if (data.key !== stateKey)
              return;
            if (!("result" in data))
              return;
            popupChannel.postMessage({ key: stateKey, ack: true });
            cleanup();
            const { result } = data;
            if (result.status === "fulfilled") {
              const sub = result.value;
              try {
                options?.signal?.throwIfAborted();
                resolve(await this.restore(sub, false));
              } catch (err) {
                reject(err);
                void this.revoke(sub);
              }
            } else {
              const { message: message2, params } = result.reason;
              reject(new oauth_client_1.OAuthCallbackError(new URLSearchParams(params), message2));
            }
          };
          popupChannel.addEventListener("message", onMessage);
        });
      }
      findRedirectUrl() {
        for (const uri of this.clientMetadata.redirect_uris) {
          const url = new URL(uri);
          if (location.origin === url.origin && location.pathname === url.pathname) {
            return uri;
          }
        }
        return void 0;
      }
      readCallbackParams() {
        const params = this.responseMode === "fragment" ? new URLSearchParams(location.hash.slice(1)) : new URLSearchParams(location.search);
        if (!params.has("state") || !(params.has("code") || params.has("error"))) {
          return null;
        }
        return params;
      }
      async initCallback(params, redirectUri = this.findRedirectUrl()) {
        if (this.responseMode === "fragment") {
          history.replaceState(null, "", location.pathname + location.search);
        } else if (this.responseMode === "query") {
          history.replaceState(null, "", location.pathname);
        }
        const sendPopupResult = (message2) => {
          const popupChannel = new BroadcastChannel(POPUP_CHANNEL_NAME);
          return new Promise((resolve) => {
            const cleanup = (result) => {
              clearTimeout(timer);
              popupChannel.removeEventListener("message", onMessage);
              popupChannel.close();
              resolve(result);
            };
            const onMessage = ({ data }) => {
              if ("ack" in data && message2.key === data.key)
                cleanup(true);
            };
            popupChannel.addEventListener("message", onMessage);
            popupChannel.postMessage(message2);
            const timer = setTimeout(cleanup, 500, false);
          });
        };
        return this.callback(params, { redirect_uri: redirectUri }).then(async (result) => {
          if (result.state?.startsWith(POPUP_STATE_PREFIX)) {
            const receivedByParent = await sendPopupResult({
              key: result.state.slice(POPUP_STATE_PREFIX.length),
              result: {
                status: "fulfilled",
                value: result.session.sub
              }
            });
            if (!receivedByParent)
              await result.session.signOut();
            throw new errors_js_1.LoginContinuedInParentWindowError();
          }
          localStorage.setItem(`${NAMESPACE}(sub)`, result.session.sub);
          return result;
        }).catch(async (err) => {
          if (err instanceof oauth_client_1.OAuthCallbackError && err.state?.startsWith(POPUP_STATE_PREFIX)) {
            await sendPopupResult({
              key: err.state.slice(POPUP_STATE_PREFIX.length),
              result: {
                status: "rejected",
                reason: {
                  message: err.message,
                  params: Array.from(err.params.entries())
                }
              }
            });
            throw new errors_js_1.LoginContinuedInParentWindowError();
          }
          throw err;
        }).catch((err) => {
          if (err instanceof errors_js_1.LoginContinuedInParentWindowError) {
            window.close();
          }
          throw err;
        });
      }
      dispose() {
        this[Symbol.dispose]();
      }
    };
    exports.BrowserOAuthClient = BrowserOAuthClient2;
    _a = Symbol.dispose;
    function fixLocation(clientMetadata) {
      if (!(0, oauth_types_1.isOAuthClientIdLoopback)(clientMetadata.client_id))
        return;
      if (window.location.hostname !== "localhost")
        return;
      const locationUrl = new URL(window.location.href);
      for (const uri of clientMetadata.redirect_uris) {
        const url = new URL(uri);
        if ((url.hostname === "127.0.0.1" || url.hostname === "[::1]") && (!url.port || url.port === locationUrl.port) && url.protocol === locationUrl.protocol && url.pathname === locationUrl.pathname) {
          url.port = locationUrl.port;
          window.location.href = url.href;
          throw new Error("Redirecting to loopback IP...");
        }
      }
      throw new Error(`Please use the loopback IP address instead of ${locationUrl}`);
    }
  }
});

// node_modules/@atproto/oauth-client-browser/dist/index.js
var require_dist25 = __commonJS({
  "node_modules/@atproto/oauth-client-browser/dist/index.js"(exports) {
    "use strict";
    var __createBinding2 = exports && exports.__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 __exportStar2 = exports && exports.__exportStar || function(m, exports2) {
      for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding2(exports2, m, p);
    };
    Object.defineProperty(exports, "__esModule", { value: true });
    exports.buildLoopbackClientId = void 0;
    require_disposable_polyfill();
    __exportStar2(require_dist14(), exports);
    __exportStar2(require_dist24(), exports);
    __exportStar2(require_browser_oauth_client(), exports);
    __exportStar2(require_errors3(), exports);
    var util_js_1 = require_util21();
    Object.defineProperty(exports, "buildLoopbackClientId", { enumerable: true, get: function() {
      return util_js_1.buildLoopbackClientId;
    } });
  }
});

// src/bsky-auth.ts
var import_api = __toESM(require_dist11(), 1);
var import_oauth_client_browser = __toESM(require_dist25(), 1);
var sessionInfo = {
  isAuthenticated: false,
  did: null,
  handle: null,
  pdsUrl: null
};
var clientPromise = null;
var oauthConfigPromise = null;
function toSessionInfo(session) {
  return {
    isAuthenticated: true,
    did: session.sub,
    handle: session.handle ?? session.sub,
    pdsUrl: session.aud ?? null
  };
}
async function getAgent() {
  const client = await getClient();
  if (!sessionInfo.did) {
    throw new Error("No active Bluesky session.");
  }
  const session = await client.restore(sessionInfo.did);
  if (!session) {
    throw new Error("Unable to restore Bluesky session.");
  }
  sessionInfo = toSessionInfo(session);
  return new import_api.Agent(session);
}
function isUnauthorizedError(error) {
  if (!error || typeof error !== "object") {
    return false;
  }
  const maybeStatus = error.status;
  if (maybeStatus === 401) {
    return true;
  }
  const maybeMessage = error.message;
  return typeof maybeMessage === "string" && maybeMessage.includes("401");
}
async function callWithAuthRetry(operation) {
  let lastError;
  for (let attempt = 0; attempt < 2; attempt++) {
    try {
      const agent = await getAgent();
      return await operation(agent);
    } catch (error) {
      lastError = error;
      if (!isUnauthorizedError(error) || attempt === 1) {
        break;
      }
      await new Promise((resolve) => window.setTimeout(resolve, 300));
    }
  }
  throw lastError;
}
async function mapInBatches(items, batchSize, mapper) {
  const output = [];
  for (let index = 0; index < items.length; index += batchSize) {
    const batch = items.slice(index, index + batchSize);
    const settled = await Promise.allSettled(batch.map(mapper));
    for (const result of settled) {
      if (result.status === "fulfilled") {
        output.push(result.value);
      }
    }
  }
  return output;
}
async function mapInBatchesDetailed(items, batchSize, mapper) {
  const fulfilled = [];
  const rejected = [];
  for (let index = 0; index < items.length; index += batchSize) {
    const batch = items.slice(index, index + batchSize);
    const settled = await Promise.allSettled(batch.map(mapper));
    for (const result of settled) {
      if (result.status === "fulfilled") {
        fulfilled.push(result.value);
      } else {
        rejected.push(result.reason);
      }
    }
  }
  return { fulfilled, rejected };
}
async function fetchActorLikes(actor, maxItems) {
  const likedEntries = [];
  const seenCursors = /* @__PURE__ */ new Set();
  let cursor;
  while (likedEntries.length < maxItems) {
    const response = await callWithAuthRetry(
      (agent) => agent.app.bsky.feed.getActorLikes({
        actor,
        limit: Math.min(100, maxItems - likedEntries.length),
        cursor
      })
    );
    likedEntries.push(...response.data.feed);
    cursor = response.data.cursor;
    if (!cursor || seenCursors.has(cursor)) {
      break;
    }
    seenCursors.add(cursor);
  }
  return likedEntries;
}
async function fetchPostLikers(uri, maxItems) {
  const likes = [];
  const seenCursors = /* @__PURE__ */ new Set();
  let cursor;
  while (likes.length < maxItems) {
    const response = await callWithAuthRetry(
      (agent) => agent.app.bsky.feed.getLikes({
        uri,
        limit: Math.min(100, maxItems - likes.length),
        cursor
      })
    );
    likes.push(...response.data.likes);
    cursor = response.data.cursor;
    if (!cursor || seenCursors.has(cursor)) {
      break;
    }
    seenCursors.add(cursor);
  }
  return likes;
}
function isLoopbackOrigin(origin) {
  const url = new URL(origin);
  return url.hostname === "127.0.0.1" || url.hostname === "[::1]" || url.hostname === "::1" || url.hostname === "localhost";
}
async function getOAuthConfig() {
  if (!oauthConfigPromise) {
    oauthConfigPromise = (async () => {
      const response = await fetch("/api/oauth/config", {
        credentials: "same-origin"
      });
      if (!response.ok) {
        throw new Error("Unable to load Bluesky OAuth configuration.");
      }
      return await response.json();
    })();
  }
  return oauthConfigPromise;
}
async function getClient() {
  if (!clientPromise) {
    clientPromise = (async () => {
      const config = await getOAuthConfig();
      const loopback = config.allowLocalDev && isLoopbackOrigin(config.currentOrigin);
      const clientMetadata = config.isConfigured && config.publicOrigin ? {
        client_id: `${config.publicOrigin}/oauth/client-metadata.json`,
        client_name: "Bluesky Feed Dashboard",
        client_uri: config.publicOrigin,
        redirect_uris: [`${config.publicOrigin}/oauth/callback`],
        application_type: "web",
        grant_types: ["authorization_code", "refresh_token"],
        response_types: ["code"],
        token_endpoint_auth_method: "none",
        scope: "atproto transition:generic",
        dpop_bound_access_tokens: true
      } : loopback ? {
        client_id: `http://localhost?redirect_uri=${encodeURIComponent(`${config.currentOrigin}/oauth/callback`)}&scope=${encodeURIComponent("atproto transition:generic")}`,
        client_name: "Bluesky Feed Dashboard (Dev)",
        application_type: "native",
        grant_types: ["authorization_code", "refresh_token"],
        response_types: ["code"],
        redirect_uris: [`${config.currentOrigin}/oauth/callback`],
        token_endpoint_auth_method: "none",
        scope: "atproto transition:generic",
        dpop_bound_access_tokens: true
      } : null;
      if (!clientMetadata) {
        throw new Error(
          "Bluesky OAuth requires either a public HTTPS hostname or loopback development on 127.0.0.1/localhost."
        );
      }
      const client = new import_oauth_client_browser.BrowserOAuthClient({
        clientMetadata,
        handleResolver: "https://bsky.social"
      });
      const result = await client.init();
      if (result?.session) {
        sessionInfo = toSessionInfo(result.session);
      }
      return client;
    })();
  }
  return clientPromise;
}
function normalizePost(entry) {
  const post = entry.post ?? entry;
  const author = post.author ?? {};
  const record = post.record ?? {};
  return {
    subjectUri: post.uri,
    authorDid: author.did,
    authorHandle: author.handle,
    authorDisplayName: author.displayName ?? author.handle ?? author.did,
    text: record.text ?? "",
    origin: "app.bsky.feed.getTimeline",
    labels: (post.labels ?? []).map((label) => label.val),
    createdAt: record.createdAt ?? post.indexedAt ?? null,
    score: 1
  };
}
function normalizeLikedPost(entry) {
  const post = entry.post ?? entry;
  const author = post.author ?? {};
  const record = post.record ?? {};
  return {
    uri: post.uri,
    authorDid: author.did,
    authorHandle: author.handle ?? author.did,
    authorDisplayName: author.displayName ?? author.handle ?? author.did,
    text: record.text ?? "",
    labels: (post.labels ?? []).map((label) => label.val),
    createdAt: record.createdAt ?? post.indexedAt ?? null
  };
}
async function fetchAuthorPosts(author, limit) {
  const authorFeed = await callWithAuthRetry(
    (agent) => agent.app.bsky.feed.getAuthorFeed({
      actor: author.did,
      filter: "posts_no_replies",
      limit
    })
  );
  return authorFeed.data.feed.map((entry) => ({
    ...normalizePost(entry),
    origin: author.source === "first-order" ? `liked-author:${author.handle}` : `second-order:${author.handle}`
  }));
}
function isAtUri(value) {
  return !!value && value.startsWith("at://");
}
window.bskyDashboard = {
  async getSession() {
    await getClient();
    return sessionInfo;
  },
  async beginLogin(identifier) {
    if (!identifier) {
      return;
    }
    const client = await getClient();
    void client.signIn(identifier, { scope: "atproto transition:generic" });
  },
  async fetchFeed(request) {
    const source = request.source?.trim();
    if (!source || source === "home") {
      const timeline = await callWithAuthRetry(
        (agent) => agent.app.bsky.feed.getTimeline({ limit: request.limit })
      );
      return timeline.data.feed.map(normalizePost);
    }
    if (isAtUri(source)) {
      const feed = await callWithAuthRetry(
        (agent) => agent.app.bsky.feed.getFeed({ feed: source, limit: request.limit })
      );
      return feed.data.feed.map(normalizePost);
    }
    const authorFeed = await callWithAuthRetry(
      (agent) => agent.app.bsky.feed.getAuthorFeed({ actor: source, limit: request.limit })
    );
    return authorFeed.data.feed.map(normalizePost);
  },
  async fetchLikedNetwork() {
    const actor = sessionInfo.did;
    if (!actor) {
      throw new Error("No active Bluesky session.");
    }
    console.log("[import] Starting liked-network crawl for", actor);
    const t0 = performance.now();
    console.log("[import] Fetching actor likes (max 300)\u2026");
    const likedEntries = await fetchActorLikes(actor, 300);
    console.log("[import] Got", likedEntries.length, "liked entries in", Math.round(performance.now() - t0), "ms");
    const likedPosts = likedEntries.map(normalizeLikedPost);
    const seedItems = likedPosts.map((liked) => ({
      subjectUri: liked.uri,
      authorDid: liked.authorDid,
      authorHandle: liked.authorHandle,
      authorDisplayName: liked.authorDisplayName,
      text: liked.text,
      origin: "liked-seed",
      labels: liked.labels,
      createdAt: liked.createdAt
    }));
    const authorMap = /* @__PURE__ */ new Map();
    for (const liked of likedPosts) {
      const existing = authorMap.get(liked.authorDid);
      authorMap.set(liked.authorDid, {
        did: liked.authorDid,
        handle: liked.authorHandle,
        displayName: liked.authorDisplayName,
        likeCount: (existing?.likeCount ?? 0) + 1,
        source: "first-order"
      });
    }
    const topAuthors = [...authorMap.values()].sort((left, right) => right.likeCount - left.likeCount).slice(0, 25);
    const firstOrderAuthors = topAuthors.map((author) => ({ ...author, source: "first-order" }));
    console.log("[import] Top first-order authors:", firstOrderAuthors.length);
    const secondOrderSeedPosts = seedItems.slice(0, 40);
    console.log("[import] Crawling second-order likers for", secondOrderSeedPosts.length, "seed posts\u2026");
    const secondOrderResults = await mapInBatchesDetailed(secondOrderSeedPosts, 4, async (seedItem) => {
      const likes = await fetchPostLikers(seedItem.subjectUri, 40);
      return likes.map((like) => ({
        seedPostUri: seedItem.subjectUri,
        seedWeight: 1,
        actor: like.actor
      }));
    });
    const secondOrderLikes = secondOrderResults.fulfilled;
    console.log("[import] Second-order: fulfilled =", secondOrderLikes.length, "rejected =", secondOrderResults.rejected.length, "in", Math.round(performance.now() - t0), "ms");
    if (secondOrderResults.rejected.length > 0) {
      const errorSummary = secondOrderResults.rejected.slice(0, 3).map((error) => error instanceof Error ? error.message : String(error)).join(" | ");
      throw new Error(
        `Second-order co-liker crawl failed for ${secondOrderResults.rejected.length} seed post(s). Seed count=${secondOrderSeedPosts.length}. Errors: ${errorSummary}`
      );
    }
    const rawSecondOrderRows = secondOrderLikes.flat();
    if (secondOrderSeedPosts.length > 0 && rawSecondOrderRows.length === 0) {
      throw new Error(
        `Second-order co-liker crawl returned zero rows. Seed posts=${secondOrderSeedPosts.length}`
      );
    }
    const secondOrderAuthorMap = /* @__PURE__ */ new Map();
    let droppedAsSelf = 0;
    let droppedAsAlreadyFirstOrder = 0;
    for (const discovered of rawSecondOrderRows) {
      const likedActor = discovered.actor ?? {};
      const likedActorDid = likedActor.did;
      if (!likedActorDid) {
        continue;
      }
      if (likedActorDid === actor) {
        droppedAsSelf += 1;
        continue;
      }
      if (authorMap.has(likedActorDid)) {
        droppedAsAlreadyFirstOrder += 1;
        continue;
      }
      const existing = secondOrderAuthorMap.get(likedActorDid);
      secondOrderAuthorMap.set(likedActorDid, {
        did: likedActorDid,
        handle: likedActor.handle ?? likedActorDid,
        displayName: likedActor.displayName ?? likedActor.handle ?? likedActorDid,
        likeCount: (existing?.likeCount ?? 0) + discovered.seedWeight,
        source: "second-order"
      });
    }
    const secondOrderAuthors = [...secondOrderAuthorMap.values()].sort((left, right) => right.likeCount - left.likeCount).slice(0, 30);
    console.log("[import] Second-order authors:", secondOrderAuthors.length);
    if (rawSecondOrderRows.length > 0 && secondOrderAuthors.length === 0) {
      throw new Error(
        `Second-order crawl collapsed to zero authors after filtering. Raw rows=${rawSecondOrderRows.length}, dropped as self=${droppedAsSelf}, dropped as already-first-order=${droppedAsAlreadyFirstOrder}.`
      );
    }
    console.log("[import] Fetching author feeds (first-order:", firstOrderAuthors.length, "second-order:", secondOrderAuthors.length, ")\u2026");
    const fetchedAuthorFeeds = await mapInBatches(
      firstOrderAuthors,
      4,
      async (author) => fetchAuthorPosts(author, 6)
    );
    const fetchedSecondOrderFeeds = await mapInBatches(
      secondOrderAuthors,
      4,
      async (author) => fetchAuthorPosts(author, 4)
    );
    const feedItems = [...fetchedAuthorFeeds.flat(), ...fetchedSecondOrderFeeds.flat()];
    const deduped = Array.from(new Map(feedItems.map((item) => [item.subjectUri, item])).values());
    const combinedAuthors = [...firstOrderAuthors, ...secondOrderAuthors].sort((left, right) => right.likeCount - left.likeCount);
    const result = {
      account: {
        did: sessionInfo.did,
        handle: sessionInfo.handle ?? sessionInfo.did,
        pdsUrl: sessionInfo.pdsUrl
      },
      authors: combinedAuthors,
      items: deduped,
      seedItems
    };
    const jsonSize = new Blob([JSON.stringify(result)]).size;
    console.log("[import] Crawl complete:", deduped.length, "posts,", combinedAuthors.length, "authors in", Math.round(performance.now() - t0), "ms \u2014 payload ~" + Math.round(jsonSize / 1024) + " KB");
    return result;
  },
  async writeSignal(signal) {
    await callWithAuthRetry(
      (agent) => agent.com.atproto.repo.putRecord({
        repo: agent.assertDid,
        collection: signal.collection,
        rkey: crypto.randomUUID(),
        record: {
          $type: signal.collection,
          subjectUri: signal.subjectUri,
          signal: signal.signal,
          weight: signal.weight,
          generatorId: signal.generatorId,
          metadata: signal.metadata,
          createdAt: signal.createdAt
        }
      })
    );
  },
  async publishFeedGenerator(request) {
    await callWithAuthRetry(
      (agent) => agent.com.atproto.repo.putRecord({
        repo: request.ownerDid,
        collection: "app.bsky.feed.generator",
        rkey: request.feedKey,
        record: {
          $type: "app.bsky.feed.generator",
          did: request.serviceDid,
          displayName: request.displayName,
          description: request.description,
          createdAt: (/* @__PURE__ */ new Date()).toISOString()
        }
      })
    );
  },
  async fetchAuthorFollows(actor, maxFollows) {
    const follows = [];
    const seenCursors = /* @__PURE__ */ new Set();
    let cursor;
    while (follows.length < maxFollows) {
      const response = await callWithAuthRetry(
        (agent) => agent.app.bsky.graph.getFollows({
          actor,
          limit: Math.min(100, maxFollows - follows.length),
          cursor
        })
      );
      follows.push(...response.data.follows || []);
      cursor = response.data.cursor;
      if (!cursor || seenCursors.has(cursor)) {
        break;
      }
      seenCursors.add(cursor);
    }
    return follows;
  },
  async fetchUserLists() {
    const actor = sessionInfo.did;
    if (!actor) {
      throw new Error("No active Bluesky session.");
    }
    console.log("[lists] Fetching lists for", actor);
    const lists = [];
    const seenCursors = /* @__PURE__ */ new Set();
    let cursor;
    while (true) {
      const response = await callWithAuthRetry(
        (agent) => agent.app.bsky.graph.getLists({
          actor,
          limit: 100,
          cursor
        })
      );
      const listsData = response.data.lists || [];
      for (const list of listsData) {
        lists.push({
          uri: list.uri,
          name: list.name,
          description: list.description,
          creator: {
            did: list.creator.did,
            handle: list.creator.handle,
            displayName: list.creator.displayName
          },
          indexedAt: list.indexedAt
        });
      }
      cursor = response.data.cursor;
      if (!cursor || seenCursors.has(cursor)) {
        break;
      }
      seenCursors.add(cursor);
    }
    console.log("[lists] Found", lists.length, "lists");
    return lists;
  },
  async fetchListMembers(listUri, maxItems) {
    console.log("[lists] Fetching members for", listUri);
    const members = [];
    const seenCursors = /* @__PURE__ */ new Set();
    let cursor;
    while (members.length < maxItems) {
      const response = await callWithAuthRetry(
        (agent) => agent.app.bsky.graph.getList({
          list: listUri,
          limit: Math.min(100, maxItems - members.length),
          cursor
        })
      );
      const items = response.data.items || [];
      for (const item of items) {
        if (item.subject) {
          members.push({
            did: item.subject.did,
            handle: item.subject.handle,
            displayName: item.subject.displayName || item.subject.handle
          });
        }
      }
      cursor = response.data.cursor;
      if (!cursor || seenCursors.has(cursor)) {
        break;
      }
      seenCursors.add(cursor);
    }
    console.log("[lists] Found", members.length, "members");
    return members;
  },
  async analyzeListFollows(request) {
    const actor = sessionInfo.did;
    if (!actor) {
      throw new Error("No active Bluesky session.");
    }
    console.log("[list-analysis] Starting follows analysis for", actor, request.listUri ? `list: ${request.listUri}` : "liked network");
    const t0 = performance.now();
    let sourceAuthors;
    if (request.listUri) {
      console.log("[list-analysis] Fetching list members...");
      const members = await this.fetchListMembers(request.listUri, 200);
      sourceAuthors = members.map((m) => ({
        did: m.did,
        handle: m.handle,
        displayName: m.displayName
      }));
      console.log("[list-analysis] Found", sourceAuthors.length, "list members");
    } else {
      console.log("[list-analysis] Fetching imported authors...");
      const likedNetwork = await this.fetchLikedNetwork();
      sourceAuthors = likedNetwork.authors.filter((a) => a.source === "first-order").map((a) => ({
        did: a.did,
        handle: a.handle,
        displayName: a.displayName
      }));
      console.log("[list-analysis] Found", sourceAuthors.length, "source authors from liked network");
    }
    if (sourceAuthors.length === 0) {
      return {
        sourceCount: 0,
        analyzedCount: 0,
        topFollowed: []
      };
    }
    console.log("[list-analysis] Fetching follows for each source author...");
    const followsResults = await mapInBatchesDetailed(
      sourceAuthors,
      3,
      async (author) => {
        const follows = await this.fetchAuthorFollows(author.did, request.maxFollowsPerUser);
        return {
          sourceDid: author.did,
          sourceHandle: author.handle,
          follows: follows.map((f) => ({
            did: f.did,
            handle: f.handle,
            displayName: f.displayName || f.handle
          }))
        };
      }
    );
    console.log(
      "[list-analysis] Fetched follows:",
      followsResults.fulfilled.length,
      "succeeded,",
      followsResults.rejected.length,
      "failed in",
      Math.round(performance.now() - t0),
      "ms"
    );
    const followedMap = /* @__PURE__ */ new Map();
    for (const result of followsResults.fulfilled) {
      for (const followed of result.follows) {
        const existing = followedMap.get(followed.did);
        if (existing) {
          existing.followerCount++;
          if (!existing.followedBy.includes(result.sourceHandle)) {
            existing.followedBy.push(result.sourceHandle);
          }
        } else {
          followedMap.set(followed.did, {
            did: followed.did,
            handle: followed.handle,
            displayName: followed.displayName,
            followerCount: 1,
            followedBy: [result.sourceHandle]
          });
        }
      }
    }
    const topFollowed = [...followedMap.values()].sort((a, b) => b.followerCount - a.followerCount).slice(0, 50);
    console.log(
      "[list-analysis] Analysis complete:",
      followedMap.size,
      "unique follows found,",
      topFollowed.length,
      "top followed in",
      Math.round(performance.now() - t0),
      "ms"
    );
    return {
      sourceCount: sourceAuthors.length,
      analyzedCount: followsResults.fulfilled.length,
      topFollowed
    };
  }
};
/*! Bundled license information:

@atproto/lex-data/dist/uint8array.js:
  (* v8 ignore next -- @preserve *)

@atproto/lex-data/dist/utf8.js:
  (* v8 ignore next -- @preserve *)
*/
An unhandled error has occurred. Reload 🗙