@fedify/vocab 2.2.0-dev.635 → 2.2.0-dev.731

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mod.js CHANGED
@@ -4,11 +4,11 @@ import { SpanStatusCode, trace } from "@opentelemetry/api";
4
4
  import { domainToASCII, domainToUnicode } from "node:url";
5
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
6
  import { getLogger } from "@logtape/logtape";
7
- import { LanguageString, LanguageString as LanguageString$1, decodeMultibase, encodeMultibase, exportMultibaseKey, exportSpki, getDocumentLoader, importMultibaseKey, importPem } from "@fedify/vocab-runtime";
7
+ import { LanguageString, LanguageString as LanguageString$1, decodeMultibase, encodeMultibase, exportMultibaseKey, exportSpki, getDocumentLoader, importMultibaseKey, importPem, isDecimal, parseDecimal } from "@fedify/vocab-runtime";
8
8
  import { delay } from "es-toolkit";
9
9
  //#region deno.json
10
10
  var name = "@fedify/vocab";
11
- var version = "2.2.0-dev.635+ece5910c";
11
+ var version = "2.2.0-dev.731+3d1ca85e";
12
12
  //#endregion
13
13
  //#region src/type.ts
14
14
  function getTypeId(object) {
@@ -5028,6 +5028,7 @@ var Object$1 = class Object$1 {
5028
5028
  if (values["@type"].includes("https://gotosocial.org/ns#AnnounceAuthorization")) return await AnnounceAuthorization.fromJsonLd(json, options);
5029
5029
  if (values["@type"].includes("https://gotosocial.org/ns#LikeApproval")) return await LikeAuthorization.fromJsonLd(json, options);
5030
5030
  if (values["@type"].includes("https://gotosocial.org/ns#ReplyAuthorization")) return await ReplyAuthorization.fromJsonLd(json, options);
5031
+ if (values["@type"].includes("https://w3id.org/valueflows/ont/vf#Proposal")) return await Proposal.fromJsonLd(json, options);
5031
5032
  if (values["@type"].includes("https://www.w3.org/ns/activitystreams#Activity")) return await Activity.fromJsonLd(json, options);
5032
5033
  if (values["@type"].includes("http://litepub.social/ns#EmojiReact")) return await EmojiReact.fromJsonLd(json, options);
5033
5034
  if (values["@type"].includes("https://gotosocial.org/ns#AnnounceRequest")) return await AnnounceRequest.fromJsonLd(json, options);
@@ -5101,6 +5102,7 @@ var Object$1 = class Object$1 {
5101
5102
  "https://gotosocial.org/ns#AnnounceAuthorization",
5102
5103
  "https://gotosocial.org/ns#LikeApproval",
5103
5104
  "https://gotosocial.org/ns#ReplyAuthorization",
5105
+ "https://w3id.org/valueflows/ont/vf#Proposal",
5104
5106
  "https://www.w3.org/ns/activitystreams#Activity",
5105
5107
  "http://litepub.social/ns#EmojiReact",
5106
5108
  "https://gotosocial.org/ns#AnnounceRequest",
@@ -5240,6 +5242,7 @@ var Object$1 = class Object$1 {
5240
5242
  "https://gotosocial.org/ns#AnnounceAuthorization",
5241
5243
  "https://gotosocial.org/ns#LikeApproval",
5242
5244
  "https://gotosocial.org/ns#ReplyAuthorization",
5245
+ "https://w3id.org/valueflows/ont/vf#Proposal",
5243
5246
  "https://www.w3.org/ns/activitystreams#Activity",
5244
5247
  "http://litepub.social/ns#EmojiReact",
5245
5248
  "https://gotosocial.org/ns#AnnounceRequest",
@@ -5341,6 +5344,7 @@ var Object$1 = class Object$1 {
5341
5344
  "https://gotosocial.org/ns#AnnounceAuthorization",
5342
5345
  "https://gotosocial.org/ns#LikeApproval",
5343
5346
  "https://gotosocial.org/ns#ReplyAuthorization",
5347
+ "https://w3id.org/valueflows/ont/vf#Proposal",
5344
5348
  "https://www.w3.org/ns/activitystreams#Activity",
5345
5349
  "http://litepub.social/ns#EmojiReact",
5346
5350
  "https://gotosocial.org/ns#AnnounceRequest",
@@ -5454,6 +5458,7 @@ var Object$1 = class Object$1 {
5454
5458
  "https://gotosocial.org/ns#AnnounceAuthorization",
5455
5459
  "https://gotosocial.org/ns#LikeApproval",
5456
5460
  "https://gotosocial.org/ns#ReplyAuthorization",
5461
+ "https://w3id.org/valueflows/ont/vf#Proposal",
5457
5462
  "https://www.w3.org/ns/activitystreams#Activity",
5458
5463
  "http://litepub.social/ns#EmojiReact",
5459
5464
  "https://gotosocial.org/ns#AnnounceRequest",
@@ -5539,6 +5544,7 @@ var Object$1 = class Object$1 {
5539
5544
  "https://gotosocial.org/ns#AnnounceAuthorization",
5540
5545
  "https://gotosocial.org/ns#LikeApproval",
5541
5546
  "https://gotosocial.org/ns#ReplyAuthorization",
5547
+ "https://w3id.org/valueflows/ont/vf#Proposal",
5542
5548
  "https://www.w3.org/ns/activitystreams#Activity",
5543
5549
  "http://litepub.social/ns#EmojiReact",
5544
5550
  "https://gotosocial.org/ns#AnnounceRequest",
@@ -5631,6 +5637,7 @@ var Object$1 = class Object$1 {
5631
5637
  "https://gotosocial.org/ns#AnnounceAuthorization",
5632
5638
  "https://gotosocial.org/ns#LikeApproval",
5633
5639
  "https://gotosocial.org/ns#ReplyAuthorization",
5640
+ "https://w3id.org/valueflows/ont/vf#Proposal",
5634
5641
  "https://www.w3.org/ns/activitystreams#Activity",
5635
5642
  "http://litepub.social/ns#EmojiReact",
5636
5643
  "https://gotosocial.org/ns#AnnounceRequest",
@@ -5788,6 +5795,7 @@ var Object$1 = class Object$1 {
5788
5795
  "https://gotosocial.org/ns#AnnounceAuthorization",
5789
5796
  "https://gotosocial.org/ns#LikeApproval",
5790
5797
  "https://gotosocial.org/ns#ReplyAuthorization",
5798
+ "https://w3id.org/valueflows/ont/vf#Proposal",
5791
5799
  "https://www.w3.org/ns/activitystreams#Activity",
5792
5800
  "http://litepub.social/ns#EmojiReact",
5793
5801
  "https://gotosocial.org/ns#AnnounceRequest",
@@ -8675,6 +8683,267 @@ PropertyValue.prototype[Symbol.for("Deno.customInspect")] = function(inspect, op
8675
8683
  PropertyValue.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
8676
8684
  return "PropertyValue " + inspect(this._getCustomInspectProxy(), options);
8677
8685
  };
8686
+ /** A quantity with a unit of measure.
8687
+ */
8688
+ var Measure = class {
8689
+ #documentLoader;
8690
+ #contextLoader;
8691
+ #tracerProvider;
8692
+ #warning;
8693
+ #cachedJsonLd;
8694
+ id;
8695
+ get _documentLoader() {
8696
+ return this.#documentLoader;
8697
+ }
8698
+ get _contextLoader() {
8699
+ return this.#contextLoader;
8700
+ }
8701
+ get _tracerProvider() {
8702
+ return this.#tracerProvider;
8703
+ }
8704
+ get _warning() {
8705
+ return this.#warning;
8706
+ }
8707
+ get _cachedJsonLd() {
8708
+ return this.#cachedJsonLd;
8709
+ }
8710
+ set _cachedJsonLd(value) {
8711
+ this.#cachedJsonLd = value;
8712
+ }
8713
+ /**
8714
+ * The type URI of {@link Measure}: `http://www.ontology-of-units-of-measure.org/resource/om-2/Measure`.
8715
+ */
8716
+ static get typeId() {
8717
+ return new URL("http://www.ontology-of-units-of-measure.org/resource/om-2/Measure");
8718
+ }
8719
+ #_27fgyFbosTtMAhuepJH8K3ZGURT6 = [];
8720
+ #_1GQx8o2RgxRs4x9G5uT39XYBv7D = [];
8721
+ /**
8722
+ * Constructs a new instance of Measure with the given values.
8723
+ * @param values The values to initialize the instance with.
8724
+ * @param options The options to use for initialization.
8725
+ */
8726
+ constructor(values, options = {}) {
8727
+ this.#documentLoader = options.documentLoader;
8728
+ this.#contextLoader = options.contextLoader;
8729
+ this.#tracerProvider = options.tracerProvider;
8730
+ if ("$warning" in options) this.#warning = options.$warning;
8731
+ if (values.id == null || values.id instanceof URL) this.id = values.id ?? null;
8732
+ else throw new TypeError("The id must be a URL.");
8733
+ if ("unit" in values && values.unit != null) if (typeof values.unit === "string") this.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = [values.unit];
8734
+ else throw new TypeError("The unit must be of type string.");
8735
+ if ("numericalValue" in values && values.numericalValue != null) if (typeof values.numericalValue === "string" && isDecimal(values.numericalValue)) this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = [values.numericalValue];
8736
+ else throw new TypeError("The numericalValue must be of type Decimal.");
8737
+ }
8738
+ /**
8739
+ * Clones this instance, optionally updating it with the given values.
8740
+ * @param values The values to update the clone with.
8741
+ * @param options The options to use for cloning.
8742
+ * @returns The cloned instance.
8743
+ */
8744
+ clone(values = {}, options = {}) {
8745
+ if (this._warning != null) {
8746
+ getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
8747
+ options = {
8748
+ ...options,
8749
+ $warning: this._warning
8750
+ };
8751
+ }
8752
+ const clone = new this.constructor({ id: values.id ?? this.id }, options);
8753
+ clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6;
8754
+ if ("unit" in values && values.unit != null) if (typeof values.unit === "string") clone.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = [values.unit];
8755
+ else throw new TypeError("The unit must be of type string.");
8756
+ clone.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D;
8757
+ if ("numericalValue" in values && values.numericalValue != null) if (typeof values.numericalValue === "string" && isDecimal(values.numericalValue)) clone.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = [values.numericalValue];
8758
+ else throw new TypeError("The numericalValue must be of type Decimal.");
8759
+ return clone;
8760
+ }
8761
+ /** The name of the unit, according to the Ontology of units of Measure
8762
+ * classification. The recommended unit for countable items is `"one"`.
8763
+ */
8764
+ get unit() {
8765
+ if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
8766
+ if (this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.length < 1) return null;
8767
+ return this.#_27fgyFbosTtMAhuepJH8K3ZGURT6[0];
8768
+ }
8769
+ /** The amount of the resource. If not specified, arbitrary amounts can be
8770
+ * used when responding to the proposal.
8771
+ */
8772
+ get numericalValue() {
8773
+ if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
8774
+ if (this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.length < 1) return null;
8775
+ return this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D[0];
8776
+ }
8777
+ /**
8778
+ * Converts this object to a JSON-LD structure.
8779
+ * @param options The options to use.
8780
+ * - `format`: The format of the output: `compact` or
8781
+ `expand`.
8782
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
8783
+ * - `context`: The JSON-LD context to use. Not applicable
8784
+ when `format` is set to `'expand'`.
8785
+ * @returns The JSON-LD representation of this object.
8786
+ */
8787
+ async toJsonLd(options = {}) {
8788
+ if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
8789
+ if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
8790
+ options = {
8791
+ ...options,
8792
+ contextLoader: options.contextLoader ?? getDocumentLoader()
8793
+ };
8794
+ if (options.format == null && this.isCompactable()) {
8795
+ const result = {};
8796
+ let compactItems = [];
8797
+ for (const v of this.#_27fgyFbosTtMAhuepJH8K3ZGURT6) {
8798
+ const item = v;
8799
+ compactItems.push(item);
8800
+ }
8801
+ if (compactItems.length > 0) result["hasUnit"] = compactItems.length > 1 ? compactItems : compactItems[0];
8802
+ compactItems = [];
8803
+ for (const v of this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D) {
8804
+ const item = v;
8805
+ compactItems.push(item);
8806
+ }
8807
+ if (compactItems.length > 0) result["hasNumericalValue"] = compactItems.length > 1 ? compactItems : compactItems[0];
8808
+ result["type"] = "om2:Measure";
8809
+ if (this.id != null) result["id"] = this.id.href;
8810
+ result["@context"] = ["https://www.w3.org/ns/activitystreams", {
8811
+ "om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
8812
+ "hasUnit": "om2:hasUnit",
8813
+ "hasNumericalValue": "om2:hasNumericalValue"
8814
+ }];
8815
+ return result;
8816
+ }
8817
+ let array;
8818
+ const values = {};
8819
+ array = [];
8820
+ for (const v of this.#_27fgyFbosTtMAhuepJH8K3ZGURT6) {
8821
+ const element = { "@value": v };
8822
+ array.push(element);
8823
+ }
8824
+ if (array.length > 0) values["http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit"] = array;
8825
+ array = [];
8826
+ for (const v of this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D) {
8827
+ const element = {
8828
+ "@type": "http://www.w3.org/2001/XMLSchema#decimal",
8829
+ "@value": v
8830
+ };
8831
+ array.push(element);
8832
+ }
8833
+ if (array.length > 0) values["http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue"] = array;
8834
+ values["@type"] = ["http://www.ontology-of-units-of-measure.org/resource/om-2/Measure"];
8835
+ if (this.id != null) values["@id"] = this.id.href;
8836
+ if (options.format === "expand") return await jsonld.expand(values, { documentLoader: options.contextLoader });
8837
+ const docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
8838
+ "om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
8839
+ "hasUnit": "om2:hasUnit",
8840
+ "hasNumericalValue": "om2:hasNumericalValue"
8841
+ }];
8842
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
8843
+ if (docContext != null) {}
8844
+ return compacted;
8845
+ }
8846
+ isCompactable() {
8847
+ return true;
8848
+ }
8849
+ /**
8850
+ * Converts a JSON-LD structure to an object of this type.
8851
+ * @param json The JSON-LD structure to convert.
8852
+ * @param options The options to use.
8853
+ * - `documentLoader`: The loader for remote JSON-LD documents.
8854
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
8855
+ * - `tracerProvider`: The OpenTelemetry tracer provider to use.
8856
+ * If omitted, the global tracer provider is used.
8857
+ * @returns The object of this type.
8858
+ * @throws {TypeError} If the given `json` is invalid.
8859
+ */
8860
+ static async fromJsonLd(json, options = {}) {
8861
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.2.0").startActiveSpan("activitypub.parse_object", async (span) => {
8862
+ try {
8863
+ const object = await this.__fromJsonLd__Measure__(json, span, options);
8864
+ if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
8865
+ return object;
8866
+ } catch (error) {
8867
+ span.setStatus({
8868
+ code: SpanStatusCode.ERROR,
8869
+ message: String(error)
8870
+ });
8871
+ throw error;
8872
+ } finally {
8873
+ span.end();
8874
+ }
8875
+ });
8876
+ }
8877
+ static async __fromJsonLd__Measure__(json, span, options = {}) {
8878
+ if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
8879
+ else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
8880
+ options = {
8881
+ ...options,
8882
+ documentLoader: options.documentLoader ?? getDocumentLoader(),
8883
+ contextLoader: options.contextLoader ?? getDocumentLoader(),
8884
+ tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
8885
+ };
8886
+ let values;
8887
+ if (globalThis.Object.keys(json).length == 0) values = {};
8888
+ else values = (await jsonld.expand(json, {
8889
+ documentLoader: options.contextLoader,
8890
+ keepFreeFloatingNodes: true
8891
+ }))[0] ?? {};
8892
+ if (options.baseUrl == null && values["@id"] != null) options = {
8893
+ ...options,
8894
+ baseUrl: new URL(values["@id"])
8895
+ };
8896
+ if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
8897
+ if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
8898
+ if (!values["@type"].includes("http://www.ontology-of-units-of-measure.org/resource/om-2/Measure")) throw new TypeError("Invalid type: " + values["@type"]);
8899
+ }
8900
+ const instance = new this({ id: "@id" in values ? new URL(values["@id"]) : void 0 }, options);
8901
+ const _27fgyFbosTtMAhuepJH8K3ZGURT6 = [];
8902
+ let _27fgyFbosTtMAhuepJH8K3ZGURT6__array = values["http://www.ontology-of-units-of-measure.org/resource/om-2/hasUnit"];
8903
+ for (const v of _27fgyFbosTtMAhuepJH8K3ZGURT6__array == null ? [] : _27fgyFbosTtMAhuepJH8K3ZGURT6__array.length === 1 && "@list" in _27fgyFbosTtMAhuepJH8K3ZGURT6__array[0] ? _27fgyFbosTtMAhuepJH8K3ZGURT6__array[0]["@list"] : _27fgyFbosTtMAhuepJH8K3ZGURT6__array) {
8904
+ if (v == null) continue;
8905
+ _27fgyFbosTtMAhuepJH8K3ZGURT6.push(v["@value"]);
8906
+ }
8907
+ instance.#_27fgyFbosTtMAhuepJH8K3ZGURT6 = _27fgyFbosTtMAhuepJH8K3ZGURT6;
8908
+ const _1GQx8o2RgxRs4x9G5uT39XYBv7D = [];
8909
+ let _1GQx8o2RgxRs4x9G5uT39XYBv7D__array = values["http://www.ontology-of-units-of-measure.org/resource/om-2/hasNumericalValue"];
8910
+ for (const v of _1GQx8o2RgxRs4x9G5uT39XYBv7D__array == null ? [] : _1GQx8o2RgxRs4x9G5uT39XYBv7D__array.length === 1 && "@list" in _1GQx8o2RgxRs4x9G5uT39XYBv7D__array[0] ? _1GQx8o2RgxRs4x9G5uT39XYBv7D__array[0]["@list"] : _1GQx8o2RgxRs4x9G5uT39XYBv7D__array) {
8911
+ if (v == null) continue;
8912
+ _1GQx8o2RgxRs4x9G5uT39XYBv7D.push(parseDecimal(v["@value"]));
8913
+ }
8914
+ instance.#_1GQx8o2RgxRs4x9G5uT39XYBv7D = _1GQx8o2RgxRs4x9G5uT39XYBv7D;
8915
+ if (!("_fromSubclass" in options) || !options._fromSubclass) try {
8916
+ instance._cachedJsonLd = structuredClone(json);
8917
+ } catch {
8918
+ getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
8919
+ }
8920
+ return instance;
8921
+ }
8922
+ _getCustomInspectProxy() {
8923
+ const proxy = {};
8924
+ if (this.id != null) proxy.id = {
8925
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(this.id.href, options),
8926
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(this.id.href, options)
8927
+ };
8928
+ const _27fgyFbosTtMAhuepJH8K3ZGURT6 = this.#_27fgyFbosTtMAhuepJH8K3ZGURT6.map((v) => v instanceof URL ? {
8929
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
8930
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
8931
+ } : v);
8932
+ if (_27fgyFbosTtMAhuepJH8K3ZGURT6.length == 1) proxy.unit = _27fgyFbosTtMAhuepJH8K3ZGURT6[0];
8933
+ const _1GQx8o2RgxRs4x9G5uT39XYBv7D = this.#_1GQx8o2RgxRs4x9G5uT39XYBv7D.map((v) => v instanceof URL ? {
8934
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
8935
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
8936
+ } : v);
8937
+ if (_1GQx8o2RgxRs4x9G5uT39XYBv7D.length == 1) proxy.numericalValue = _1GQx8o2RgxRs4x9G5uT39XYBv7D[0];
8938
+ return proxy;
8939
+ }
8940
+ };
8941
+ Measure.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
8942
+ return "Measure " + inspect(this._getCustomInspectProxy(), options);
8943
+ };
8944
+ Measure.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
8945
+ return "Measure " + inspect(this._getCustomInspectProxy(), options);
8946
+ };
8678
8947
  /** Proves that an {@link Announce} interaction has been approved by
8679
8948
  * the post author.
8680
8949
  *
@@ -12973,6 +13242,809 @@ Multikey.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options
12973
13242
  Multikey.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
12974
13243
  return "Multikey " + inspect(this._getCustomInspectProxy(), options);
12975
13244
  };
13245
+ /** A proposed economic transaction describing what is being offered or requested
13246
+ * in a {@link Proposal}.
13247
+ */
13248
+ var Intent = class {
13249
+ #documentLoader;
13250
+ #contextLoader;
13251
+ #tracerProvider;
13252
+ #warning;
13253
+ #cachedJsonLd;
13254
+ id;
13255
+ get _documentLoader() {
13256
+ return this.#documentLoader;
13257
+ }
13258
+ get _contextLoader() {
13259
+ return this.#contextLoader;
13260
+ }
13261
+ get _tracerProvider() {
13262
+ return this.#tracerProvider;
13263
+ }
13264
+ get _warning() {
13265
+ return this.#warning;
13266
+ }
13267
+ get _cachedJsonLd() {
13268
+ return this.#cachedJsonLd;
13269
+ }
13270
+ set _cachedJsonLd(value) {
13271
+ this.#cachedJsonLd = value;
13272
+ }
13273
+ /**
13274
+ * The type URI of {@link Intent}: `https://w3id.org/valueflows/ont/vf#Intent`.
13275
+ */
13276
+ static get typeId() {
13277
+ return new URL("https://w3id.org/valueflows/ont/vf#Intent");
13278
+ }
13279
+ #_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = [];
13280
+ #_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = [];
13281
+ #_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = [];
13282
+ #_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = [];
13283
+ #_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = [];
13284
+ /**
13285
+ * Constructs a new instance of Intent with the given values.
13286
+ * @param values The values to initialize the instance with.
13287
+ * @param options The options to use for initialization.
13288
+ */
13289
+ constructor(values, options = {}) {
13290
+ this.#documentLoader = options.documentLoader;
13291
+ this.#contextLoader = options.contextLoader;
13292
+ this.#tracerProvider = options.tracerProvider;
13293
+ if ("$warning" in options) this.#warning = options.$warning;
13294
+ if (values.id == null || values.id instanceof URL) this.id = values.id ?? null;
13295
+ else throw new TypeError("The id must be a URL.");
13296
+ if ("action" in values && values.action != null) if (typeof values.action === "string") this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = [values.action];
13297
+ else throw new TypeError("The action must be of type string.");
13298
+ if ("resourceConformsTo" in values && values.resourceConformsTo != null) if (values.resourceConformsTo instanceof URL) this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = [values.resourceConformsTo];
13299
+ else throw new TypeError("The resourceConformsTo must be of type URL.");
13300
+ if ("resourceQuantity" in values && values.resourceQuantity != null) if (values.resourceQuantity instanceof Measure) this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = [values.resourceQuantity];
13301
+ else throw new TypeError("The resourceQuantity must be of type Measure.");
13302
+ if ("availableQuantity" in values && values.availableQuantity != null) if (values.availableQuantity instanceof Measure) this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = [values.availableQuantity];
13303
+ else throw new TypeError("The availableQuantity must be of type Measure.");
13304
+ if ("minimumQuantity" in values && values.minimumQuantity != null) if (values.minimumQuantity instanceof Measure) this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = [values.minimumQuantity];
13305
+ else throw new TypeError("The minimumQuantity must be of type Measure.");
13306
+ }
13307
+ /**
13308
+ * Clones this instance, optionally updating it with the given values.
13309
+ * @param values The values to update the clone with.
13310
+ * @param options The options to use for cloning.
13311
+ * @returns The cloned instance.
13312
+ */
13313
+ clone(values = {}, options = {}) {
13314
+ if (this._warning != null) {
13315
+ getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
13316
+ options = {
13317
+ ...options,
13318
+ $warning: this._warning
13319
+ };
13320
+ }
13321
+ const clone = new this.constructor({ id: values.id ?? this.id }, options);
13322
+ clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action;
13323
+ if ("action" in values && values.action != null) if (typeof values.action === "string") clone.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = [values.action];
13324
+ else throw new TypeError("The action must be of type string.");
13325
+ clone.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo;
13326
+ if ("resourceConformsTo" in values && values.resourceConformsTo != null) if (values.resourceConformsTo instanceof URL) clone.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = [values.resourceConformsTo];
13327
+ else throw new TypeError("The resourceConformsTo must be of type URL.");
13328
+ clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity;
13329
+ if ("resourceQuantity" in values && values.resourceQuantity != null) if (values.resourceQuantity instanceof Measure) clone.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = [values.resourceQuantity];
13330
+ else throw new TypeError("The resourceQuantity must be of type Measure.");
13331
+ clone.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity;
13332
+ if ("availableQuantity" in values && values.availableQuantity != null) if (values.availableQuantity instanceof Measure) clone.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = [values.availableQuantity];
13333
+ else throw new TypeError("The availableQuantity must be of type Measure.");
13334
+ clone.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity;
13335
+ if ("minimumQuantity" in values && values.minimumQuantity != null) if (values.minimumQuantity instanceof Measure) clone.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = [values.minimumQuantity];
13336
+ else throw new TypeError("The minimumQuantity must be of type Measure.");
13337
+ return clone;
13338
+ }
13339
+ /** The type of economic transaction. The value of this property should be
13340
+ * either `"deliverService"` or `"transfer"`.
13341
+ */
13342
+ get action() {
13343
+ if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
13344
+ if (this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.length < 1) return null;
13345
+ return this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action[0];
13346
+ }
13347
+ /** The type of an economic resource. Could be any URI.
13348
+ */
13349
+ get resourceConformsTo() {
13350
+ if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
13351
+ if (this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.length < 1) return null;
13352
+ return this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo[0];
13353
+ }
13354
+ /** The amount and unit of the economic resource.
13355
+ */
13356
+ get resourceQuantity() {
13357
+ if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
13358
+ if (this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length < 1) return null;
13359
+ return this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[0];
13360
+ }
13361
+ /** The quantity of the offered resource currently available.
13362
+ */
13363
+ get availableQuantity() {
13364
+ if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
13365
+ if (this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.length < 1) return null;
13366
+ return this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity[0];
13367
+ }
13368
+ /** The minimum possible quantity of the resource.
13369
+ */
13370
+ get minimumQuantity() {
13371
+ if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
13372
+ if (this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.length < 1) return null;
13373
+ return this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity[0];
13374
+ }
13375
+ /**
13376
+ * Converts this object to a JSON-LD structure.
13377
+ * @param options The options to use.
13378
+ * - `format`: The format of the output: `compact` or
13379
+ `expand`.
13380
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
13381
+ * - `context`: The JSON-LD context to use. Not applicable
13382
+ when `format` is set to `'expand'`.
13383
+ * @returns The JSON-LD representation of this object.
13384
+ */
13385
+ async toJsonLd(options = {}) {
13386
+ if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
13387
+ if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
13388
+ options = {
13389
+ ...options,
13390
+ contextLoader: options.contextLoader ?? getDocumentLoader()
13391
+ };
13392
+ if (options.format == null && this.isCompactable()) {
13393
+ const result = {};
13394
+ let compactItems = [];
13395
+ for (const v of this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action) {
13396
+ const item = v;
13397
+ compactItems.push(item);
13398
+ }
13399
+ if (compactItems.length > 0) result["action"] = compactItems.length > 1 ? compactItems : compactItems[0];
13400
+ compactItems = [];
13401
+ for (const v of this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo) {
13402
+ const item = v.href;
13403
+ compactItems.push(item);
13404
+ }
13405
+ if (compactItems.length > 0) result["resourceConformsTo"] = compactItems.length > 1 ? compactItems : compactItems[0];
13406
+ compactItems = [];
13407
+ for (const v of this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) {
13408
+ const item = await v.toJsonLd({
13409
+ ...options,
13410
+ format: void 0,
13411
+ context: void 0
13412
+ });
13413
+ compactItems.push(item);
13414
+ }
13415
+ if (compactItems.length > 0) result["resourceQuantity"] = compactItems.length > 1 ? compactItems : compactItems[0];
13416
+ compactItems = [];
13417
+ for (const v of this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity) {
13418
+ const item = await v.toJsonLd({
13419
+ ...options,
13420
+ format: void 0,
13421
+ context: void 0
13422
+ });
13423
+ compactItems.push(item);
13424
+ }
13425
+ if (compactItems.length > 0) result["availableQuantity"] = compactItems.length > 1 ? compactItems : compactItems[0];
13426
+ compactItems = [];
13427
+ for (const v of this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity) {
13428
+ const item = await v.toJsonLd({
13429
+ ...options,
13430
+ format: void 0,
13431
+ context: void 0
13432
+ });
13433
+ compactItems.push(item);
13434
+ }
13435
+ if (compactItems.length > 0) result["minimumQuantity"] = compactItems.length > 1 ? compactItems : compactItems[0];
13436
+ result["type"] = "Intent";
13437
+ if (this.id != null) result["id"] = this.id.href;
13438
+ result["@context"] = ["https://www.w3.org/ns/activitystreams", {
13439
+ "vf": "https://w3id.org/valueflows/ont/vf#",
13440
+ "om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
13441
+ "Intent": "vf:Intent",
13442
+ "action": "vf:action",
13443
+ "resourceConformsTo": {
13444
+ "@id": "vf:resourceConformsTo",
13445
+ "@type": "@id"
13446
+ },
13447
+ "resourceQuantity": "vf:resourceQuantity",
13448
+ "availableQuantity": "vf:availableQuantity",
13449
+ "minimumQuantity": "vf:minimumQuantity",
13450
+ "hasUnit": "om2:hasUnit",
13451
+ "hasNumericalValue": "om2:hasNumericalValue"
13452
+ }];
13453
+ return result;
13454
+ }
13455
+ let array;
13456
+ const values = {};
13457
+ array = [];
13458
+ for (const v of this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action) {
13459
+ const element = { "@value": v };
13460
+ array.push(element);
13461
+ }
13462
+ if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#action"] = array;
13463
+ array = [];
13464
+ for (const v of this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo) {
13465
+ const element = { "@id": v.href };
13466
+ array.push(element);
13467
+ }
13468
+ if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#resourceConformsTo"] = array;
13469
+ array = [];
13470
+ for (const v of this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity) {
13471
+ const element = await v.toJsonLd(options);
13472
+ array.push(element);
13473
+ }
13474
+ if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#resourceQuantity"] = array;
13475
+ array = [];
13476
+ for (const v of this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity) {
13477
+ const element = await v.toJsonLd(options);
13478
+ array.push(element);
13479
+ }
13480
+ if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#availableQuantity"] = array;
13481
+ array = [];
13482
+ for (const v of this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity) {
13483
+ const element = await v.toJsonLd(options);
13484
+ array.push(element);
13485
+ }
13486
+ if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#minimumQuantity"] = array;
13487
+ values["@type"] = ["https://w3id.org/valueflows/ont/vf#Intent"];
13488
+ if (this.id != null) values["@id"] = this.id.href;
13489
+ if (options.format === "expand") return await jsonld.expand(values, { documentLoader: options.contextLoader });
13490
+ const docContext = options.context ?? ["https://www.w3.org/ns/activitystreams", {
13491
+ "vf": "https://w3id.org/valueflows/ont/vf#",
13492
+ "om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
13493
+ "Intent": "vf:Intent",
13494
+ "action": "vf:action",
13495
+ "resourceConformsTo": {
13496
+ "@id": "vf:resourceConformsTo",
13497
+ "@type": "@id"
13498
+ },
13499
+ "resourceQuantity": "vf:resourceQuantity",
13500
+ "availableQuantity": "vf:availableQuantity",
13501
+ "minimumQuantity": "vf:minimumQuantity",
13502
+ "hasUnit": "om2:hasUnit",
13503
+ "hasNumericalValue": "om2:hasNumericalValue"
13504
+ }];
13505
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
13506
+ if (docContext != null) {}
13507
+ return compacted;
13508
+ }
13509
+ isCompactable() {
13510
+ return true;
13511
+ }
13512
+ /**
13513
+ * Converts a JSON-LD structure to an object of this type.
13514
+ * @param json The JSON-LD structure to convert.
13515
+ * @param options The options to use.
13516
+ * - `documentLoader`: The loader for remote JSON-LD documents.
13517
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
13518
+ * - `tracerProvider`: The OpenTelemetry tracer provider to use.
13519
+ * If omitted, the global tracer provider is used.
13520
+ * @returns The object of this type.
13521
+ * @throws {TypeError} If the given `json` is invalid.
13522
+ */
13523
+ static async fromJsonLd(json, options = {}) {
13524
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.2.0").startActiveSpan("activitypub.parse_object", async (span) => {
13525
+ try {
13526
+ const object = await this.__fromJsonLd__Intent__(json, span, options);
13527
+ if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
13528
+ return object;
13529
+ } catch (error) {
13530
+ span.setStatus({
13531
+ code: SpanStatusCode.ERROR,
13532
+ message: String(error)
13533
+ });
13534
+ throw error;
13535
+ } finally {
13536
+ span.end();
13537
+ }
13538
+ });
13539
+ }
13540
+ static async __fromJsonLd__Intent__(json, span, options = {}) {
13541
+ if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
13542
+ else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
13543
+ options = {
13544
+ ...options,
13545
+ documentLoader: options.documentLoader ?? getDocumentLoader(),
13546
+ contextLoader: options.contextLoader ?? getDocumentLoader(),
13547
+ tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
13548
+ };
13549
+ let values;
13550
+ if (globalThis.Object.keys(json).length == 0) values = {};
13551
+ else values = (await jsonld.expand(json, {
13552
+ documentLoader: options.contextLoader,
13553
+ keepFreeFloatingNodes: true
13554
+ }))[0] ?? {};
13555
+ if (options.baseUrl == null && values["@id"] != null) options = {
13556
+ ...options,
13557
+ baseUrl: new URL(values["@id"])
13558
+ };
13559
+ if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
13560
+ if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
13561
+ if (!values["@type"].includes("https://w3id.org/valueflows/ont/vf#Intent")) throw new TypeError("Invalid type: " + values["@type"]);
13562
+ }
13563
+ const instance = new this({ id: "@id" in values ? new URL(values["@id"]) : void 0 }, options);
13564
+ const _38VmZKmXJSBy3AvgqNa9GVqbdphy_action = [];
13565
+ let _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array = values["https://w3id.org/valueflows/ont/vf#action"];
13566
+ for (const v of _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array == null ? [] : _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array.length === 1 && "@list" in _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array[0] ? _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array[0]["@list"] : _38VmZKmXJSBy3AvgqNa9GVqbdphy_action__array) {
13567
+ if (v == null) continue;
13568
+ _38VmZKmXJSBy3AvgqNa9GVqbdphy_action.push(v["@value"]);
13569
+ }
13570
+ instance.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action = _38VmZKmXJSBy3AvgqNa9GVqbdphy_action;
13571
+ const _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = [];
13572
+ let _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array = values["https://w3id.org/valueflows/ont/vf#resourceConformsTo"];
13573
+ for (const v of _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array == null ? [] : _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array.length === 1 && "@list" in _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array[0] ? _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array[0]["@list"] : _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo__array) {
13574
+ if (v == null) continue;
13575
+ _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.push(v["@id"].startsWith("at://") ? new URL("at://" + encodeURIComponent(v["@id"].includes("/", 5) ? v["@id"].slice(5, v["@id"].indexOf("/", 5)) : v["@id"].slice(5)) + (v["@id"].includes("/", 5) ? v["@id"].slice(v["@id"].indexOf("/", 5)) : "")) : URL.canParse(v["@id"]) && (values["@id"] == null ? options.baseUrl : new URL(values["@id"])) ? new URL(v["@id"]) : new URL(v["@id"], values["@id"] == null ? options.baseUrl : new URL(values["@id"])));
13576
+ }
13577
+ instance.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo;
13578
+ const _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = [];
13579
+ let _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array = values["https://w3id.org/valueflows/ont/vf#resourceQuantity"];
13580
+ for (const v of _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array == null ? [] : _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array.length === 1 && "@list" in _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array[0] ? _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array[0]["@list"] : _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity__array) {
13581
+ if (v == null) continue;
13582
+ _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.push(await Measure.fromJsonLd(v, {
13583
+ ...options,
13584
+ baseUrl: values["@id"] == null ? options.baseUrl : new URL(values["@id"])
13585
+ }));
13586
+ }
13587
+ instance.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity;
13588
+ const _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = [];
13589
+ let _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array = values["https://w3id.org/valueflows/ont/vf#availableQuantity"];
13590
+ for (const v of _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array == null ? [] : _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array.length === 1 && "@list" in _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array[0] ? _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array[0]["@list"] : _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity__array) {
13591
+ if (v == null) continue;
13592
+ _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.push(await Measure.fromJsonLd(v, {
13593
+ ...options,
13594
+ baseUrl: values["@id"] == null ? options.baseUrl : new URL(values["@id"])
13595
+ }));
13596
+ }
13597
+ instance.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity;
13598
+ const _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = [];
13599
+ let _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array = values["https://w3id.org/valueflows/ont/vf#minimumQuantity"];
13600
+ for (const v of _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array == null ? [] : _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array.length === 1 && "@list" in _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array[0] ? _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array[0]["@list"] : _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity__array) {
13601
+ if (v == null) continue;
13602
+ _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.push(await Measure.fromJsonLd(v, {
13603
+ ...options,
13604
+ baseUrl: values["@id"] == null ? options.baseUrl : new URL(values["@id"])
13605
+ }));
13606
+ }
13607
+ instance.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity;
13608
+ if (!("_fromSubclass" in options) || !options._fromSubclass) try {
13609
+ instance._cachedJsonLd = structuredClone(json);
13610
+ } catch {
13611
+ getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
13612
+ }
13613
+ return instance;
13614
+ }
13615
+ _getCustomInspectProxy() {
13616
+ const proxy = {};
13617
+ if (this.id != null) proxy.id = {
13618
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(this.id.href, options),
13619
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(this.id.href, options)
13620
+ };
13621
+ const _38VmZKmXJSBy3AvgqNa9GVqbdphy_action = this.#_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.map((v) => v instanceof URL ? {
13622
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
13623
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
13624
+ } : v);
13625
+ if (_38VmZKmXJSBy3AvgqNa9GVqbdphy_action.length == 1) proxy.action = _38VmZKmXJSBy3AvgqNa9GVqbdphy_action[0];
13626
+ const _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo = this.#_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.map((v) => v instanceof URL ? {
13627
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
13628
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
13629
+ } : v);
13630
+ if (_BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo.length == 1) proxy.resourceConformsTo = _BBAeMUUQDwBQn6cvu3P2Csd6b6h_resourceConformsTo[0];
13631
+ const _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity = this.#_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.map((v) => v instanceof URL ? {
13632
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
13633
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
13634
+ } : v);
13635
+ if (_2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity.length == 1) proxy.resourceQuantity = _2dLfqTbbRiggEcMQWbHpxkQrtmrc_resourceQuantity[0];
13636
+ const _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity = this.#_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.map((v) => v instanceof URL ? {
13637
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
13638
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
13639
+ } : v);
13640
+ if (_YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity.length == 1) proxy.availableQuantity = _YmNSnuih3Zk4VdR5JPVnQYroLAh_availableQuantity[0];
13641
+ const _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity = this.#_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.map((v) => v instanceof URL ? {
13642
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
13643
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
13644
+ } : v);
13645
+ if (_3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity.length == 1) proxy.minimumQuantity = _3XueAFds2NBrqNpnV8b7aC8hV72S_minimumQuantity[0];
13646
+ return proxy;
13647
+ }
13648
+ };
13649
+ Intent.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
13650
+ return "Intent " + inspect(this._getCustomInspectProxy(), options);
13651
+ };
13652
+ Intent.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
13653
+ return "Intent " + inspect(this._getCustomInspectProxy(), options);
13654
+ };
13655
+ /** A published request or offer, sometimes with what is expected in return.
13656
+ *
13657
+ * Proposals contain a primary {@link Intent} (via `publishes`) describing
13658
+ * what is being offered or requested, and optionally a reciprocal
13659
+ * {@link Intent} describing what is expected or offered in return.
13660
+ *
13661
+ * Note: This type extends ActivityStreams `Object` for practical
13662
+ * interoperability within ActivityPub federation, even though FEP-0837
13663
+ * defines `Proposal` as a pure ValueFlows type. Extending `Object`
13664
+ * provides useful inherited properties such as `name`, `content`,
13665
+ * `attributedTo`, `published`, `to`, and `location` without needing to
13666
+ * redefine them.
13667
+ */
13668
+ var Proposal = class Proposal extends Object$1 {
13669
+ /**
13670
+ * The type URI of {@link Proposal}: `https://w3id.org/valueflows/ont/vf#Proposal`.
13671
+ */
13672
+ static get typeId() {
13673
+ return new URL("https://w3id.org/valueflows/ont/vf#Proposal");
13674
+ }
13675
+ #_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = [];
13676
+ #_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = [];
13677
+ #_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = [];
13678
+ #_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = [];
13679
+ /**
13680
+ * Constructs a new instance of Proposal with the given values.
13681
+ * @param values The values to initialize the instance with.
13682
+ * @param options The options to use for initialization.
13683
+ */
13684
+ constructor(values, options = {}) {
13685
+ super(values, options);
13686
+ if ("purpose" in values && values.purpose != null) if (typeof values.purpose === "string") this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = [values.purpose];
13687
+ else throw new TypeError("The purpose must be of type string.");
13688
+ if ("publishes" in values && values.publishes != null) if (values.publishes instanceof Intent) this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = [values.publishes];
13689
+ else throw new TypeError("The publishes must be of type Intent.");
13690
+ if ("reciprocal" in values && values.reciprocal != null) if (values.reciprocal instanceof Intent) this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = [values.reciprocal];
13691
+ else throw new TypeError("The reciprocal must be of type Intent.");
13692
+ if ("unitBased" in values && values.unitBased != null) if (typeof values.unitBased === "boolean") this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = [values.unitBased];
13693
+ else throw new TypeError("The unitBased must be of type boolean.");
13694
+ }
13695
+ /**
13696
+ * Clones this instance, optionally updating it with the given values.
13697
+ * @param values The values to update the clone with.
13698
+ * @param options The options to use for cloning.
13699
+ * @returns The cloned instance.
13700
+ */
13701
+ clone(values = {}, options = {}) {
13702
+ if (this._warning != null) {
13703
+ getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
13704
+ options = {
13705
+ ...options,
13706
+ $warning: this._warning
13707
+ };
13708
+ }
13709
+ const clone = super.clone(values, options);
13710
+ clone.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose;
13711
+ if ("purpose" in values && values.purpose != null) if (typeof values.purpose === "string") clone.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = [values.purpose];
13712
+ else throw new TypeError("The purpose must be of type string.");
13713
+ clone.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes;
13714
+ if ("publishes" in values && values.publishes != null) if (values.publishes instanceof Intent) clone.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = [values.publishes];
13715
+ else throw new TypeError("The publishes must be of type Intent.");
13716
+ clone.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal;
13717
+ if ("reciprocal" in values && values.reciprocal != null) if (values.reciprocal instanceof Intent) clone.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = [values.reciprocal];
13718
+ else throw new TypeError("The reciprocal must be of type Intent.");
13719
+ clone.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased;
13720
+ if ("unitBased" in values && values.unitBased != null) if (typeof values.unitBased === "boolean") clone.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = [values.unitBased];
13721
+ else throw new TypeError("The unitBased must be of type boolean.");
13722
+ return clone;
13723
+ }
13724
+ /** The type of proposal. Possible values are `"offer"` and `"request"`.
13725
+ */
13726
+ get purpose() {
13727
+ if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
13728
+ if (this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.length < 1) return null;
13729
+ return this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose[0];
13730
+ }
13731
+ /** The primary intent of this proposal, describing what is being offered
13732
+ * or requested.
13733
+ */
13734
+ get publishes() {
13735
+ if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
13736
+ if (this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.length < 1) return null;
13737
+ return this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes[0];
13738
+ }
13739
+ /** The reciprocal intent of this proposal, describing what is expected
13740
+ * or offered in return.
13741
+ */
13742
+ get reciprocal() {
13743
+ if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
13744
+ if (this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.length < 1) return null;
13745
+ return this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal[0];
13746
+ }
13747
+ /** Indicates whether the quantities expressed in the proposal can be
13748
+ * multiplied or not. The default is `false`.
13749
+ */
13750
+ get unitBased() {
13751
+ if (this._warning != null) getLogger(this._warning.category).warn(this._warning.message, this._warning.values);
13752
+ if (this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.length < 1) return null;
13753
+ return this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased[0];
13754
+ }
13755
+ /**
13756
+ * Converts this object to a JSON-LD structure.
13757
+ * @param options The options to use.
13758
+ * - `format`: The format of the output: `compact` or
13759
+ `expand`.
13760
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
13761
+ * - `context`: The JSON-LD context to use. Not applicable
13762
+ when `format` is set to `'expand'`.
13763
+ * @returns The JSON-LD representation of this object.
13764
+ */
13765
+ async toJsonLd(options = {}) {
13766
+ if (options.format == null && this._cachedJsonLd != null) return this._cachedJsonLd;
13767
+ if (options.format !== "compact" && options.context != null) throw new TypeError("The context option can only be used when the format option is set to 'compact'.");
13768
+ options = {
13769
+ ...options,
13770
+ contextLoader: options.contextLoader ?? getDocumentLoader()
13771
+ };
13772
+ if (options.format == null && this.isCompactable()) {
13773
+ const result = await super.toJsonLd({
13774
+ ...options,
13775
+ format: void 0,
13776
+ context: void 0
13777
+ });
13778
+ let compactItems = [];
13779
+ for (const v of this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose) {
13780
+ const item = v;
13781
+ compactItems.push(item);
13782
+ }
13783
+ if (compactItems.length > 0) result["purpose"] = compactItems.length > 1 ? compactItems : compactItems[0];
13784
+ compactItems = [];
13785
+ for (const v of this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes) {
13786
+ const item = await v.toJsonLd({
13787
+ ...options,
13788
+ format: void 0,
13789
+ context: void 0
13790
+ });
13791
+ compactItems.push(item);
13792
+ }
13793
+ if (compactItems.length > 0) result["publishes"] = compactItems.length > 1 ? compactItems : compactItems[0];
13794
+ compactItems = [];
13795
+ for (const v of this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal) {
13796
+ const item = await v.toJsonLd({
13797
+ ...options,
13798
+ format: void 0,
13799
+ context: void 0
13800
+ });
13801
+ compactItems.push(item);
13802
+ }
13803
+ if (compactItems.length > 0) result["reciprocal"] = compactItems.length > 1 ? compactItems : compactItems[0];
13804
+ compactItems = [];
13805
+ for (const v of this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased) {
13806
+ const item = v;
13807
+ compactItems.push(item);
13808
+ }
13809
+ if (compactItems.length > 0) result["unitBased"] = compactItems.length > 1 ? compactItems : compactItems[0];
13810
+ result["type"] = "Proposal";
13811
+ if (this.id != null) result["id"] = this.id.href;
13812
+ result["@context"] = [
13813
+ "https://www.w3.org/ns/activitystreams",
13814
+ "https://w3id.org/security/data-integrity/v1",
13815
+ "https://gotosocial.org/ns",
13816
+ {
13817
+ "vf": "https://w3id.org/valueflows/ont/vf#",
13818
+ "om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
13819
+ "fedibird": "http://fedibird.com/ns#",
13820
+ "sensitive": "as:sensitive",
13821
+ "emojiReactions": {
13822
+ "@id": "fedibird:emojiReactions",
13823
+ "@type": "@id"
13824
+ },
13825
+ "Proposal": "vf:Proposal",
13826
+ "Intent": "vf:Intent",
13827
+ "purpose": "vf:purpose",
13828
+ "unitBased": "vf:unitBased",
13829
+ "publishes": "vf:publishes",
13830
+ "reciprocal": "vf:reciprocal",
13831
+ "action": "vf:action",
13832
+ "resourceConformsTo": {
13833
+ "@id": "vf:resourceConformsTo",
13834
+ "@type": "@id"
13835
+ },
13836
+ "resourceQuantity": "vf:resourceQuantity",
13837
+ "availableQuantity": "vf:availableQuantity",
13838
+ "minimumQuantity": "vf:minimumQuantity",
13839
+ "hasUnit": "om2:hasUnit",
13840
+ "hasNumericalValue": "om2:hasNumericalValue"
13841
+ }
13842
+ ];
13843
+ return result;
13844
+ }
13845
+ let array;
13846
+ const values = (await super.toJsonLd({
13847
+ ...options,
13848
+ format: "expand",
13849
+ context: void 0
13850
+ }))[0];
13851
+ array = [];
13852
+ for (const v of this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose) {
13853
+ const element = { "@value": v };
13854
+ array.push(element);
13855
+ }
13856
+ if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#purpose"] = array;
13857
+ array = [];
13858
+ for (const v of this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes) {
13859
+ const element = await v.toJsonLd(options);
13860
+ array.push(element);
13861
+ }
13862
+ if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#publishes"] = array;
13863
+ array = [];
13864
+ for (const v of this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal) {
13865
+ const element = await v.toJsonLd(options);
13866
+ array.push(element);
13867
+ }
13868
+ if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#reciprocal"] = array;
13869
+ array = [];
13870
+ for (const v of this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased) {
13871
+ const element = { "@value": v };
13872
+ array.push(element);
13873
+ }
13874
+ if (array.length > 0) values["https://w3id.org/valueflows/ont/vf#unitBased"] = array;
13875
+ values["@type"] = ["https://w3id.org/valueflows/ont/vf#Proposal"];
13876
+ if (this.id != null) values["@id"] = this.id.href;
13877
+ if (options.format === "expand") return await jsonld.expand(values, { documentLoader: options.contextLoader });
13878
+ const docContext = options.context ?? [
13879
+ "https://www.w3.org/ns/activitystreams",
13880
+ "https://w3id.org/security/data-integrity/v1",
13881
+ "https://gotosocial.org/ns",
13882
+ {
13883
+ "vf": "https://w3id.org/valueflows/ont/vf#",
13884
+ "om2": "http://www.ontology-of-units-of-measure.org/resource/om-2/",
13885
+ "fedibird": "http://fedibird.com/ns#",
13886
+ "sensitive": "as:sensitive",
13887
+ "emojiReactions": {
13888
+ "@id": "fedibird:emojiReactions",
13889
+ "@type": "@id"
13890
+ },
13891
+ "Proposal": "vf:Proposal",
13892
+ "Intent": "vf:Intent",
13893
+ "purpose": "vf:purpose",
13894
+ "unitBased": "vf:unitBased",
13895
+ "publishes": "vf:publishes",
13896
+ "reciprocal": "vf:reciprocal",
13897
+ "action": "vf:action",
13898
+ "resourceConformsTo": {
13899
+ "@id": "vf:resourceConformsTo",
13900
+ "@type": "@id"
13901
+ },
13902
+ "resourceQuantity": "vf:resourceQuantity",
13903
+ "availableQuantity": "vf:availableQuantity",
13904
+ "minimumQuantity": "vf:minimumQuantity",
13905
+ "hasUnit": "om2:hasUnit",
13906
+ "hasNumericalValue": "om2:hasNumericalValue"
13907
+ }
13908
+ ];
13909
+ const compacted = await jsonld.compact(values, docContext, { documentLoader: options.contextLoader });
13910
+ if (docContext != null) {
13911
+ if ("proof" in compacted && compacted.proof != null) if (Array.isArray(compacted.proof)) for (const element of compacted.proof) element["@context"] = docContext;
13912
+ else compacted.proof["@context"] = docContext;
13913
+ }
13914
+ return compacted;
13915
+ }
13916
+ isCompactable() {
13917
+ return super.isCompactable();
13918
+ }
13919
+ /**
13920
+ * Converts a JSON-LD structure to an object of this type.
13921
+ * @param json The JSON-LD structure to convert.
13922
+ * @param options The options to use.
13923
+ * - `documentLoader`: The loader for remote JSON-LD documents.
13924
+ * - `contextLoader`: The loader for remote JSON-LD contexts.
13925
+ * - `tracerProvider`: The OpenTelemetry tracer provider to use.
13926
+ * If omitted, the global tracer provider is used.
13927
+ * @returns The object of this type.
13928
+ * @throws {TypeError} If the given `json` is invalid.
13929
+ */
13930
+ static async fromJsonLd(json, options = {}) {
13931
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer("@fedify/vocab-tools", "2.2.0").startActiveSpan("activitypub.parse_object", async (span) => {
13932
+ try {
13933
+ const object = await this.__fromJsonLd__Proposal__(json, span, options);
13934
+ if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
13935
+ return object;
13936
+ } catch (error) {
13937
+ span.setStatus({
13938
+ code: SpanStatusCode.ERROR,
13939
+ message: String(error)
13940
+ });
13941
+ throw error;
13942
+ } finally {
13943
+ span.end();
13944
+ }
13945
+ });
13946
+ }
13947
+ static async __fromJsonLd__Proposal__(json, span, options = {}) {
13948
+ if (typeof json === "undefined") throw new TypeError("Invalid JSON-LD: undefined.");
13949
+ else if (json === null) throw new TypeError("Invalid JSON-LD: null.");
13950
+ options = {
13951
+ ...options,
13952
+ documentLoader: options.documentLoader ?? getDocumentLoader(),
13953
+ contextLoader: options.contextLoader ?? getDocumentLoader(),
13954
+ tracerProvider: options.tracerProvider ?? trace.getTracerProvider()
13955
+ };
13956
+ let values;
13957
+ if (globalThis.Object.keys(json).length == 0) values = {};
13958
+ else values = (await jsonld.expand(json, {
13959
+ documentLoader: options.contextLoader,
13960
+ keepFreeFloatingNodes: true
13961
+ }))[0] ?? {};
13962
+ if (options.baseUrl == null && values["@id"] != null) options = {
13963
+ ...options,
13964
+ baseUrl: new URL(values["@id"])
13965
+ };
13966
+ if ("@type" in values) span.setAttribute("activitypub.object.type", values["@type"]);
13967
+ if ("@type" in values && !values["@type"].every((t) => t.startsWith("_:"))) {
13968
+ if (!values["@type"].includes("https://w3id.org/valueflows/ont/vf#Proposal")) throw new TypeError("Invalid type: " + values["@type"]);
13969
+ }
13970
+ delete values["@type"];
13971
+ const instance = await super.fromJsonLd(values, {
13972
+ ...options,
13973
+ _fromSubclass: true
13974
+ });
13975
+ if (!(instance instanceof Proposal)) throw new TypeError("Unexpected type: " + instance.constructor.name);
13976
+ const _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = [];
13977
+ let _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array = values["https://w3id.org/valueflows/ont/vf#purpose"];
13978
+ for (const v of _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array == null ? [] : _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array.length === 1 && "@list" in _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array[0] ? _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array[0]["@list"] : _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose__array) {
13979
+ if (v == null) continue;
13980
+ _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.push(v["@value"]);
13981
+ }
13982
+ instance.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose;
13983
+ const _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = [];
13984
+ let _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array = values["https://w3id.org/valueflows/ont/vf#publishes"];
13985
+ for (const v of _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array == null ? [] : _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array.length === 1 && "@list" in _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array[0] ? _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array[0]["@list"] : _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes__array) {
13986
+ if (v == null) continue;
13987
+ _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.push(await Intent.fromJsonLd(v, {
13988
+ ...options,
13989
+ baseUrl: values["@id"] == null ? options.baseUrl : new URL(values["@id"])
13990
+ }));
13991
+ }
13992
+ instance.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes;
13993
+ const _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = [];
13994
+ let _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array = values["https://w3id.org/valueflows/ont/vf#reciprocal"];
13995
+ for (const v of _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array == null ? [] : _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array.length === 1 && "@list" in _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array[0] ? _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array[0]["@list"] : _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal__array) {
13996
+ if (v == null) continue;
13997
+ _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.push(await Intent.fromJsonLd(v, {
13998
+ ...options,
13999
+ baseUrl: values["@id"] == null ? options.baseUrl : new URL(values["@id"])
14000
+ }));
14001
+ }
14002
+ instance.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal;
14003
+ const _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = [];
14004
+ let _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array = values["https://w3id.org/valueflows/ont/vf#unitBased"];
14005
+ for (const v of _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array == null ? [] : _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array.length === 1 && "@list" in _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array[0] ? _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array[0]["@list"] : _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased__array) {
14006
+ if (v == null) continue;
14007
+ _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.push(v["@value"]);
14008
+ }
14009
+ instance.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased;
14010
+ if (!("_fromSubclass" in options) || !options._fromSubclass) try {
14011
+ instance._cachedJsonLd = structuredClone(json);
14012
+ } catch {
14013
+ getLogger(["fedify", "vocab"]).warn("Failed to cache JSON-LD: {json}", { json });
14014
+ }
14015
+ return instance;
14016
+ }
14017
+ _getCustomInspectProxy() {
14018
+ const proxy = super._getCustomInspectProxy();
14019
+ const _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose = this.#_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.map((v) => v instanceof URL ? {
14020
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
14021
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
14022
+ } : v);
14023
+ if (_4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose.length == 1) proxy.purpose = _4wb2xgUBheR2gaD2Se8QBH4LEC7_purpose[0];
14024
+ const _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes = this.#_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.map((v) => v instanceof URL ? {
14025
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
14026
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
14027
+ } : v);
14028
+ if (_sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes.length == 1) proxy.publishes = _sS5LvXX8cn4c3x6ux836AwYbTyJ_publishes[0];
14029
+ const _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal = this.#_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.map((v) => v instanceof URL ? {
14030
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
14031
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
14032
+ } : v);
14033
+ if (_Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal.length == 1) proxy.reciprocal = _Z4ntJgFwR9BaNTbFvkRTGNEwUwy_reciprocal[0];
14034
+ const _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased = this.#_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.map((v) => v instanceof URL ? {
14035
+ [Symbol.for("Deno.customInspect")]: (inspect, options) => "URL " + inspect(v.href, options),
14036
+ [Symbol.for("nodejs.util.inspect.custom")]: (_depth, options, inspect) => "URL " + inspect(v.href, options)
14037
+ } : v);
14038
+ if (_48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased.length == 1) proxy.unitBased = _48ncwmfGhSoqAFByMVh2UxoiozPq_unitBased[0];
14039
+ return proxy;
14040
+ }
14041
+ };
14042
+ Proposal.prototype[Symbol.for("Deno.customInspect")] = function(inspect, options) {
14043
+ return "Proposal " + inspect(this._getCustomInspectProxy(), options);
14044
+ };
14045
+ Proposal.prototype[Symbol.for("nodejs.util.inspect.custom")] = function(_depth, options, inspect) {
14046
+ return "Proposal " + inspect(this._getCustomInspectProxy(), options);
14047
+ };
12976
14048
  /** Indicates that the `actor` accepts the `object`. The `target` property can be
12977
14049
  * used in certain circumstances to indicate the context into which the `object`
12978
14050
  * has been accepted.
@@ -20061,6 +21133,7 @@ var Collection = class Collection extends Object$1 {
20061
21133
  "https://gotosocial.org/ns#AnnounceAuthorization",
20062
21134
  "https://gotosocial.org/ns#LikeApproval",
20063
21135
  "https://gotosocial.org/ns#ReplyAuthorization",
21136
+ "https://w3id.org/valueflows/ont/vf#Proposal",
20064
21137
  "https://www.w3.org/ns/activitystreams#Activity",
20065
21138
  "http://litepub.social/ns#EmojiReact",
20066
21139
  "https://gotosocial.org/ns#AnnounceRequest",
@@ -26302,6 +27375,7 @@ var Link = class Link {
26302
27375
  "https://gotosocial.org/ns#AnnounceAuthorization",
26303
27376
  "https://gotosocial.org/ns#LikeApproval",
26304
27377
  "https://gotosocial.org/ns#ReplyAuthorization",
27378
+ "https://w3id.org/valueflows/ont/vf#Proposal",
26305
27379
  "https://www.w3.org/ns/activitystreams#Activity",
26306
27380
  "http://litepub.social/ns#EmojiReact",
26307
27381
  "https://gotosocial.org/ns#AnnounceRequest",
@@ -28559,6 +29633,7 @@ var OrderedCollection = class OrderedCollection extends Collection {
28559
29633
  "https://gotosocial.org/ns#AnnounceAuthorization",
28560
29634
  "https://gotosocial.org/ns#LikeApproval",
28561
29635
  "https://gotosocial.org/ns#ReplyAuthorization",
29636
+ "https://w3id.org/valueflows/ont/vf#Proposal",
28562
29637
  "https://www.w3.org/ns/activitystreams#Activity",
28563
29638
  "http://litepub.social/ns#EmojiReact",
28564
29639
  "https://gotosocial.org/ns#AnnounceRequest",
@@ -29044,6 +30119,7 @@ var OrderedCollectionPage = class OrderedCollectionPage extends CollectionPage {
29044
30119
  "https://gotosocial.org/ns#AnnounceAuthorization",
29045
30120
  "https://gotosocial.org/ns#LikeApproval",
29046
30121
  "https://gotosocial.org/ns#ReplyAuthorization",
30122
+ "https://w3id.org/valueflows/ont/vf#Proposal",
29047
30123
  "https://www.w3.org/ns/activitystreams#Activity",
29048
30124
  "http://litepub.social/ns#EmojiReact",
29049
30125
  "https://gotosocial.org/ns#AnnounceRequest",
@@ -43708,4 +44784,4 @@ async function* traverseCollection(collection, options = {}) {
43708
44784
  }
43709
44785
  }
43710
44786
  //#endregion
43711
- export { Accept, Activity, Add, Announce, AnnounceAuthorization, AnnounceRequest, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, InteractionPolicy, InteractionRule, IntransitiveActivity, Invite, Join, LanguageString, Leave, Like, LikeAuthorization, LikeRequest, Link, Listen, Mention, Move, Multikey, Note, Object$1 as Object, Offer, OrderedCollection, OrderedCollectionPage, Organization, PUBLIC_COLLECTION, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, ReplyAuthorization, ReplyRequest, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, isActor, isFediverseHandle, lookupObject, normalizeActorHandle, parseFediverseHandle, toAcctUrl, traverseCollection };
44787
+ export { Accept, Activity, Add, Announce, AnnounceAuthorization, AnnounceRequest, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, Intent, InteractionPolicy, InteractionRule, IntransitiveActivity, Invite, Join, LanguageString, Leave, Like, LikeAuthorization, LikeRequest, Link, Listen, Measure, Mention, Move, Multikey, Note, Object$1 as Object, Offer, OrderedCollection, OrderedCollectionPage, Organization, PUBLIC_COLLECTION, Page, Person, Place, Profile, PropertyValue, Proposal, Question, Read, Reject, Relationship, Remove, ReplyAuthorization, ReplyRequest, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, isActor, isFediverseHandle, lookupObject, normalizeActorHandle, parseFediverseHandle, toAcctUrl, traverseCollection };